/* ================================================================
   Rediscover Ainu — the scroll build. Page classes only; the
   engine (assets/scrollcraft/) owns .sc-stage, .sc-copy and every
   [data-sc-*] mechanism. Rebrand lives in the token block below;
   everything else derives from it.
   ================================================================ */

:root {
  --sc-canvas: #0A0806;
  --sc-surface: #14100B;
  --sc-ink: #F5EBDD;
  --sc-ink-soft: #A69A87;
  --sc-accent: #C9A227;
  --sc-accent-ink: #14100B;
  --sc-font-display: "Instrument Serif", Georgia, serif;
  --sc-font-text: "Instrument Sans", system-ui, sans-serif;
}

/* --- chrome ----------------------------------------------------- */

/* kickers live on near-black: the engine's ink-soft floor reads dim there */
.sc-label { color: color-mix(in oklab, var(--sc-ink) 72%, var(--sc-canvas)); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: calc(var(--sc-z-chrome) + 1);
  background: var(--sc-canvas);
  color: var(--sc-ink);
  padding: 0.7rem 1.1rem;
}
.skip:focus-visible { left: 0; }

.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--sc-z-chrome);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem var(--sc-gutter);
  background: color-mix(in oklab, var(--sc-canvas) 82%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--sc-hairline);
}
.bar__mark {
  font-family: var(--sc-font-display);
  font-size: 1.15rem;
  color: var(--sc-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}
.bar__mark::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  background: var(--sc-accent);
  flex: none;
}
.bar__lang { display: flex; gap: 0.15rem; }
.lang-btn {
  appearance: none;
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--sc-t-xs);
  letter-spacing: var(--sc-track-wide);
  color: var(--sc-ink-soft);
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}
.lang-btn[aria-pressed="true"] {
  color: var(--sc-ink);
  box-shadow: inset 0 -2px 0 var(--sc-accent);
}
.lang-btn:hover { color: var(--sc-ink); }
.bar__cta {
  font-size: var(--sc-t-sm);
  letter-spacing: var(--sc-track-snug);
  color: var(--sc-accent);
  text-decoration: none;
  border: 1px solid color-mix(in oklab, var(--sc-accent) 45%, transparent);
  padding: 0.5rem 0.95rem;
  border-radius: 2px;
  white-space: nowrap;
  transition: background var(--sc-d-fast) var(--sc-ease-out), color var(--sc-d-fast) var(--sc-ease-out);
}
.bar__cta:hover { background: var(--sc-accent); color: var(--sc-accent-ink); }

/* --- viewer frames ----------------------------------------------
   A frame holds the poster <img> (the honest state while the model
   loads, and the state it stays in if WebGL is unavailable) and a
   <canvas> the model paints into. The poster sits over the canvas
   until page.js proves the model drew. */

.view__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}
.view__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y; /* horizontal drag turns the model; vertical scrolls the page */
  z-index: 1;
}

/* ground shadow under every standing viewer */
.hero-viewer::after,
.cast-viewer::after,
.close-viewer::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -6.5%;
  height: 9%;
  background: radial-gradient(50% 100% at 50% 0%, rgba(0, 0, 0, 0.55), transparent 72%);
  pointer-events: none;
}

/* --- 1 · hero ----------------------------------------------------- */

