/* Managed-agents story page: deep-field look, one idea per screen.
   Base rules give a complete static page. Motion lives only inside the
   prefers-reduced-motion: no-preference block at the end, and scroll-linked
   motion only where the browser supports scroll timelines. */

:root {
  color-scheme: dark;
  --bg: #05060f;
  --bg-mid: #0b1026;
  --ink: #eef2ff;
  --muted: #aab4d4;
  --line: #2a335a;
  /* Form field edges need 3:1 against the card (WCAG 1.4.11); --line is decoration only. */
  --field-line: #636f9f;
  --accent: #ffc46b;
  --accent-ink: #1a1205;
  --glass: rgb(255 255 255 / 5%);
  --cyan: #7dd3fc;
  --rose: #fda4af;
  --radius: 16px;
  --gutter: clamp(1rem, 5vw, 7.5rem);
  --measure: 72rem;
  --nav-h: 3.5rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: clip;
}

h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

/* Keeps anchor jumps and keyboard focus clear of the fixed chapter nav. */
html {
  scroll-padding-top: calc(var(--nav-h) + 1.5rem);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Sky: three tiled star layers at different depths, plus the WebGL canvas. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(120% 80% at 70% 10%, #141a3d 0%, var(--bg-mid) 35%, var(--bg) 75%);
  pointer-events: none;
}

.sky-layer {
  position: absolute;
  inset: 0 0 -60% 0;
}

.sky-far {
  background-image:
    radial-gradient(1px 1px at 23px 41px, rgb(238 242 255 / 55%), transparent),
    radial-gradient(1px 1px at 97px 13px, rgb(185 205 255 / 50%), transparent),
    radial-gradient(1px 1px at 151px 88px, rgb(238 242 255 / 45%), transparent),
    radial-gradient(1px 1px at 61px 129px, rgb(255 224 178 / 45%), transparent),
    radial-gradient(1px 1px at 189px 171px, rgb(238 242 255 / 50%), transparent),
    radial-gradient(1px 1px at 131px 193px, rgb(185 205 255 / 40%), transparent),
    radial-gradient(1px 1px at 11px 187px, rgb(238 242 255 / 40%), transparent),
    radial-gradient(1px 1px at 173px 37px, rgb(238 242 255 / 45%), transparent);
  background-size: 211px 211px;
}

.sky-mid {
  background-image:
    radial-gradient(1.4px 1.4px at 47px 83px, rgb(238 242 255 / 75%), transparent),
    radial-gradient(1.4px 1.4px at 211px 29px, rgb(185 205 255 / 70%), transparent),
    radial-gradient(1.4px 1.4px at 301px 197px, rgb(255 224 178 / 65%), transparent),
    radial-gradient(1.4px 1.4px at 139px 263px, rgb(238 242 255 / 70%), transparent),
    radial-gradient(1.4px 1.4px at 263px 331px, rgb(185 205 255 / 60%), transparent),
    radial-gradient(1.4px 1.4px at 19px 307px, rgb(238 242 255 / 60%), transparent);
  background-size: 347px 347px;
}

.sky-near {
  background-image:
    radial-gradient(2px 2px at 89px 151px, rgb(238 242 255 / 90%), transparent),
    radial-gradient(2px 2px at 383px 59px, rgb(255 224 178 / 80%), transparent),
    radial-gradient(2px 2px at 457px 389px, rgb(185 205 255 / 85%), transparent),
    radial-gradient(2px 2px at 211px 467px, rgb(238 242 255 / 80%), transparent);
  background-size: 523px 523px;
}

.sky-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.sky-canvas[data-ready] {
  opacity: 1;
}

/* Chapter bar: fixed pill at the top, scrolls sideways on narrow screens. */
.chapters {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  translate: -50% 0;
  z-index: 10;
  max-width: calc(100vw - 1.5rem);
  background: rgb(8 10 26 / 78%);
  border: 1px solid var(--line);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  overflow-x: auto;
  scrollbar-width: none;
}

.chapters ol {
  display: flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
}

.chapters a {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
}

.chapters a:hover {
  color: var(--ink);
}

.chapters a[aria-current] {
  color: var(--accent);
  background: rgb(255 196 107 / 10%);
  font-weight: 600;
}

@media (min-width: 600px) {
  .chapters a {
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
  }
}

/* Layout */
.story-main {
  display: block;
}


.block,
.ideas,
.journey-stage,
.privacy,
#intake-form,
#intake-status {
  width: min(100% - 2 * var(--gutter), var(--measure));
  margin-inline: auto;
}

