/* Every Scenario: page-specific layout on top of the house style (style.css). Square corners, hairlines, one accent. */

/* ---------- Stage: the music video + the footage-only track stacked on it ---------- */
.stage { background: #000; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage .foot { display: none; pointer-events: none; } /* only composited while peeling: a hidden second video over the first can blank it in Chromium */
.stage[data-view='footage'] .foot { display: block; }
.stage-top { z-index: 3; }
.stage-play { z-index: 3; }
.stage.started .stage-play { display: none; }
.stage-tools .tool .x { display: none; }
.tool[aria-pressed='true'] .x { display: inline; }
.tool[aria-pressed='true'] .wave { display: none; }
#peel { touch-action: none; user-select: none; -webkit-user-select: none; }

.code-only {
  position: absolute; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%);
  display: grid; gap: 6px; max-width: min(420px, 80%); margin: 0; padding: 14px 18px;
  border: 1px solid var(--glass-line); border-radius: 4px; background: var(--glass); backdrop-filter: blur(10px);
  font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center;
}
.code-only b { font: 500 11px / 1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.stage-wrap { align-self: start; }
.stage-box { position: relative; }

/* Timeline: one band per section, a progress fill, a native range on top for access */
.timeline { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; margin-top: 10px; }
.timeline input[type='range'] { grid-column: 1; grid-row: 1; width: 100%; height: 28px; margin: 0; appearance: none; background: transparent; cursor: pointer; position: relative; z-index: 2; }
.timeline input[type='range']::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.timeline input[type='range']::-moz-range-track { height: 28px; background: transparent; }
.timeline input[type='range']::-webkit-slider-thumb { appearance: none; width: 2px; height: 28px; background: var(--accent); border: 0; }
.timeline input[type='range']::-moz-range-thumb { width: 2px; height: 28px; background: var(--accent); border: 0; border-radius: 0; }
.tl-sections, .tl-progress { grid-column: 1; grid-row: 1; position: relative; height: 6px; align-self: center; }
.tl-sections i { position: absolute; top: 0; height: 6px; border-left: 1px solid var(--bg); background: var(--rule); }
.tl-progress { justify-self: start; width: 0; background: var(--accent); pointer-events: none; z-index: 1; }
.tl-time { font: 11px / 1 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* ---------- Rail + "on screen now" card ---------- */
#rail .rail-item { padding: 12px 0; }
#rail .rail-item strong { margin-bottom: 4px; }
#rail .rail-item .thumb { flex: none; margin-left: auto; width: 80px; height: 45px; overflow: hidden; border: 1px solid var(--rule); background: #000; opacity: 0.7; transition: opacity 0.2s, border-color 0.2s; }
#rail .rail-item .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
#rail .rail-item:hover .thumb, #rail .rail-item.selected .thumb { opacity: 1; }
#rail .rail-item.selected .thumb { border-color: var(--accent); }
.now {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 0.8fr); grid-template-areas: 'count count count' 'media text lyric';
  gap: 0 20px; margin-top: 14px; align-items: start;
}
.now .count { grid-area: count; display: flex; gap: 18px; margin: 0 0 12px; }
.now .count span:first-child { margin-right: auto; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.now h3 { font-size: 28px; }
.now-media { grid-area: media; aspect-ratio: 16 / 9; border: 1px solid var(--rule); background: #000; overflow: hidden; }
.now-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.now-text { grid-area: text; min-width: 0; }
.now.empty .now-media img { visibility: hidden; }
.now-model { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 10px; }
.now-model span { padding: 4px 7px; border: 1px solid var(--rule); font-size: 10px; color: var(--ink); }
.now-model span:first-child { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.now-prompt { margin: 0; font-size: 12px; line-height: 1.55; }
.now-lyric { grid-area: lyric; min-height: 1.5em; margin: 0; padding-left: 20px; border-left: 1px solid var(--rule); font: 400 22px / 1.2 'Instrument Serif', serif; color: var(--muted); }
.now-lyric.on { color: var(--ink); }
.now-lyric::before { content: 'Sung now'; display: block; margin-bottom: 8px; font: 10px / 1 'Instrument Sans', sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

/* ---------- Sections below the stage ---------- */
.layers, .ledger { margin-top: 96px; padding-top: 34px; border-top: 1px solid var(--rule); }
.layers h2, .ledger h2 { margin: 0; font: 400 clamp(40px, 4.4vw, 64px) / 0.95 'Instrument Serif', serif; letter-spacing: -0.025em; }
.ledger h2 em { font-style: normal; color: var(--muted); }
.lede { max-width: 62ch; margin: 16px 0 0; font-size: 14px; line-height: 1.65; color: var(--muted); }

.layers { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 48px; align-items: start; }
.layers > .layer-list { margin-top: 6px; }
.layer-list { list-style: none; margin: 28px 0 0; padding: 0; }
.layer-list li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid var(--rule); }
.layer-list li:last-child { border-bottom: 1px solid var(--rule); }
.layer-list li > span { font: 400 26px / 1 'Instrument Serif', serif; color: var(--accent); }
.layer-list strong { display: block; font-size: 13px; font-weight: 600; }
.layer-list small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.layers-pair { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.layers-pair > div { position: relative; }
.layers-pair img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); }
.layers-pair figcaption { margin-top: 6px; font-size: 11px; color: var(--muted); }
.layers-pair figcaption b { margin-right: 8px; font-weight: 600; color: var(--accent); }

.ledger-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; }
.ledger-grid { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 32px 0 0; padding: 0; }
.clip { display: flex; flex-direction: column; border: 1px solid var(--rule); background: var(--panel); }
.clip-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; background: #000; }
.clip-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.clip-thumb span { position: absolute; left: 8px; bottom: 8px; padding: 4px 6px; border: 1px solid var(--glass-line); border-radius: 4px; background: var(--glass); font: 11px / 1 var(--mono); color: var(--ink); }
.clip-thumb:hover span { color: var(--accent); border-color: var(--accent); }
.clip-body { padding: 12px 14px 14px; }
.clip-n { display: flex; justify-content: space-between; margin: 0 0 8px; font-size: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
.clip-n span { color: var(--accent); }
.clip h3 { margin: 0; font: 400 22px / 1 'Instrument Serif', serif; }
.clip-cap { margin: 5px 0 0; font-size: 11px; color: var(--muted); }
.clip details { margin-top: 10px; }
.clip summary { cursor: pointer; width: max-content; font-size: 11px; color: var(--ink); border-bottom: 1px dotted var(--accent); }
.clip summary:hover { color: var(--accent); }
.clip .prompt-excerpt { font-size: 11px; }
.source-note { margin: 16px 0 0; font-size: 11px; color: var(--muted); }

.opening > div:first-child { flex: none; }
.opening .intro { max-width: 620px; }
.intro kbd { margin: 0 2px; border-color: var(--rule); color: var(--ink); }
.how-film-pending { display: grid; place-items: center; min-height: 140px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: 14px; text-align: center; padding: 24px; }

@media (max-width: 1100px) {
  #rail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }
  #rail .rail-item:nth-last-child(2) { border-bottom: 1px solid var(--rule); }
  .ledger-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  #rail { display: block; }
  .action-row > .action:first-child { grid-column: 1 / -1; }
  .now { grid-template-columns: minmax(0, 140px) minmax(0, 1fr); grid-template-areas: 'count count' 'media text' 'lyric lyric'; gap: 0 14px; }
  .now-lyric { margin-top: 14px; padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--rule); font-size: 19px; }
  .now .count span:last-child { display: none; }
  .layers, .ledger-head { grid-template-columns: 1fr; gap: 24px; }
  .layers-pair { grid-template-columns: 1fr; }
  .ledger-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-top .shortcut-row #playkey { display: none; }
  .layers, .ledger { margin-top: 64px; }
}
@media (max-width: 480px) {
  .ledger-grid { grid-template-columns: 1fr; }
  .glass-select select { min-width: 108px; }
  .code-only { font-size: 11px; padding: 10px 12px; }
}

/* Glossary tips: hidden tips take no space; on narrow screens they dock to the bottom of the viewport */
.term-tip { visibility: hidden; }
.term:hover .term-tip, .term:focus-visible .term-tip, .term[aria-expanded='true'] .term-tip { visibility: visible; }
@media (max-width: 1100px), (max-height: 500px) {
  .term-tip { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; z-index: 60; font-size: 12px; }
}

/* Shared footer row: the exploration runtime mounts its gallery and cookie links here, in normal flow */
.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; max-width: 1600px; margin: 0 auto; padding: 22px 4.2% 28px;
  border-top: 1px solid var(--rule); font-size: 12px; color: var(--muted);
}
.site-foot .foot-id { margin-right: auto; }
.site-foot .foot-link { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.site-foot .foot-link:hover { color: var(--accent); border-color: var(--accent); }

/* Intermediary asset downloads */
.assets { margin-top: 96px; padding-top: 34px; border-top: 1px solid var(--rule); margin-bottom: 56px; }
.assets h2 { margin: 0; font: 400 clamp(40px, 4.4vw, 64px) / 0.95 'Instrument Serif', serif; letter-spacing: -0.025em; }
.assets-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 32px; }
.assets-grid .action { justify-content: flex-start; min-height: 72px; padding: 14px 16px; }
@media (max-width: 1100px) { .assets-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .assets-grid .action .icon { display: block; } }
@media (max-width: 800px) { .assets { margin-top: 64px; } }
@media (max-width: 480px) { .assets-grid { grid-template-columns: 1fr; } }
