/**
 * Sacred Ruins — trail layer on top of the kit.
 *
 * One bespoke set-piece: the Rose Window (#rose), a pinned full-viewport
 * scene between Chapter III and the tally. The window itself is generated
 * as SVG by sacred-ruins.js; this file owns the stage: the nave, the floor
 * light-spill, the ledger and the counter. All scroll choreography lives in
 * the JS — nothing here animates on its own except the ledger fade, which
 * is class-toggled.
 */

/* ── the pinned wrapper ────────────────────────────────────────────────────
   A kit .scene is min-height:100vh flex with gutters; the rose needs the
   full 320vh pin with an inner sticky stage, so the base rules are reset
   rather than extended. */
.scene.rose {
  display: block;
  min-height: 0;
  height: 320vh;
  padding: 0;
  overflow: visible;
}

.rose-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: #0b0910;
}

/* ── the nave ──────────────────────────────────────────────────────────────
   Near-black interior: a cool vault overhead, a warmer floor below, and two
   faint column shadows either side of the window so it reads as hanging in
   a church rather than floating on a web page. Gradient-only, no imagery. */
.rose-nave {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 46% at 50% 34%, rgba(192, 138, 76, 0.055), transparent 70%),
    linear-gradient(90deg,
      transparent 0,
      rgba(0, 0, 0, 0.42) 6vw, transparent 7.5vw,
      transparent calc(100% - 7.5vw),
      rgba(0, 0, 0, 0.42) calc(100% - 6vw), transparent 100%),
    linear-gradient(180deg, #07060a 0%, #0b0910 38%, #12100e 78%, #161310 100%);
}

/* ── the window ────────────────────────────────────────────────────────────
   Sized off the viewport height so the ledger always has room beneath it;
   the SVG fills its box and stays centered. */
.rose-window {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(66vh, 92vw);
  aspect-ratio: 1;
}

.rose-window svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Pane states are driven from JS via the --lit custom property on each
   pane group: .core is the glass itself, .halo the bloom behind it. The
   unlit "sheen" is baked into the base fill, so --lit:0 still reads as
   dark glass rather than a hole. */
.rose-window .halo {
  opacity: calc(var(--lit, 0) * 0.28);
}

.rose-window .core {
  opacity: var(--lit, 0);
}

/* ── the floor spill ───────────────────────────────────────────────────────
   Colored light thrown on the floor beneath the window. Hue and saturation
   are rewritten by JS on pane events; opacity tracks the count alight. The
   blur is a single static filter on one layer — cheap. */
.rose-floor {
  position: absolute;
  left: 50%;
  bottom: -6vh;
  width: 120vmin;
  height: 34vh;
  transform: translateX(-50%);
  background: radial-gradient(50% 62% at 50% 30%, rgba(192, 138, 76, 0.5), transparent 70%);
  filter: blur(28px) saturate(var(--floor-sat, 1));
  opacity: 0;
  pointer-events: none;
}

/* ── the ledger ────────────────────────────────────────────────────────────
   Mono-type entries at the lower left: one line per named pane event, with
   an optional sub-line for the second beat ("the church followed in 2007").
   JS swaps text and toggles .show. */
.rose-ledger {
  position: absolute;
  left: 8vw;
  bottom: 9vh;
  max-width: 44ch;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.rose-ledger .rl-line,
.rose-ledger .rl-sub {
  display: block;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.rose-ledger.show .rl-line,
.rose-ledger.show .rl-sub {
  opacity: 1;
  transform: translateY(0);
}

.rose-ledger .rl-line {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
}

.rose-ledger .rl-line em {
  font-style: normal;
  color: var(--sodium);
}

.rose-ledger .rl-sub {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition-delay: 0.35s;
}

/* ── the counter ─────────────────────────────────────────────────────────── */
.rose-count {
  position: absolute;
  right: 8vw;
  bottom: 9vh;
  display: flex;
  align-items: baseline;
  gap: 10px;
  pointer-events: none;
}

.rose-count b {
  font: 700 26px/1 "Space Mono", monospace;
  color: var(--sodium);
  min-width: 2ch;
  text-align: right;
  text-shadow: 0 0 18px rgba(192, 138, 76, 0.35);
}

.rose-count span {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .scene.rose {
    height: 300vh;
    padding: 0;
  }

  .rose-window {
    top: 40%;
    width: min(58vh, 94vw);
  }

  /* Ledger and counter stack along the bottom edge; the mute pill sits at
     bottom-left on the kit, so the ledger moves right of it and shrinks. */
  .rose-ledger {
    left: 22px;
    right: 22px;
    bottom: 12vh;
    max-width: none;
  }

  .rose-ledger .rl-line {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .rose-ledger .rl-sub {
    font-size: 9px;
  }

  .rose-count {
    right: 22px;
    bottom: 6.5vh;
  }

  .rose-count b {
    font-size: 20px;
  }
}