.hero-photo {
  position: absolute;
  inset: -16% 0;
  overflow: hidden;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
  filter: saturate(0.82) brightness(0.72);
}
.hero-lamp {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(46rem 34rem at 66% 42%, color-mix(in oklab, #3A2A15 52%, transparent), transparent 70%);
}
.hero-viewer {
  position: absolute;
  top: 50%;
  right: 7vw;
  translate: 0 -50%;
  width: min(36vw, 30rem);
  aspect-ratio: 4 / 5;
}
.hero-lede { max-width: 33rem; }
.hero-copy .sc-label { color: var(--sc-ink); } /* small caps over the photo: needs the full ink */
/* the two trailing lines sit over the busy photo: ink-soft reads as a
   stuck fade there, so give them a solid mid tone (still below the lede) */
.hero-copy .sc-body { color: color-mix(in oklab, var(--sc-ink) 76%, var(--sc-canvas)); }

/* short landscape viewports (presentation displays): cap the cabinet by
   height so its base never crops at the viewport bottom */
@media (min-width: 861px) and (max-height: 760px) {
  .hero-viewer { width: min(30vw, 56svh); }
}

/* --- 2 · the question --------------------------------------------- */

.question-wrap {
  padding-block: clamp(9rem, 24vh, 17rem); /* the authored silence */
}
.q-line { max-width: 36rem; }
.q-note {
  margin-top: 1.4rem;
  color: var(--sc-ink-soft);
  font-variant-numeric: tabular-nums;
}

/* --- 3 · the carve ------------------------------------------------- */

.carve-panel {
  position: absolute;
  top: 50%;
  right: calc(var(--sc-gutter) + 8.5rem);
  translate: 0 -50%;
  height: min(74svh, 46rem);
  aspect-ratio: 3 / 4;
  background: #100D0A;
  box-shadow:
    0 3.5rem 6rem -1.5rem rgba(0, 0, 0, 0.62),
    0 0 0 1px var(--sc-hairline-strong);
}
.carve-copy { max-width: 30rem; }
.peak-line {
  margin-top: 0.6rem;
  color: var(--sc-accent);
  font-style: italic;
}

/* the depth gauge — the signature move's trace */
.gauge {
  position: absolute;
  top: 50%;
  right: var(--sc-gutter);
  translate: 0 -50%;
  height: min(74svh, 46rem);
  display: flex;
  gap: 1.1rem;
}
.gauge__track {
  position: relative;
  width: 2px;
  background: var(--sc-hairline-strong); /* the hairline default vanished on the dark ground */
}
.gauge__fill {
  position: absolute;
  inset: 0;
  background: var(--sc-accent);
  transform-origin: top;
  transform: scaleY(var(--sc-p, 0));
}
.gauge__marks { position: relative; width: 7rem; }
.gauge__mark {
  position: absolute;
  left: 0;
  translate: 0 -50%;
  white-space: nowrap;
  font-size: var(--sc-t-xs);
  letter-spacing: var(--sc-track-wide);
  text-transform: uppercase;
  color: var(--sc-ink-soft);
}
.gauge__stamp {
  position: absolute;
  bottom: -2.5rem;
  left: 0;
  white-space: nowrap;
  font-size: var(--sc-t-xs);
  letter-spacing: var(--sc-track-wide);
  text-transform: uppercase;
  color: var(--sc-accent);
}

/* --- shared flow plumbing ------------------------------------------ */

.split {
  display: grid;
  grid-template-columns: minmax(0, 46rem) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}

/* --- 4 · the table -------------------------------------------------- */

.table-fig {
  margin: 0;
  justify-self: center;
  aspect-ratio: 3 / 4;
  max-height: 76svh;
  width: auto;
}
.table-fig img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rows {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  border-bottom: 1px solid var(--sc-hairline);
}
.rows li { border-top: 1px solid var(--sc-hairline); }
/* spec rows: label left, value right, real air between them — inline spans
   ran together as "Height0.8 m" and pinched the hairlines. */
.rows > li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.6rem 0;
}
.rows--cast > li { padding: 0; } /* the cast buttons carry their own padding */
.rows__name {
  flex: none;
  font-family: var(--sc-font-display);
  font-size: var(--sc-t-base);
  color: var(--sc-ink);
}
.rows__value {
  flex: 1 1 auto;
  font-size: var(--sc-t-sm);
  color: var(--sc-ink-soft);
  text-align: right;
}

/* --- 5 · the screens ------------------------------------------------- */

.rail {
  align-items: center;
  gap: var(--sc-5);
  padding-inline: var(--sc-gutter);
  height: 100%;
}
.rail-lead { flex: none; width: 24rem; }
.screen { flex: none; width: clamp(20rem, 38vw, 38rem); }
.screen__media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}
.screen__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.screen h3 {
  font-family: var(--sc-font-display);
  font-weight: 400;
  font-size: var(--sc-t-lg);
  margin-top: 1.1rem;
}
.screen p {
  font-size: var(--sc-t-sm);
  color: var(--sc-ink-soft);
  max-width: 30rem;
}

/* --- 6 · the cast ----------------------------------------------------- */

