:root {
  color-scheme: dark;
  --black: #000;
  --ink-100: #f5f5f7;
  --ink-80: rgba(245, 245, 247, 0.82);
  --ink-60: rgba(245, 245, 247, 0.6);
  --ink-40: rgba(245, 245, 247, 0.4);
  --ink-25: rgba(245, 245, 247, 0.25);
  --ink-15: rgba(245, 245, 247, 0.15);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);

  --logo-opacity: 1;
  --logo-y: 0px;
  --logo-scale: 1;
  --logo-blur: 0px;
  --logo-visibility: visible;
  --stack-fan: 0;
  --paper-opacity: 0;
  --paper-burst: 0;
  --fallback-paper-opacity: 0;
  --connectome-opacity: 0;
  --connectome-scale: 1.02;
  --connectome-saturate: 1;
  --connectome-grayscale: 0;
  --connectome-blur: 0px;
  --mri-opacity: 0;
  --mri-scale: 1.05;
  --mri-blur: 0px;
  --signup-opacity: 0;
  --signup-y: 32px;
  --vignette: 0.5;

  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01" on, "cv11" on;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  background: var(--black);
  color: var(--ink-100);
}

body {
  min-width: 320px;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}

::selection { background: rgba(255, 255, 255, 0.18); color: var(--ink-100); }

button, input { font: inherit; font-family: "Geist", inherit; }

em {
  font-family: "Instrument Serif", "Iowan Old Style", "Apple Garamond", serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scroll-experience {
  min-height: 760vh;
  background: var(--black);
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
  isolation: isolate;
  background: var(--black);
}

.stage-veil,
.stage-grain,
.stage-vignette,
.paper-cloud,
.paper-fallback,
.scene,
.scene-image {
  position: absolute;
  inset: 0;
}

.stage-veil {
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 70% at 50% 36%, rgba(80, 100, 180, 0.06), transparent 62%),
    radial-gradient(ellipse 60% 50% at 50% 102%, rgba(0, 0, 0, 0.94), transparent 58%);
}

.stage-vignette {
  z-index: 8;
  pointer-events: none;
  background: radial-gradient(ellipse 110% 110% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.6) 100%);
  opacity: var(--vignette);
  transition: opacity 600ms var(--ease);
}

.stage-grain {
  z-index: 9;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.paper-cloud {
  z-index: 2;
  width: 100%; height: 100%;
  opacity: var(--paper-opacity);
  pointer-events: none;
}

.paper-fallback {
  z-index: 2;
  display: none;
  opacity: var(--fallback-paper-opacity);
  pointer-events: none;
  perspective: 1100px;
}

body.no-webgl .paper-cloud { display: none; }
body.no-webgl .paper-fallback { display: block; }

.fallback-paper-card {
  position: absolute;
  left: 50%; top: 50%;
  width: clamp(82px, 13vw, 142px);
  aspect-ratio: 1.7;
  padding: 9px 10px;
  overflow: hidden;
  color: #080808;
  background: #f5f5f1;
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.34);
  /* Cards shrink toward center and fade as paper-fall progresses (mirrors the
     WebGL reticle convergence so the fallback no longer lingers in front of
     later scenes). */
  opacity: calc(1 - var(--paper-fall, 0));
  transform:
    translate(-50%, -50%)
    translate3d(
      calc((var(--x) * var(--paper-burst)) * (1 - var(--paper-fall, 0))),
      calc((var(--y) * var(--paper-burst)) * (1 - var(--paper-fall, 0))),
      0
    )
    rotate(calc(var(--r) * var(--paper-burst) * (1 - var(--paper-fall, 0))))
    scale(calc((0.16 + (var(--paper-burst) * 0.78)) * (1 - var(--paper-fall, 0) * 0.95)));
  transform-origin: center;
}

.fallback-paper-card strong,
.fallback-paper-card span,
.fallback-paper-card i { display: block; }

.fallback-paper-card strong {
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}

.fallback-paper-card span {
  margin-bottom: 9px;
  color: #444;
  font-size: 7px;
}

.fallback-paper-card i {
  width: 72%;
  height: 4px;
  margin-top: 5px;
  background: #d4d4d2;
}

.scene-image {
  z-index: 1;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: clamp(20px, 4vh, 56px) clamp(18px, 4vw, 54px) 0;
  pointer-events: none;
  user-select: none;
}

