/* Worlds · Sneak Peek. Rhythmic cutlist: hard grounds, no drift, no pinning.
   One accent hue (paint red) in two stops, keyed to the ground it sits on. */

:root {
  --sc-canvas:     #0B0908;
  --sc-surface:    #171210;
  --sc-ink:        #FFF3EC;
  --sc-ink-soft:   #B9A69C;
  --sc-accent:     #F0432E;   /* the dark-ground stop */
  --sc-accent-ink: #0B0908;
  --sc-font-display: "Fraunces", Georgia, serif;
  --sc-font-text:    "Barlow", system-ui, sans-serif;
  --sc-font-mono:    "Azeret Mono", ui-monospace, monospace;
  --sc-shadow-color: 14 40% 3%;
  --red: #C8281E;             /* the light-ground stop, used as a ground */
  --bar: 5.75rem;
}
@media (max-width: 860px) { :root { --bar: 5.1rem; } }

body { background: var(--sc-canvas); overflow-x: hidden; }
.sc-display { font-family: var(--sc-font-display); font-weight: 800; font-variation-settings: "SOFT" 0, "WONK" 1; }
::selection { background: var(--sc-accent); color: var(--sc-accent-ink); }

/* ── the bar. Loud, full width, and it is also the index of rooms ───────── */
.bar {
  position: fixed; inset: 0 0 auto; z-index: var(--sc-z-chrome);
  background: var(--sc-canvas);
  border-bottom: 2px solid var(--sc-accent);
}
.bar__top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sc-4);
  padding: var(--sc-3) var(--sc-gutter);
}
.bar__mark {
  font-family: var(--sc-font-display); font-weight: 900; font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  letter-spacing: var(--sc-track-tight); color: var(--sc-ink); text-decoration: none; line-height: 1;
}
.bar__mark span { color: var(--sc-accent); }
.bar__cta {
  font-family: var(--sc-font-display); font-weight: 800;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem); line-height: 1;
  letter-spacing: var(--sc-track-snug); white-space: nowrap;
  color: var(--sc-accent-ink); background: var(--sc-accent); text-decoration: none;
  padding: 0.42em 0.72em; border-radius: var(--sc-r-sm);
  transition: transform var(--sc-d-fast) var(--sc-ease-out), filter var(--sc-d-fast) var(--sc-ease-out);
}
.bar__idx { display: flex; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--sc-hairline); }
.bar__idx::-webkit-scrollbar { display: none; }
.bar__idx a {
  flex: 1 0 auto; display: flex; align-items: baseline; gap: 0.45em;
  padding: 0.62rem clamp(0.7rem, 1.9vw, 1.5rem);
  font-family: var(--sc-font-mono); font-size: var(--sc-t-xs); font-weight: 600;
  letter-spacing: var(--sc-track-wide); text-transform: uppercase;
  color: var(--sc-ink-soft); text-decoration: none; white-space: nowrap;
  border-right: 1px solid var(--sc-hairline);
  transition: color var(--sc-d-fast) var(--sc-ease-out), background var(--sc-d-fast) var(--sc-ease-out);
}
.bar__idx a:last-child { border-right: 0; }
.bar__idx b { font-weight: 400; color: color-mix(in oklab, var(--sc-ink-soft) 60%, transparent); font-variant-numeric: tabular-nums; }
.bar__idx a[data-on] { color: var(--sc-accent-ink); background: var(--sc-accent); }
.bar__idx a[data-on] b { color: color-mix(in oklab, var(--sc-accent-ink) 66%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .bar__idx a:hover { color: var(--sc-ink); background: var(--sc-surface); }
  .bar__cta:hover { filter: brightness(1.08); transform: translateY(-1px); }
}
.bar__cta:active { transform: translateY(1px) scale(0.985); }
:where(a, button):focus-visible { outline: 3px solid var(--sc-accent); outline-offset: 3px; border-radius: 2px; }
.law :where(a):focus-visible, .comm :where(a):focus-visible { outline-color: var(--sc-ink); }

/* ── acts. Every ground is painted, never interpolated: a cut is not a fade ─ */
.act {
  position: relative; min-height: calc(var(--span) * 100svh);
  background: var(--ground); overflow: hidden;
  display: flex; align-items: center;
}
.act:first-of-type { padding-top: var(--bar); }

/* ── 1 · hero ───────────────────────────────────────────────────────────── */
.hero { flex-direction: column; justify-content: center; gap: clamp(1.5rem, 4vh, 3rem);
        padding-inline: var(--sc-gutter); }
.hero__in { align-self: flex-start; width: 100%; max-width: min(100%, 60rem); }
.hero__h {
  font-size: clamp(2.6rem, 8.4vw, 7rem); line-height: 0.92;
  letter-spacing: var(--sc-track-tight); margin: 0; color: var(--sc-ink);
  max-width: 15ch; text-wrap: balance;
}
.hero__p { margin: var(--sc-4) 0 0; font-size: var(--sc-t-lg); color: var(--sc-ink-soft);
           max-width: 46ch; line-height: 1.5; }
.hero__strip {
  list-style: none; margin: 0; padding: 0; width: 100%;
  display: grid; grid-template-columns: repeat(7, 1fr); gap: clamp(0.25rem, 1vw, 1rem);
  border-top: 1px solid var(--sc-hairline); padding-top: var(--sc-4);
}
.hp { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; min-width: 0; }
.hp__box { display: block; width: 100%; aspect-ratio: 3 / 2; position: relative; overflow: hidden; }
.hp__box .pair { position: absolute; inset: 0; margin: auto; width: 86%; height: auto; }
.hp__l { font-family: var(--sc-font-mono); font-size: 0.58rem; font-weight: 600;
         letter-spacing: 0.09em; color: var(--sc-ink-soft); text-align: center;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
@media (max-width: 860px) {
  .hero__strip { grid-template-columns: repeat(4, 1fr); row-gap: 1.25rem; }
  .hp:nth-child(n+5) .hp__l { font-size: 0.55rem; }
}

/* ── 2 · the law, and 14 · commission. Red ground, ink restated. ────────── */
.law, .comm { --sc-ink: #FFF3EC; --sc-ink-soft: #FFF1E8; color: var(--sc-ink);
              padding: calc(var(--bar) + var(--sc-6)) var(--sc-gutter) var(--sc-7); }
.law__in, .comm__in { width: 100%; max-width: min(100%, 46rem); }
.comm__in { margin-left: auto; text-align: right; }
.comm__h { margin-left: auto; }
.law__h, .comm__h {
  font-size: clamp(2.1rem, 6.6vw, 5.4rem); line-height: 0.98; margin: 0;
  letter-spacing: var(--sc-track-tight); padding-bottom: 0.12em; max-width: 17ch;
}
.law__p, .comm__p { margin: var(--sc-5) 0 0; font-size: var(--sc-t-lg); color: var(--sc-ink-soft);
                    max-width: 40ch; line-height: 1.5; }
.comm__p { margin-left: auto; }

/* ── 3 + 8..13 · the rooms ──────────────────────────────────────────────── */
.rm { position: relative; scroll-margin-top: var(--bar); }
.rm__field { position: absolute; inset: 0; overflow: hidden; }
.rm__pairs { position: absolute; inset: 0; }
.pair {
  position: absolute; width: calc(var(--w, 12%) * var(--wmul, 1));
  height: auto; will-change: transform;
  transform:
    translate3d(var(--tx, 0px), var(--ty, 0px), 0)
    rotate(calc(var(--rot0, 0deg) + var(--rot, 0deg)))
    scale(var(--scx, 1), var(--scy, 1));
  opacity: var(--op, 1);
  filter: var(--fx, none);
}
/* the room's own effect layer: halftone for comics, letterbox for screen */
.rm__fx { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
[data-law="comics"] .rm__fx {
  background-image: radial-gradient(currentColor 34%, transparent 36%);
  background-size: 6px 6px; color: #F5F0E8;
  opacity: calc(var(--flash, 0) * 0.4); mix-blend-mode: overlay;
}
[data-law="screen"] .rm__fx {
  background: linear-gradient(180deg,
    #050403 0 var(--lb, 0%), transparent var(--lb, 0%),
    transparent calc(100% - var(--lb, 0%)), #050403 calc(100% - var(--lb, 0%)) 100%);
}
[data-law="sound"] .rm__fx { display: grid; place-items: center; }
.wave { width: 100%; height: 100%; position: absolute; inset: 0; opacity: 0.5; }
.wave path { fill: none; stroke: var(--sc-accent); stroke-width: 2; vector-effect: non-scaling-stroke; }

/* copy plates are SIBLINGS of the copy, never children: the contrast pass
   hides the copy and its pseudo-elements before photographing the frame. */
.rm__plate { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.rm__plate--lead  { background: linear-gradient(90deg, #040302fc 0%, #040302fa 38%, #040302f0 50%, #040302b3 60%, #0403021a 72%, transparent 80%); }
.rm__plate--trail { background: linear-gradient(270deg, #040302fc 0%, #040302fa 38%, #040302f0 50%, #040302b3 60%, #0403021a 72%, transparent 80%); }
.rm__plate--split { background: linear-gradient(180deg, transparent 0%, #040302b3 24%, #040302f7 46%, #040302fc 100%); }
@media (max-width: 860px) {
  /* The plate used to start closing at 26% and was near-solid by 48%, which is
     exactly the band the pairs live in on a phone: the field was being dimmed
     to protect copy that sits 200px lower. worlds.js now keeps every pair above
     the copy, so the ramp can start where the copy actually starts. */
  .rm__plate { background: linear-gradient(180deg, transparent 0%, #04030224 32%, #040302a6 54%, #040302f2 70%, #040302fb 100%) !important; }
}

.rm__copy {
  position: relative; z-index: 4; width: 100%;
  padding: var(--sc-7) var(--sc-gutter) var(--sc-6); max-width: 44rem;
}
.rm__copy--trail { margin-left: auto; text-align: right; }
.rm__copy--split { margin-inline: auto; }
.rm__h {
  font-size: clamp(2rem, 6vw, 4.6rem); line-height: 0.94; margin: 0;
  letter-spacing: var(--sc-track-tight); color: var(--sc-ink);
  padding-bottom: 0.1em;
}
.rm__n { margin: var(--sc-2) 0 0; font-family: var(--sc-font-mono); font-weight: 600;
         letter-spacing: var(--sc-track-wide); text-transform: uppercase;
         font-size: var(--sc-t-sm); color: var(--sc-accent); }
.num { font-variant-numeric: tabular-nums; font-size: 1.35em; }
.rm__nl { color: var(--sc-ink-soft); }
.rm__lede { margin: var(--sc-5) 0 0; font-size: var(--sc-t-base); line-height: 1.62;
            color: var(--sc-ink-soft); max-width: 44ch; }
.rm__copy--trail .rm__lede { margin-left: auto; }
.rm__copy--split .rm__lede { margin-inline: auto; }
.rm__link {
  display: inline-flex; margin-top: var(--sc-5);
  font-family: var(--sc-font-mono); font-size: var(--sc-t-xs); font-weight: 600;
  letter-spacing: var(--sc-track-wide); text-transform: uppercase;
  color: var(--sc-ink); text-decoration: underline; text-underline-offset: 5px;
  text-decoration-thickness: 2px; text-decoration-color: var(--sc-accent);
  padding: 0.5rem 0; min-height: 44px; align-items: center;
}
@media (hover: hover) and (pointer: fine) { .rm__link:hover { color: var(--sc-accent); } }

/* ── 4 · the authored silence ───────────────────────────────────────────── */
.hush { justify-content: center; padding: var(--bar) var(--sc-gutter) 0; }
.hush__l { margin: 0; font-family: var(--sc-font-mono); font-size: var(--sc-t-sm);
           letter-spacing: 0.14em; text-transform: uppercase; color: #93857C; text-align: center; }

/* ── 5,6,7 · the peak's three ground acts. The wall layer owns them. ────── */
.peak { min-height: calc(var(--span) * 100svh); }

/* ── THE WALL. Fixed chrome, driven by page scroll, outlives its acts. ──── */
.wall {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  visibility: hidden;
  contain: layout paint;
}
.wall[data-on] { visibility: visible; }
.wall__pic { position: absolute; inset: 0; display: block; }
.wall__pic img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(var(--wz, 1)); transform-origin: var(--wx, 68.18%) var(--wy, 50.85%);
  -webkit-mask-image: var(--wmask, none); mask-image: var(--wmask, none);
  clip-path: circle(var(--wr, 160%) at var(--wx, 68.18%) var(--wy, 50.85%));
}
@media (max-width: 860px) { .wall { --wx: 18.31%; --wy: 55.17%; } }
.wall__one {
  position: absolute; left: 50%; top: 52%; width: min(78vw, 46rem); height: auto;
  translate: -50% -50%; opacity: var(--wone, 0);
  transform: scale(calc(0.82 + var(--wone, 0) * 0.18));
}
.wall__plate { position: absolute; inset: auto 0 0; height: 62%; pointer-events: none;
  opacity: var(--wplate, 1);
  background: linear-gradient(180deg, transparent 0%, #04030299 30%, #040302f2 78%, #040302 100%); }
.wall__copy {
  position: absolute; inset: auto 0 0; padding: var(--sc-7) var(--sc-gutter) clamp(2rem, 7vh, 5rem);
  text-align: center; color: var(--sc-ink);
}
.wall__num {
  margin: 0; font-family: var(--sc-font-display); font-weight: 900;
  font-size: clamp(4.5rem, 21vw, 15rem); line-height: 0.8; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums; color: var(--sc-ink);
  opacity: var(--wc, 0);
}
.wall__lab {
  margin: var(--sc-4) 0 0; font-family: var(--sc-font-mono); font-size: var(--sc-t-xs);
  font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #E4CFC6;
  opacity: var(--wc, 0);
}
.wall__end {
  position: absolute; inset: auto 0 clamp(2rem, 7vh, 5rem); margin: 0;
  font-family: var(--sc-font-display); font-weight: 800;
  font-size: clamp(1.5rem, 4.6vw, 3rem); letter-spacing: var(--sc-track-tight);
  color: var(--sc-ink); opacity: var(--wend, 0);
}

/* ── 15 · close. Resolves and holds. ────────────────────────────────────── */
.close { flex-direction: column; justify-content: center;
         padding: calc(var(--bar) + var(--sc-7)) var(--sc-gutter) 0; }
.close__in { margin: auto 0; width: 100%; max-width: var(--sc-maxw); margin-inline: auto; }
.close__h { font-size: clamp(2.8rem, 9.6vw, 8rem); line-height: 0.9; margin: 0;
            letter-spacing: var(--sc-track-tight); color: var(--sc-ink); padding-bottom: 0.08em; }
.close__cta {
  display: inline-block; margin-top: var(--sc-6);
  font-family: var(--sc-font-display); font-weight: 800; font-size: clamp(1.2rem, 3.4vw, 2rem);
  line-height: 1; letter-spacing: var(--sc-track-snug);
  background: var(--sc-accent); color: var(--sc-accent-ink); text-decoration: none;
  padding: 0.62em 0.9em; border-radius: var(--sc-r-sm); white-space: nowrap;
  box-shadow: 0 10px 26px -12px hsl(var(--sc-shadow-color) / 0.9);
  transition: transform var(--sc-d-fast) var(--sc-ease-out), filter var(--sc-d-fast) var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .close__cta:hover { filter: brightness(1.08); transform: translateY(-2px); } }
.close__cta:active { transform: translateY(1px) scale(0.985); }
.close__p { margin: var(--sc-5) 0 0; color: var(--sc-ink-soft); font-size: var(--sc-t-base); }
.close__p a { color: var(--sc-ink); text-decoration-color: var(--sc-accent);
              text-underline-offset: 5px; text-decoration-thickness: 2px; }
.foot { width: 100%; max-width: var(--sc-maxw); margin-inline: auto;
        border-top: 1px solid var(--sc-hairline); padding: var(--sc-5) 0; }
.foot p { margin: 0; font-family: var(--sc-font-mono); font-size: var(--sc-t-xs);
          letter-spacing: 0.1em; text-transform: uppercase; color: #93857C; }

/* ── phones ─────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hero__h { font-size: clamp(2.3rem, 10.5vw, 3.4rem); }
  .rm__copy { max-width: none; text-align: left !important; }
  .rm__copy--trail, .rm__copy--split { margin-left: 0; }
  .rm__lede { margin-left: 0 !important; margin-right: 0 !important; }
  .comm__in { margin-left: 0; text-align: left; max-width: none; }
  .comm__p { margin-left: 0; }
  .act { align-items: flex-end; }
  .hero, .close, .hush, .law, .comm { align-items: center; }
  .rm__copy { padding-bottom: var(--sc-8); }
  /* Pairs are scaled up for the phone, but not by a flat multiplier: a room
     with six 35%-wide pairs and a room with sixteen 9%-wide ones cannot share
     one number, and 2.05 pushed the sparse rooms 100px past the screen edge.
     worlds.js fit() sets --wmul per pair from the room's real motion budget;
     this is only the pre-script value. */
  .rm__pairs { --wmul: 1; }
}

/* ── reduced motion: fewer and gentler, never fewer things ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .pair { transform: rotate(var(--rot0, 0deg)) !important; filter: none !important; opacity: 1 !important; }
  .wall__pic img { transform: none !important; clip-path: none !important;
                   -webkit-mask-image: none !important; mask-image: none !important; }
  .rm__fx { opacity: 0 !important; }
}
