/* MEADOWLINE · Butter. Emulsified. (parody, cinematic-launch genre)
   Static-first: base styles are a normal stacked document; html.conductor
   pins panels over the WebGL canvas and scroll drives the chapters. */

:root {
  --bg: #0a0805;
  --bg2: #171207;
  --cream: #f6efe3;
  --gold: #f2c14e;
  --gold-hi: #ffd97a;
  --mut: #a99e8a;
  --disp: 'Anton', 'Arial Narrow', sans-serif;
  --body: 'Jost', 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html.conductor { scroll-behavior: auto; }

body {
  background: var(--bg);
  color: var(--cream);
  font-family: var(--body);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.75;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #0a0805; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

/* ---------- skip + plain toggle ---------- */
.skip-link, .plain-toggle {
  position: fixed; top: 10px; z-index: 200;
  font-family: var(--body); font-weight: 600; font-size: 13px;
  padding: 10px 16px; text-decoration: none;
}
.skip-link { left: 16px; transform: translateY(-300%); background: var(--cream); color: #0a0805; }
.skip-link:focus-visible { transform: none; }
.plain-toggle { left: 50%; transform: translate(-50%, -300%); background: var(--gold); color: #0a0805; }
.plain-toggle:focus-visible { transform: translate(-50%, 0); }
html:not(.conductor) .plain-toggle {
  position: static; transform: none; display: inline-block;
  margin: 16px 24px 0; background: transparent; color: var(--gold);
  border: 1px solid var(--gold);
}

/* ---------- loader: pat filling with cream ---------- */
#loader {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
}
.conductor #loader { display: flex; }
#loader.done { opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s .6s; }
.loader-pat { width: 150px; }
.pat-outline { fill: none; stroke: var(--gold); stroke-width: 2; }
.pat-fill { fill: var(--gold); }
.pat-wave { fill: var(--gold-hi); }
.loader-pct {
  font-family: var(--disp); font-size: 64px; line-height: 1; color: var(--cream);
  font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 4px;
}
.loader-pct i { font-style: normal; font-size: 22px; color: var(--mut); }
.loader-status { font-size: 13px; letter-spacing: .3em; text-transform: uppercase; color: var(--mut); }
.loader-brand {
  position: absolute; bottom: 5vmin; font-weight: 600; font-size: 14px;
  letter-spacing: .5em; color: var(--mut);
}

/* ---------- canvas ---------- */
#gl { display: none; }
.conductor #gl { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
/* photographic vignette over the canvas */
.conductor body::before { content: none; }
#vignette { display: none; }
.conductor #vignette {
  content: ''; display: block; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(5,3,1,.52) 100%);
}
/* dark scrim behind chapter copy so text never fights the scene */
.conductor .panel-origin::before, .conductor .panel-lab::before, .conductor .panel-toast::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(8,6,3,.78) 0%, rgba(8,6,3,.5) 34%, transparent 62%);
}
.chapter-copy { position: relative; }

/* ---------- chrome ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
}
.mark {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 600; font-size: 15px; letter-spacing: .4em;
  padding: 9px 0; min-height: 40px;
}
.mark-glyph {
  width: 22px; height: 14px; border-radius: 3px; background: var(--gold); display: inline-block;
}
.cta-top {
  font-weight: 600; font-size: 13px; letter-spacing: .18em; text-decoration: none;
  color: var(--gold); padding: 10px 4px; white-space: nowrap;
}
.cta-top:hover { background: var(--gold); color: #0a0805; }

/* right-edge chapter rail (the corn-site shape, mirrored genre trope) */
.rail {
  position: fixed; right: 26px; top: 50%; transform: translateY(-50%);
  z-index: 20; display: none; flex-direction: column; gap: 22px; align-items: flex-end;
}
.conductor .rail { display: flex; }
.rail a {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--mut); font-size: 11px; font-weight: 600; letter-spacing: .24em;
  padding: 4px 2px; min-height: 24px;
}
.rail a span { opacity: 0; transform: translateX(6px); transition: opacity .3s ease, transform .3s ease; }
.rail a:hover span, .rail a.active span { opacity: 1; transform: none; }
.rail a i {
  width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--mut); display: block;
  transition: background .3s ease, border-color .3s ease;
}
.rail a.active i { background: var(--gold); border-color: var(--gold); }
.rail a.active { color: var(--gold); }

/* lab panel */
.lab-panel {
  position: fixed; left: 26px; bottom: 22px; z-index: 20;
  display: none; align-items: center; gap: 18px;
  font-size: 11px; font-weight: 600; letter-spacing: .2em; color: var(--mut);
  border: 1px solid rgba(169,158,138,.35); padding: 10px 16px;
  background: rgba(10,8,5,.6); backdrop-filter: blur(4px);
}
.conductor .lab-panel { display: flex; }
.lab-title { color: var(--gold); }
.lab-panel label { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 24px; }
.lab-panel input[type=range] { width: 90px; height: 24px; accent-color: var(--gold); }
.lab-panel input[type=checkbox] { accent-color: var(--gold); width: 15px; height: 15px; }
.lab-panel output { font-variant-numeric: tabular-nums; min-width: 34px; }
@media (pointer: coarse), (max-width: 760px) {
  .lab-panel input[type=checkbox] { width: 24px; height: 24px; }
  .lab-panel label { min-height: 32px; }
}

/* ---------- spacer + panels ---------- */
.spacer { display: none; }
.conductor .spacer { display: block; height: 1000vh; }

