*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #525252;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease-part: cubic-bezier(0.65, 0, 0.28, 1);
  --ease-settle: cubic-bezier(0.16, 1, 0.3, 1);
  --title-home-y: calc(50vh - 54px);
  --title-header-y: 32px;
  --title-header-scale: 0.72;
  --loc-home-y: calc(50vh - 10px);
  --loc-footer-y: calc(100vh - 76px);
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--fg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Text-in-place transition (matching BarnWebsite) */
.text-in-place {
  position: relative;
  display: grid;
}

.text-in-place-layer {
  display: block;
  grid-area: 1 / 1;
}

.text-in-place-layer[data-active="false"] {
  pointer-events: none;
  user-select: none;
}

.text-in-place-word {
  display: inline-block;
  white-space: nowrap;
}

.text-in-place-letter {
  display: inline-block;
  opacity: 0;
  filter: blur(5px);
  transition:
    opacity 720ms var(--ease-part),
    filter 720ms var(--ease-part);
}

.text-in-place-layer[data-active="true"] .text-in-place-letter {
  opacity: 1;
  filter: blur(0px);
  transition-duration: 960ms;
  transition-timing-function: var(--ease-settle);
  transition-delay: calc(var(--letter-index) * 34ms);
}

.text-in-place[data-animate="false"] .text-in-place-letter,
.text-in-place[data-animate="false"] .text-in-place-layer[data-active="true"] .text-in-place-letter {
  transition: none;
}

@keyframes vellumSheet {
  0% {
    transform: scale(0.952);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes vellumChar {
  0% {
    opacity: 0;
    filter: blur(18px);
    transform: scale(0.965);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
  }
}

@keyframes vellumFooter {
  0% {
    opacity: 0;
    filter: blur(13px);
    transform: scale(0.965);
  }
  100% {
    opacity: 1;
    filter: blur(0px);
    transform: scale(1);
  }
}

.vellum-ink {
  display: inline-block;
  transform-origin: center center;
}

.vellum-char {
  display: inline-block;
  transform-origin: center center;
}

body[data-intro="pending"] .vellum-ink,
body[data-intro="pending"] .footer-nav,
body[data-intro="pending"] .companies-stage {
  opacity: 0;
}

body[data-intro="active"] .vellum-ink {
  will-change: transform;
  animation: vellumSheet 1850ms var(--ease-settle) 90ms both;
}

body[data-intro="active"] .vellum-char {
  will-change: transform, opacity, filter;
  animation: vellumChar 1550ms var(--ease-settle) calc(90ms + var(--fold-delay, 0ms)) both;
}

body[data-intro="active"] .companies-stage {
  will-change: transform, opacity, filter;
  animation: vellumFooter 1650ms var(--ease-settle) 220ms both;
}

body[data-intro="active"] .footer-nav {
  transform-origin: center center;
  will-change: transform, opacity, filter;
  animation: vellumFooter 1550ms var(--ease-settle) 480ms both;
}

/* Landing page */
.landing {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(40px + env(safe-area-inset-top)) 20px calc(88px + env(safe-area-inset-bottom));
  overflow: hidden;
}

body[data-view="companies"] .landing {
  touch-action: none;
}

/* Parting title & locations: driven smoothly by JS in lockstep with wheel unmask */
.hero-title,
.hero-locations {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  z-index: 25;
  will-change: transform;
  transform-origin: center top;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(20px, 2.5vw, 28px);
  letter-spacing: 0.16em;
  padding-left: 0.16em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--fg);
  transform: translate3d(0, var(--title-home-y), 0) scale(1);
  transition: opacity 560ms var(--ease-settle);
}

.hero-locations {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--fg);
  pointer-events: none;
  transform: translate3d(0, var(--loc-home-y), 0);
  will-change: transform, opacity, filter;
}

body[data-view="companies"] .hero-title {
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  body[data-view="companies"] .hero-title:hover {
    opacity: 0.6;
  }
}

/* Companies wheel unmasked via moving progressive blur & fade curtains (no hard clip edges) */
.companies-stage {
  place-items: center;
  width: 100%;
  max-width: 560px;
  visibility: hidden;
  pointer-events: none;
}

body[data-view="companies"] .companies-stage {
  pointer-events: auto;
}

/* Companies vertical infinite click wheel */
.companies {
  width: 100%;
  position: relative;
}

.wheel-viewport {
  position: relative;
  width: 100%;
  height: 316px;
  overflow: hidden;
  contain: layout style paint;
  background-color: var(--bg);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.wheel-viewport.is-dragging {
  cursor: grabbing;
}

.wheel-track {
  position: absolute;
  inset: 0;
}

.wheel-item {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 50px;
  margin-top: -25px;
  display: flex;
  align-items: center;
  justify-content: center;
  contain: layout style;
  will-change: transform;
}

/* Optical progressive blur & gradient fade curtains sitting IN FRONT of the wheel */
.wheel-curtain,
.wheel-fade {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  will-change: transform;
}

.wheel-curtain {
  z-index: 15;
}

.wheel-curtain--top {
  top: 0;
}

.wheel-curtain--bottom {
  bottom: 0;
}

.wheel-blur-slice {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wheel-fade {
  z-index: 16;
}

.wheel-fade--top {
  top: 0;
}

.wheel-fade--top::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - 1px);
  height: 320px;
  background: var(--bg);
}

.wheel-fade--bottom {
  bottom: 0;
}