.scene-image img {
  max-width: 78%;
  max-height: 70%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.scene-connectome {
  opacity: var(--connectome-opacity);
  will-change: opacity;
}

.scene-connectome img {
  max-width: 68%;
  max-height: 60%;
  margin-top: clamp(20px, 5vh, 60px);
  transform: scale(var(--connectome-scale));
  transform-origin: center;
  filter:
    saturate(var(--connectome-saturate))
    grayscale(var(--connectome-grayscale))
    brightness(0.95)
    blur(var(--connectome-blur));
  mix-blend-mode: lighten;
  will-change: transform, filter;
}

.scene-mri { opacity: var(--mri-opacity); will-change: opacity; }

.scene-mri img {
  transform: scale(var(--mri-scale));
  transform-origin: 63.6% 48.6%;
  filter: brightness(1.02) contrast(1.04) blur(var(--mri-blur));
  will-change: transform, filter;
}

/* Scenes ------------------------------------------------------------------ */
.scene {
  z-index: 3;
  display: grid;
  pointer-events: none;
}

/* Scene 1 — Logo */
.scene-logo {
  z-index: 10;
  place-items: center;
  padding: clamp(24px, 6vw, 84px);
  opacity: var(--logo-opacity);
  visibility: var(--logo-visibility);
  transform: translateY(var(--logo-y)) scale(var(--logo-scale));
  filter: blur(var(--logo-blur));
  will-change: opacity, transform, filter;
}

.logo-lockup {
  display: grid;
  justify-items: center;
  text-align: center;
  animation: logoReveal 1300ms var(--ease) both;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.09em;
  color: #ffffff;
  /* Nunito Sans matches the original NeuroMap wordmark */
  font-family: "Nunito Sans", "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(56px, 11vw, 154px);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
  text-shadow: none;
  /* Override the global grayscale antialiasing — subpixel rendering makes
     white text on a dark background read as crisp white rather than thin gray. */
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
}

.logo-text {
  display: block;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  opacity: 1;
  text-shadow: none;
}

.logo-mark {
  width: 0.84em;
  height: 0.54em;
  display: block;
  color: currentColor;
  overflow: visible;
  filter: none;
}

.logo-mark .logo-stack {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
}

.logo-mark .logo-stack-1 {
  transform: translateY(calc(var(--stack-fan) * -180%));
  opacity: calc(1 - var(--stack-fan) * 0.7);
}

.logo-mark .logo-stack-2 {
  opacity: calc(0.72 - var(--stack-fan) * 0.5);
}

.logo-mark .logo-stack-3 {
  transform: translateY(calc(var(--stack-fan) * 180%));
  opacity: calc(0.48 - var(--stack-fan) * 0.35);
}

@keyframes logoReveal {
  0%   { opacity: 1; transform: translateY(18px); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0);  filter: blur(0); }
}

/* Scenes 2–4 — Headlines */
.scene-headline {
  z-index: 10;
  align-items: end;
  justify-items: center;
  padding: clamp(32px, 7vw, 110px);
  padding-bottom: clamp(72px, 12vh, 140px);
}

/* Soft scrim under each headline so type stays legible over imagery */
.scene-headline::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 62%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.55) 30%, rgba(0, 0, 0, 0.18) 65%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 420ms var(--ease);
}

.scene-headline.is-reveal-enter::before {
  opacity: 0.95;
}

/* Cloud scene: headline lives in the center halo cleared by the cards */
.scene-headline--cloud {
  align-items: center;
}

.scene-headline--cloud::before {
  inset: 0;
  height: auto;
  background: radial-gradient(ellipse 48% 32% at 50% 50%, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.32) 55%, transparent 78%);
}


.scene-headline h2,
.scene-headline .scene-eyebrow { position: relative; }