.block {
  padding-block: clamp(3rem, 9vw, 6rem) 0;
  display: grid;
  gap: 1rem;
}

.block h2,
.journey h2 {
  font-size: clamp(2rem, 5vw, 3.6rem);
}

.block > p,
.columns p {
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  max-width: 50rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Hero: full-screen stage with nebula, headline and the planet horizon. */
.hero {
  position: relative;
}

.hero-stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: clip;
  padding: calc(var(--nav-h) + 2rem) var(--gutter) clamp(9rem, 22vh, 14rem);
}

.hero-nebula img,
.hero-planet img,
.galaxy img,
.probe img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-nebula {
  position: absolute;
  inset: 0;
  opacity: 0.85;
  /* Fade into the sky so the stage never ends on a hard line. */
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
}

.hero-nebula img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 40%;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  max-width: 54rem;
  text-align: center;
}

.hero-copy::before {
  /* Soft dark halo so the copy keeps its contrast over the brightest nebula. */
  content: "";
  position: absolute;
  inset: -12% -10%;
  z-index: -1;
  background: radial-gradient(closest-side, rgb(5 6 15 / 70%), transparent);
}

.hero h1 {
  font-size: clamp(2.6rem, 7.4vw, 6rem);
  font-weight: 700;
}

.lede {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: #d4dbf2;
  max-width: 44rem;
}

.audience {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 38rem;
}

.cta,
#intake-form button {
  display: inline-block;
  padding: 0.95rem 2rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  box-shadow: 0 0 2.5rem rgb(255 196 107 / 35%);
  cursor: pointer;
}

.cta:hover,
#intake-form button:hover {
  background: #ffd38f;
}

.hero-planet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(60rem, 120vw);
  translate: -50% 78%;
}

/* Three ideas */
.ideas {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  padding-block: 2rem 0;
}