.wheel-fade--bottom::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  height: 320px;
  background: var(--bg);
}

.wheel-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 480ms var(--ease-settle);
}

.wheel-name {
  display: inline-block;
}

.wheel-badge {
  position: absolute;
  left: calc(100% - 6px);
  top: 50%;
  transform: translateY(-48%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px 1.5px;
  border-radius: 999px;
  background-color: transparent;
  border: 1px solid var(--fg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  pointer-events: none;
}

.wheel-badge:empty {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .wheel-viewport:not(.is-dragging) .wheel-link:hover {
    opacity: 0.55;
  }
}

/* Footer */
.footer {
  position: fixed;
  bottom: calc(32px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 22px;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.2;
}

.footer-nav a,
.home-link a {
  color: var(--fg);
  text-decoration: none;
  transition: opacity 480ms var(--ease-settle);
}

.footer-toggle {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: opacity 480ms var(--ease-settle);
}

.footer-toggle .text-in-place-layer {
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .footer-nav a:hover,
  .footer-toggle:hover,
  .home-link a:hover {
    opacity: 0.55;
  }
}

.footer-nav a:focus-visible,
.footer-toggle:focus-visible,
.wheel-link:focus-visible,
.home-link a:focus-visible,
.investments-copy a:focus-visible {
  outline: 1.5px solid var(--fg);
  outline-offset: 3px;
}

/* Standalone /investments/ fallback page */
.investments-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.investments-copy {
  max-width: 720px;
  padding: 64px 40px 40px 36px;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  line-height: 1.35;
  color: var(--fg);
}

.investments-copy p {
  margin: 0 0 16px;
}

.investments-copy ul {
  margin: 0 0 16px;
  padding-left: 40px;
  list-style: disc outside;
}

.investments-copy li {
  margin: 2px 0;
}

.investments-copy a {
  color: #0000ee;
  text-decoration: underline;
}

.investments-copy a:visited {
  color: #551a8b;
}

.home-link {
  margin: auto 0 36px;
  text-align: center;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.2;
}

/* Live wheel tuner (collapsible, bottom-right, ?tune=1 only) */
.wheel-tuner {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 40;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--fg);
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.wheel-tuner[data-visible="true"] {
  display: flex;
}

.wheel-tuner-toggle {
  appearance: none;
  background: #ffffff;
  color: var(--fg);
  border: 1px solid #d4d4d4;
  border-radius: 999px;
  padding: 5px 11px;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}

.wheel-tuner-toggle:hover {
  border-color: var(--fg);
}

.wheel-tuner-panel {
  width: 248px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  gap: 10px;
}

.wheel-tuner[data-open="true"] .wheel-tuner-panel {
  display: flex;
}

.wheel-tuner-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wheel-tuner-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.wheel-tuner-val {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.wheel-tuner-panel input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: #0a0a0a;
  cursor: pointer;
}

.wheel-tuner-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.wheel-tuner-check input {
  margin: 0;
  accent-color: #0a0a0a;
}

.wheel-tuner-actions {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}

.wheel-tuner-actions button {
  flex: 1;
  appearance: none;
  background: #ffffff;
  color: var(--fg);
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  cursor: pointer;
}

.wheel-tuner-actions button:hover {
  border-color: var(--fg);
}

/* Optional visual guides on the wheel */
.wheel-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  display: none;
}

.wheel-guides[data-show="true"] {
  display: block;
}

.wheel-guide-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed;
  font-family: var(--font-sans);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wheel-guide-line span {
  position: absolute;
  right: 4px;
  top: -11px;
  background: rgba(255, 255, 255, 0.9);
  padding: 1px 4px;
}

.wheel-guide-blur {
  border-color: rgba(37, 99, 235, 0.55);
  color: #2563eb;
}

.wheel-guide-fade {
  border-color: rgba(220, 38, 38, 0.5);
  color: #dc2626;
}

@media (max-width: 640px) {
  :root {
    --title-header-scale: 0.85;
  }

  .hero-title {
    font-size: 20px;
    letter-spacing: 0.14em;
    padding-left: 0.14em;
  }

  .hero-locations,
  .footer-nav,
  .home-link {
    font-size: 12px;
  }

  .wheel-viewport {
    height: 272px;
  }

  .wheel-item {
    height: 43px;
    margin-top: -21.5px;
  }

  .wheel-link {
    font-size: 18px;
  }

  .wheel-badge {
    font-size: 7px;
    padding: 1.5px 4.5px 1px;
    left: calc(100% - 7px);
  }

  .footer {
    bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .investments-copy {
    padding: 48px 20px 40px;
  }
}

/* Compact / landscape mobile viewports */
@media (max-height: 520px) {
  :root {
    --title-header-scale: 0.72;
  }

  .landing {
    padding: calc(44px + env(safe-area-inset-top)) 20px calc(68px + env(safe-area-inset-bottom));
  }

  .wheel-viewport {
    height: 208px;
  }

  .wheel-item {
    height: 35px;
    margin-top: -17.5px;
  }

  .wheel-link {
    font-size: 16px;
    padding: 4px 12px;
  }

  .footer {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title,
  .hero-locations,
  .companies-stage,
  .vellum-ink,
  .vellum-char,
  .footer-nav,
  .text-in-place-layer .text-in-place-letter,
  .text-in-place-layer[data-active="true"] .text-in-place-letter {
    transition: none;
    animation: none !important;
  }
}