.cast-viewer {
  position: relative;
  width: min(100%, 26rem);
  aspect-ratio: 4 / 5;
  justify-self: center;
}
.cast-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  width: 100%;
  padding: 0.85rem 0.35rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--sc-d-fast) var(--sc-ease-out);
}
.cast-row:hover { background: color-mix(in oklab, var(--sc-ink) 5%, transparent); }
.cast-row[aria-pressed="true"] .rows__name { color: var(--sc-accent); }

/* --- 7 · the close ----------------------------------------------------- */

.close-viewer {
  position: absolute;
  top: 50%;
  right: 10vw;
  translate: 0 -50%;
  width: min(30vw, 26rem);
  aspect-ratio: 3 / 4;
}
.close-copy { bottom: 6.5rem; } /* clears the footer inside the stage */
.close-films {
  margin-top: 1.8rem;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.8rem var(--sc-4);
  justify-content: start;
  align-items: end;
}
.close-films .sc-label { grid-column: 1 / -1; margin: 0 0 0.35rem; } /* the label heads the row instead of bottom-aligning into the captions */
.close-film { margin: 0; width: clamp(8.5rem, 10.5vw, 10.5rem); }
.close-film video {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  background: #000;
  filter: brightness(0.94) contrast(1.06); /* the films are high-key cream; sit them into the dark ground */
  box-shadow: 0 1.8rem 3rem -1rem rgba(0, 0, 0, 0.55), 0 0 0 1px var(--sc-hairline-strong);
}
.close-film figcaption {
  margin-top: 0.6rem;
  font-size: var(--sc-t-xs);
  letter-spacing: var(--sc-track-wide);
  color: var(--sc-ink-soft);
  white-space: nowrap;
}
.cta-solid {
  display: inline-block;
  margin-top: 1.6rem;
  background: var(--sc-accent);
  color: var(--sc-accent-ink);
  font-family: var(--sc-font-display);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.95rem 1.5rem;
  border-radius: 2px;
  text-decoration: none;
}
.cta-solid:hover { filter: brightness(1.06); }
.close-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.1rem var(--sc-gutter);
  border-top: 1px solid var(--sc-hairline);
  font-size: var(--sc-t-xs);
  color: var(--sc-ink-soft);
}
.close-foot__mark {
  font-family: var(--sc-font-display);
  color: var(--sc-ink-soft);
}

/* --- mobile ------------------------------------------------------------- */

@media (max-width: 860px) {
  .bar__cta { display: none; } /* one CTA lives at the close */

  /* the cabinet clears the copy below it: size it by the space actually
     left between the header and the copy block, not by vw alone */
  .hero-viewer {
    top: 10svh;
    right: auto;
    left: 50%;
    translate: -50% 0;
    width: min(62vw, 16rem, calc((100svh - 33rem) / 1.25));
  }
  .hero-copy { bottom: 3rem; } /* the viewer needs the room the 12vh lead offset was taking */
  .hero-h { font-size: var(--sc-t-2xl); }

  .carve-panel {
    top: 8svh;
    right: auto;
    left: 50%;
    translate: -50% 0;
    height: auto;
    width: min(80vw, 52svh);
  }
  .gauge {
    top: 10svh;
    right: auto;
    left: 3.5vw;
    translate: 0 0;
    height: 46svh;
  }
  .gauge__marks { display: none; } /* the copy stanza carries the legend */
  .carve-copy { max-width: 86vw; }

  .split { grid-template-columns: 1fr; }
  .table-fig { max-height: none; width: 100%; }
  .cast-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.7rem 0.1rem;
  }
  .rows--cast .rows__value { text-align: left; }

  .rail { height: auto; align-items: stretch; padding-block: 14svh 8svh; }
  .rail-lead { width: 78vw; }
  .screen { width: 78vw; }

  .close-viewer {
    top: 10svh;
    right: auto;
    left: 50%;
    translate: -50% 0;
    width: min(52vw, 15rem);
  }
  .close-film { width: min(38vw, 10.5rem); }
  .close-copy { bottom: 6rem; } /* keeps the CTA off the footer's hairline */
  .close-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    padding-block: 0.9rem;
  }
}

/* --- reduced motion: gentle, nothing rearranged ------------------------- */

@media (prefers-reduced-motion: reduce) {
  .cta-solid,
  .bar__cta,
  .cast-row { transition: none; }
}