.panel {
  position: relative; min-height: 100vh;
  padding: 120px 28px 80px; max-width: 1040px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center;
}
.conductor .panel {
  position: fixed; inset: 0; max-width: none;
  padding: 100px clamp(64px, 9vw, 160px);
  opacity: 0; visibility: hidden; z-index: 2; will-change: opacity;
}
@media (min-width: 761px) {
  .conductor .panel { padding-right: clamp(140px, 14vw, 240px); } /* clear the right rail */
}

/* hero */
.panel-hero { align-items: center; text-align: center; justify-content: center; }
.hero-title {
  font-family: var(--disp); font-weight: 400;
  font-size: clamp(58px, 11.5vw, 168px); line-height: .96; letter-spacing: .015em;
  text-shadow: 0 2px 60px rgba(0,0,0,.55);
}
.hero-sub { margin-top: 30px; font-size: 17px; font-weight: 300; color: var(--cream); }
.scroll-hint {
  display: none; position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%);
  font-size: 11px; font-weight: 600; letter-spacing: .34em; color: var(--mut);
}
.conductor .scroll-hint { display: block; }

/* chapters */
.chapter-copy { max-width: 560px; }
.ch-title {
  font-family: var(--disp); font-weight: 400;
  font-size: clamp(44px, 6.5vw, 96px); line-height: 1.02; letter-spacing: .015em;
  margin-bottom: 26px;
}
.ch-title.outline {
  color: transparent; -webkit-text-stroke: 2px var(--cream);
}
.ch-title.outline em { font-style: normal; color: var(--cream); -webkit-text-stroke: 0; }
.chapter-copy p { max-width: 52ch; color: var(--cream); }
.result-line { margin-top: 14px; font-weight: 600; letter-spacing: .06em; color: var(--gold); }

.timeline { list-style: none; margin-top: 30px; display: grid; gap: 10px; }
.timeline li { font-size: 12px; font-weight: 600; letter-spacing: .22em; color: var(--mut); }
.timeline b { color: var(--gold); margin-right: 14px; font-weight: 600; }

.fig-label { margin-top: 30px; font-size: 10px; font-weight: 600; letter-spacing: .3em; color: var(--mut); }
.specs { margin-top: 34px; display: flex; gap: 44px; flex-wrap: wrap; }
.specs div { display: flex; flex-direction: column-reverse; }
.specs dd { font-family: var(--disp); font-weight: 400; font-size: 42px; color: var(--gold); margin: 0; }
.specs dt { font-size: 11px; font-weight: 600; letter-spacing: .26em; color: var(--mut); }

/* circular CTA (arc ring, genre trope) */
.ring-cta {
  margin-top: 44px; position: relative; width: 148px; height: 148px;
  background: none; border: 0; color: var(--cream); cursor: pointer;
  font-family: var(--body); font-weight: 600; font-size: 12px; letter-spacing: .2em;
}
.ring-cta svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(246,239,227,.55); stroke-width: 2; }
.ring-arc {
  fill: none; stroke: var(--gold); stroke-width: 2;
  stroke-dasharray: 289; stroke-dashoffset: 289;
  transition: stroke-dashoffset 1.1s cubic-bezier(.5,0,.2,1);
}
.ring-cta:hover .ring-arc, .ring-cta:focus-visible .ring-arc, .ring-cta.fired .ring-arc { stroke-dashoffset: 0; }
.ring-cta span { position: relative; }

/* join */
.panel-join { align-items: center; text-align: center; }
.join-title {
  font-family: var(--disp); font-weight: 400;
  font-size: clamp(56px, 10vw, 150px); line-height: .96;
}
.join-line { margin-top: 26px; font-size: 16px; }
.site-foot { margin-top: 56px; color: var(--mut); font-size: 13px; max-width: 60ch; }
.conductor .site-foot { position: absolute; left: clamp(64px, 9vw, 160px); bottom: 4.5vh; margin: 0; text-align: left; max-width: 54ch; }
.site-foot a { color: var(--cream); }
.foot-legal { letter-spacing: .2em; font-size: 10px; margin-top: 10px; }

/* reticle */
#reticle { display: none; }
@media (pointer: fine) {
  .conductor #reticle {
    display: block; position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none;
    width: 30px; height: 30px; margin: -15px 0 0 -15px;
    border: 1px solid rgba(242,193,78,.6); border-radius: 50%;
    transition: border-color .3s ease;
  }
  .conductor #reticle i {
    position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
    margin: -1.5px 0 0 -1.5px; background: var(--gold); display: block; border-radius: 50%;
  }
  .conductor #reticle.hot { border-color: var(--gold-hi); }
}

/* plain-mode niceties */
html:not(.conductor) .panel { border-bottom: 1px solid rgba(169,158,138,.16); }
/* stroke-only type is fragile outside the show (forced colors, old engines):
   the plain document gets solid headings */
html:not(.conductor) .ch-title.outline { color: var(--cream); -webkit-text-stroke: 0; }
html:not(.conductor) .hud-top { position: static; padding: 24px 28px; }
html:not(.conductor) .panel-hero, html:not(.conductor) .panel-join { text-align: left; align-items: flex-start; }

/* responsive */
@media (max-width: 760px) {
  .rail { display: none !important; }
  .conductor .panel { padding: 90px 24px; }
  .conductor .site-foot { left: 24px; right: 24px; }
  .lab-panel { left: 22px; bottom: 16px; gap: 12px; }
  .lab-panel label.lab-temp { display: none; }
  .specs { gap: 28px; }
  .scroll-hint { bottom: 12vh; }
  .mark { letter-spacing: .22em; font-size: 13px; }
  .cta-top { font-size: 12px; letter-spacing: .1em; }
  .plain-toggle { left: auto; right: 16px; transform: translateY(-300%); }
  .plain-toggle:focus-visible { transform: translateY(0); }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