.tile,
.card {
  background: rgb(11 16 38 / 72%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.tile h3 {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
}

.tile p,
.card {
  color: var(--muted);
}

.card strong {
  color: var(--ink);
}

/* How it works: four stars joined by a constellation line. */
.journey-stage {
  display: grid;
  gap: 1rem;
  padding-block: clamp(4rem, 10vw, 7rem) 0;
}

.steps {
  position: relative;
  margin-top: 1.5rem;
}

.constellation {
  display: none;
}

.step-list {
  position: relative;
  display: grid;
  gap: 2rem;
  margin: 0;
  padding: 0 0 0 2.75rem;
  list-style: none;
}

.step-list::before {
  /* Phone layout: one vertical line through the four stars. */
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 2px;
  background: linear-gradient(var(--accent), rgb(255 196 107 / 25%));
  transform-origin: top;
}

.step {
  position: relative;
}

.step::before {
  content: "";
  position: absolute;
  left: -2.75rem;
  top: 0.3rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgb(255 196 107 / 18%), 0 0 1.5rem rgb(255 196 107 / 70%);
}

.step h3 {
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
}

.step p {
  color: var(--muted);
}

.next-step {
  margin-top: 2.5rem;
  padding: 1rem 1.5rem;
  background: rgb(11 16 38 / 80%);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
}

@media (min-width: 900px) {
  .constellation {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
  }

  .constellation polyline {
    fill: none;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
  }

  .constellation-trail {
    stroke: rgb(255 196 107 / 22%);
  }

  .constellation-path {
    stroke: var(--accent);
  }

  .step-list {
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    height: 30rem;
    padding: 0;
  }

  .step-list::before {
    display: none;
  }

  /* Stars sit at 38% and 62% of the band, matching the polyline points. */
  .step {
    height: 100%;
    text-align: center;
    padding-inline: 0.75rem;
  }

  .step::before {
    left: 50%;
    top: 38%;
    translate: -50% -50%;
  }

  .step:nth-child(even)::before {
    top: 62%;
  }

  .step-copy {
    position: absolute;
    inset-inline: 0.75rem;
    bottom: calc(62% + 1.5rem);
  }

  .step:nth-child(even) .step-copy {
    bottom: auto;
    top: calc(62% + 1.5rem);
  }

  .next-step {
    justify-self: center;
    padding-inline: 3rem;
  }
}

/* Work */
.who {
  position: relative;
}

.who .probe {
  width: min(22rem, 60vw);
  justify-self: end;
  rotate: -8deg;
}

@media (min-width: 900px) {
  .who {
    grid-template-columns: 1fr 20rem;
    column-gap: 3rem;
  }

  .who > :not(.probe) {
    grid-column: 1;
  }

  .who .probe {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.exchange {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
}

.card-accent {
  border-color: rgb(255 196 107 / 45%);
}

.card-accent strong {
  color: var(--accent);
}

/* Terms */
.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1rem 2.5rem;
}

.not-for {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: rgb(11 16 38 / 85%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.not-for ul {
  display: grid;
  gap: 0.9rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.not-for li {
  position: relative;
  padding-left: 1.75rem;
}

.not-for li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 0.8rem;
  height: 0.8rem;
  border: 2px solid var(--rose);
  border-radius: 50%;
}

.privacy {
  display: block;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(11 16 38 / 60%);
}

.privacy summary {
  cursor: pointer;
  font-weight: 600;
}

.privacy p {
  margin-top: 0.75rem;
  color: var(--muted);
}

/* Request: the form card over the galaxy. */
.request {
  position: relative;
  isolation: isolate;
  /* The galaxy bleeds past the edge; clip it here so phones never zoom out. */
  overflow-x: clip;
  padding-bottom: 1rem;
}

.galaxy {
  /* Phones: the galaxy opens the chapter above the heading, never behind body text. */
  display: block;
  width: 130vw;
  margin: 1rem 0 -5rem -15vw;
  mix-blend-mode: screen;
  opacity: 0.8;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent);
  mask-image: radial-gradient(closest-side, #000 55%, transparent);
}

@media (min-width: 900px) {
  .galaxy {
    position: absolute;
    z-index: -1;
    top: 2rem;
    right: -20vw;
    width: min(70rem, 140vw);
    margin: 0;
  }
}

#intake-form {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  max-width: 40rem;
  margin-left: max(var(--gutter), calc((100% - var(--measure)) / 2));
  background: rgb(11 16 38 / 88%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

#intake-form small {
  color: var(--muted);
  font-size: 0.9rem;
}

#intake-form textarea,
#intake-form input[type="text"] {
  margin-top: 0.5rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: #070914;
  color: var(--ink);
  font: inherit;
}

#intake-form ::placeholder {
  color: #8a94b8;
}

#intake-form input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0 0.5rem 0 0;
  vertical-align: -0.15rem;
  accent-color: var(--accent);
}

/* The text fields say "(required)" in their labels; the consent box is required too but its
   approved label does not say so. CSS adds the same marker, so the form markup stays untouched. */
#intake-form label:has(> input[type="checkbox"][required])::after {
  content: " (required)";
  font-weight: 700;
}

#intake-status {
  max-width: 40rem;
  margin: 1rem 0 0 max(var(--gutter), calc((100% - var(--measure)) / 2));
  padding: 0.9rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(11 16 38 / 88%);
}

#intake-status.notice-success {
  border-color: #4ade80;
}

#intake-status.notice-error {
  border-color: var(--rose);
}

/* Questions: money first, as the list is already ordered. */
.faq-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 2rem 3rem;
  margin-top: 1rem;
}

.faq-item h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.faq-item p,
.meta {
  color: var(--muted);
}

.meta {
  font-size: 0.85rem;
  margin-top: 1.5rem;
}

.story-status {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 4rem var(--gutter) 2.5rem;
}

.story-status a {
  color: var(--muted);
}