.scene-headline h2 {
  max-width: 1180px;
  margin: 0;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  font-family: "Geist", inherit;
  font-size: clamp(36px, 6.4vw, 100px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 22px 80px rgba(0, 0, 0, 0.55);
}

.scene-headline--target h2,
.scene-headline--target .line-inner {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.scene-eyebrow {
  display: block;
  margin-bottom: clamp(20px, 3vh, 32px);
  color: var(--ink-60);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.scene-eyebrow .line { padding-bottom: 0; }

/* Line-mask reveal -------------------------------------------------------- */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.12em;
}

.line-inner {
  display: block;
  transform: translateY(110%);
  opacity: 0;
  filter: blur(8px);
  transition:
    transform 950ms var(--ease),
    opacity 620ms var(--ease),
    filter 620ms var(--ease);
  transition-delay: var(--reveal-delay, 0s);
  will-change: transform, opacity, filter;
}

.reveal[data-state="enter"] .line-inner,
[data-eyebrow][data-state="enter"] .line-inner {
  transform: translateY(0);
  opacity: 1;
  filter: blur(0);
}

.reveal[data-state="exit"] .line-inner,
[data-eyebrow][data-state="exit"] .line-inner {
  transform: translateY(-110%);
  opacity: 0;
  filter: blur(8px);
}

.scene-eyebrow .line-inner { transition-delay: 0ms; }
.reveal .line:nth-child(1) .line-inner { --reveal-delay: 60ms; }
.reveal .line:nth-child(2) .line-inner { --reveal-delay: 180ms; }
.reveal .line:nth-child(3) .line-inner { --reveal-delay: 300ms; }
.reveal .line:nth-child(4) .line-inner { --reveal-delay: 420ms; }

/* Scene 5 — Signup */
.scene-signup {
  z-index: 10;
  place-items: center;
  padding: clamp(24px, 6vw, 84px);
  background: rgba(0, 0, 0, 0.86);
  opacity: var(--signup-opacity);
  transform: translateY(var(--signup-y));
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  will-change: opacity, transform;
}

.scene-signup.is-active { pointer-events: auto; }

.signup-shell {
  width: min(720px, 100%);
  display: grid;
  justify-items: center;
  gap: 28px;
  text-align: center;
}

.signup-shell .signup-form { max-width: 520px; }

.signup-eyebrow {
  color: var(--ink-60);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.signup-eyebrow .line { padding-bottom: 0; }

.signup-headline {
  margin: 0;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  font-family: "Geist", inherit;
  font-size: clamp(40px, 6.4vw, 80px);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.04em;
  text-align: center;
}

.signup-subhead {
  margin: 0;
  max-width: 540px;
  color: var(--ink-60);
  font-size: clamp(15px, 1.2vw, 18px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.005em;
  text-align: center;
  text-wrap: balance;
}

.signup-form {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 56px;
  margin-top: 8px;
  border-bottom: 1px solid var(--ink-25);
  background: transparent;
  transition: border-color 280ms var(--ease);
}

.signup-form:focus-within { border-color: var(--ink-100); }

.signup-form input {
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 16px 4px;
  color: var(--ink-100);
  background: transparent;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.005em;
}

.signup-form input::placeholder { color: var(--ink-40); }

.signup-form button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 0 24px;
  border: 0;
  color: var(--ink-100);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: opacity 200ms var(--ease);
}

.submit-arrow {
  display: inline-block;
  transition: transform 280ms var(--ease);
}

.signup-form button:hover .submit-arrow,
.signup-form button:focus-visible .submit-arrow { transform: translateX(5px); }

.signup-form button:disabled { opacity: 0.55; cursor: default; }
.signup-form button:disabled .submit-arrow { transform: none; }

.form-note {
  margin: 0;
  min-height: 1.45em;
  color: var(--ink-60);
  font-size: 14px;
  letter-spacing: 0.01em;
}

/* No-motion fallback ------------------------------------------------------ */
body.no-motion .scroll-experience { min-height: auto; }

body.no-motion .stage {
  min-height: 100vh;
  height: auto;
  display: grid;
  gap: 100px;
  padding: 80px 0;
}

body.no-motion .scene,
body.no-motion .scene-image,
body.no-motion .paper-cloud,
body.no-motion .paper-fallback {
  position: relative;
  inset: auto;
}

body.no-motion .paper-cloud,
body.no-motion .paper-fallback,
body.no-motion .stage-veil,
body.no-motion .stage-vignette,
body.no-motion .stage-grain { display: none; }

body.no-motion .scene-logo,
body.no-motion .scene-headline,
body.no-motion .scene-signup { opacity: 1; transform: none; filter: none; }

body.no-motion .scene-image {
  height: auto;
  max-height: 78vh;
  opacity: 1;
  transform: none;
}

body.no-motion .reveal .line-inner,
body.no-motion .scene-eyebrow .line-inner { transform: none; opacity: 1; filter: none; }

@media (max-width: 720px) {
  .stage { min-height: 560px; }
  .scene { padding: 24px; }
  .brand-logo { font-size: clamp(48px, 16vw, 74px); gap: 0.14em; }
  .scene-headline { padding: 24px; padding-bottom: 72px; }
  .scene-headline h2 { font-size: clamp(32px, 8.6vw, 50px); }
  .scene-eyebrow { font-size: 11px; }
  .signup-headline { font-size: clamp(34px, 9vw, 50px); }
  .signup-form {
    grid-template-columns: 1fr;
    min-height: 124px;
    border-bottom: 0;
  }
  .signup-form input {
    min-height: 60px;
    padding: 0 4px;
    border-bottom: 1px solid var(--ink-25);
  }
  .signup-form button {
    min-height: 60px;
    justify-content: center;
    padding: 0;
    border-bottom: 1px solid transparent;
  }
}