/* Motion. Nothing below runs for readers who ask for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .sky-canvas {
    transition: opacity 1.2s ease;
  }

  /* Fallback for browsers without scroll timelines: story.js adds these classes. */
  .reveal-js .reveal {
    transition: opacity 0.7s ease, translate 0.7s ease;
  }

  .reveal-js .reveal:not(.is-in) {
    opacity: 0;
    translate: 0 2rem;
  }

  .reveal-js .constellation-path {
    transition: clip-path 1.6s ease 0.2s;
  }

  .reveal-js .journey:not(.is-in) .constellation-path {
    clip-path: inset(0 100% 0 0);
  }

  @supports (animation-timeline: view()) {
    /* Star layers drift at three speeds as the page scrolls. */
    .sky-layer {
      animation: drift linear both;
      animation-timeline: scroll(root);
      will-change: transform;
    }

    .sky-far {
      --drift: -6%;
    }

    .sky-mid {
      --drift: -14%;
    }

    .sky-near {
      --drift: -26%;
    }

    /* Pinned hero: the copy scales away while the planet rises. */
    .hero {
      height: 200vh;
      view-timeline: --hero;
    }

    .hero-stage {
      position: sticky;
      top: 0;
      height: 100svh;
    }

    .hero-copy {
      animation: hero-out linear both;
      animation-timeline: --hero;
      animation-range: contain 0% contain 55%;
    }

    .hero-planet {
      animation: planet-rise linear both;
      animation-timeline: --hero;
      animation-range: contain 0% contain 100%;
    }

    .hero-nebula {
      animation: nebula-drift linear both;
      animation-timeline: --hero;
      animation-range: contain 0% contain 100%;
    }

    .ideas {
      margin-top: -60vh;
    }

    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }

    /* Phone: the line grows down the steps and each star lights as it enters. */
    .journey {
      view-timeline: --journey;
    }

    .step-list::before {
      animation: grow linear both;
      animation-timeline: --journey;
      animation-range: cover 20% cover 60%;
    }

    .step::before {
      animation: light linear both;
      animation-timeline: view();
      animation-range: entry 60% cover 40%;
    }

    .constellation-path {
      animation: draw linear both;
      animation-timeline: --journey;
      animation-range: cover 25% cover 55%;
    }
  }

  /* Desktop with room: pin the steps and draw the line one star at a time. */
  @supports (animation-timeline: view()) {
    @media (min-width: 900px) and (min-height: 640px) {
      .journey {
        height: 240vh;
      }

      .journey-stage {
        position: sticky;
        top: 0;
        min-height: 100svh;
        align-content: center;
        padding-block: calc(var(--nav-h) + 1.5rem) 1.5rem;
      }

      .constellation-path {
        animation-range: contain 5% contain 75%;
      }

      .step::before {
        animation: light linear both;
        animation-timeline: --journey;
      }

      .step-copy {
        animation: dim linear both;
        animation-timeline: --journey;
      }

      .step:nth-child(1)::before,
      .step:nth-child(1) .step-copy {
        animation-range: contain 0% contain 6%;
      }

      .step:nth-child(2)::before,
      .step:nth-child(2) .step-copy {
        animation-range: contain 24% contain 30%;
      }

      .step:nth-child(3)::before,
      .step:nth-child(3) .step-copy {
        animation-range: contain 47% contain 53%;
      }

      .step:nth-child(4)::before,
      .step:nth-child(4) .step-copy {
        animation-range: contain 70% contain 76%;
      }
    }
  }
}

@keyframes drift {
  to {
    transform: translate3d(0, var(--drift, -10%), 0);
  }
}

@keyframes hero-out {
  to {
    opacity: 0;
    transform: scale(0.84) translateY(-6vh);
  }
}

@keyframes planet-rise {
  55% {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(-34vh) scale(1.35);
  }
}

@keyframes nebula-drift {
  to {
    opacity: 0.35;
    transform: scale(1.2);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(2.5rem);
  }
}

@keyframes grow {
  from {
    transform: scaleY(0);
  }
}

@keyframes light {
  from {
    opacity: 0.3;
    scale: 0.55;
  }
}

@keyframes dim {
  from {
    opacity: 0.35;
  }
}

@keyframes draw {
  from {
    clip-path: inset(0 100% 0 0);
  }
}
