/* Liora's end credits (/credits): builds on library.css (tokens, top bar, buttons, footer).
   Always the dark of a cinema, whatever theme the rest of the site is in. Without credits.js (or with reduced motion)
   it is simply a page to read; credits.js adds the marquee, the roll and the post-credits scene. */

body.credits-page {
    --bg: #070504;
    --bg-2: #120d08;
    --card: rgba(255, 232, 196, 0.045);
    --card-hover: rgba(255, 232, 196, 0.08);
    --line: rgba(255, 210, 150, 0.13);
    --line-strong: rgba(255, 210, 150, 0.26);
    --text: #f7ecdb;
    --muted: #b3a089;
    --gold: #ffb800;
    --gold-2: #ff8a1f;
    color-scheme: dark;
    background: var(--bg);
    color: var(--text);
}

/* ------------------------------------------------------------------ the credits as a page */
.cinema { max-width: 820px; margin: 0 auto; padding: 0 24px; }
.roll { text-align: center; padding: 10px 0 30px; }

.card { padding: 40px 0; }
.title-gem { display: block; margin: 0 auto 14px; filter: drop-shadow(0 14px 28px rgba(255, 160, 0, 0.35)); }
.title { margin: 0; font: 600 clamp(2.4rem, 7vw, 3.8rem)/1.05 var(--serif); letter-spacing: -0.01em; }
.title em { font-style: italic; color: var(--gold); }
.subtitle { margin: 10px 0 0; color: var(--muted); font: italic 400 1.15rem var(--serif); }

.block { margin: 0 auto; padding: 46px 0; max-width: 640px; }
.dept {
    margin: 0 0 10px; color: var(--gold);
    font: 600 0.78rem var(--sans); letter-spacing: 0.24em; text-transform: uppercase;
}
.dept-line { margin: -4px 0 18px; color: var(--muted); font: italic 400 0.98rem var(--serif); }
.name { display: block; margin: 0; font: 400 clamp(1.3rem, 3.6vw, 1.65rem)/1.3 var(--serif); overflow-wrap: anywhere; }
.name.big { font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 600; }
.name.waiting { color: var(--muted); font-style: italic; }
.as { margin: 4px 0 0; color: var(--muted); font: italic 400 1.05rem var(--serif); }

.pairs { margin: 6px 0 0; display: grid; gap: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: baseline; }
.pair dt {
    text-align: right; color: var(--muted);
    font: 500 0.86rem/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase;
}
.pair dd { margin: 0; text-align: left; font: 400 1.35rem/1.25 var(--serif); overflow-wrap: anywhere; }

.names { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.names li { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.for { color: var(--muted); font: 400 0.92rem/1.4 var(--sans); max-width: 34ch; }

.fine p { margin: 0; color: var(--muted); font: 400 0.95rem var(--sans); }
.fine .as { font-size: 0.9rem; }

.end-card { padding: 70px 0 40px; }
.will-return { margin: 0; font: italic 400 clamp(1.6rem, 4.6vw, 2.2rem) var(--serif); color: var(--gold); }

/* the post-credits scene */
.stinger {
    max-width: 640px; margin: 30px auto 0; padding: 28px 24px 30px;
    text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px;
}
.stinger-label { margin: 0 0 18px; color: var(--muted); font: 600 0.72rem var(--sans); letter-spacing: 0.24em; text-transform: uppercase; }
.stinger-scene { display: flex; gap: 18px; align-items: flex-end; justify-content: center; text-align: left; }
.stinger-gem { flex: none; width: 88px; height: 88px; filter: drop-shadow(0 12px 24px rgba(255, 160, 0, 0.35)); }
.bubble {
    position: relative; max-width: 420px; padding: 16px 18px;
    background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 18px 18px 18px 4px;
    font: 400 1.02rem/1.5 var(--sans);
}
.bubble .line { margin: 0 0 8px; min-height: 1.5em; }
.bubble .line:last-child { margin-bottom: 0; }
.bubble .typing::after { content: "▍"; color: var(--gold); animation: caret 0.9s steps(1) infinite; }
.stinger-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

.foot code { padding: 1px 6px; border-radius: 6px; background: var(--card-hover); color: var(--text); font-size: 0.85em; }

/* ------------------------------------------------------------------ the cinema (credits.js) */
.marquee { text-align: center; padding: 30px 0 10px; min-height: 66vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.marquee h1 { margin: 0; font: 600 clamp(2.4rem, 7vw, 3.6rem)/1.05 var(--serif); }
.marquee .gold { color: var(--gold); font-style: italic; }
.marquee-gem { position: relative; width: 132px; height: 132px; margin: 0 auto 16px; }
.marquee-gem img { width: 100%; height: 100%; animation: bob 6s var(--ease) infinite; filter: drop-shadow(0 18px 30px rgba(255, 160, 0, 0.35)); }
.marquee-gem::before {
    content: ""; position: absolute; inset: 14%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 80, 0.55), transparent 70%); filter: blur(24px);
    animation: breathe 6s ease-in-out infinite;
}
.roll-btn { font-size: 1.05rem; padding: 13px 28px; }
.with-music { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--muted); font-size: 0.92rem; cursor: pointer; }
.with-music input { accent-color: var(--gold); width: 16px; height: 16px; }
.as-list {
    margin-top: 10px; background: none; border: 0; padding: 6px; cursor: pointer;
    color: var(--muted); font: 0.9rem var(--sans); text-decoration: underline; text-underline-offset: 3px;
}
.as-list:hover { color: var(--text); }

/* which part shows when */
.js-cinema.state-marquee .screen,
.js-cinema.state-marquee .stinger,
.js-cinema.state-marquee .foot { display: none; }
.js-cinema.state-list .marquee { display: none; }

.js-cinema.state-rolling .topbar,
.js-cinema.state-rolling .foot,
.js-cinema.state-rolling .marquee,
.js-cinema.state-rolling .stinger,
.js-cinema.state-rolling .glow,
.js-cinema.state-stinger .marquee,
.js-cinema.state-stinger .screen { visibility: hidden; }
.js-cinema.state-rolling, .js-cinema.state-stinger { overflow: hidden; }

.js-cinema.state-rolling .screen {
    position: fixed; inset: 0; z-index: 20; overflow: hidden;
    background:
        radial-gradient(1px 1px at 12% 22%, rgba(255, 236, 200, 0.55), transparent 60%),
        radial-gradient(1px 1px at 78% 14%, rgba(255, 236, 200, 0.4), transparent 60%),
        radial-gradient(1.5px 1.5px at 64% 72%, rgba(255, 220, 160, 0.45), transparent 60%),
        radial-gradient(1px 1px at 30% 84%, rgba(255, 236, 200, 0.35), transparent 60%),
        radial-gradient(1px 1px at 90% 58%, rgba(255, 236, 200, 0.35), transparent 60%),
        radial-gradient(1.5px 1.5px at 6% 62%, rgba(255, 220, 160, 0.3), transparent 60%),
        radial-gradient(ellipse at 50% 120%, rgba(255, 140, 20, 0.16), transparent 60%),
        radial-gradient(ellipse at 50% -20%, rgba(255, 184, 0, 0.1), transparent 55%),
        #050302;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 13%, #000 87%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 13%, #000 87%, transparent 100%);
    cursor: default; touch-action: none;
}
.js-cinema.state-rolling .roll {
    position: absolute; top: 0; left: 0; right: 0; max-width: 820px; margin: 0 auto; padding: 0 24px;
    will-change: transform;
}
.js-cinema.state-rolling .block { padding: 56px 0; }
/* in time with the anthem: more room around each section (credits.js works out how much) */
.js-cinema.state-rolling .roll.synced .block, .js-cinema.state-rolling .roll.synced .end-card { margin-top: var(--sync-gap, 0px); }

.controls {
    position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30;
    display: flex; gap: 8px; padding: 6px; border-radius: 999px;
    background: rgba(18, 13, 8, 0.78); border: 1px solid var(--line); backdrop-filter: blur(8px);
    transition: opacity 0.5s var(--ease);
}
.js-cinema.is-idle .controls { opacity: 0; }
.js-cinema.is-idle.state-rolling .screen { cursor: none; }
.ctl {
    min-width: 42px; height: 38px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer;
    background: transparent; color: var(--text); font: 600 0.9rem var(--sans);
    transition: background 0.2s, color 0.2s;
}
.ctl:hover, .ctl:focus-visible { background: var(--card-hover); color: var(--gold); }
.ctl[aria-pressed="true"] { color: var(--gold); }

/* the post-credits scene, on its own black screen */
.js-cinema.state-stinger .stinger {
    position: fixed; inset: 0; z-index: 25; margin: 0; max-width: none; border: 0; border-radius: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
    background: #050302; animation: fade-in 1.4s var(--ease) both;
}
.js-cinema.state-stinger .stinger-gem { animation: peek 1.1s var(--ease) 0.4s both, bob 6s var(--ease) 1.6s infinite; }
.js-cinema.state-stinger .stinger-actions { opacity: 0; transition: opacity 0.8s var(--ease); }
.js-cinema.state-stinger .stinger-actions.shown { opacity: 1; }
.js-cinema.state-stinger .bubble .line.later { visibility: hidden; }

.js-cinema .fade-black { position: fixed; inset: 0; z-index: 40; background: #000; pointer-events: none; opacity: 0; transition: opacity 1.6s ease; }
.js-cinema .fade-black.on { opacity: 1; }
/* the scene and the list are never behind the black, whatever arrives late */
.js-cinema.state-stinger .fade-black, .js-cinema.state-list .fade-black, .js-cinema.state-marquee .fade-black { opacity: 0; }

@keyframes caret { 50% { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes peek { from { opacity: 0; transform: translateY(40px) rotate(-8deg); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
    .cinema { padding: 0 16px; }
    .pair { grid-template-columns: 1fr; gap: 2px; }
    .pair dt, .pair dd { text-align: center; }
    .pairs { gap: 18px; }
    .stinger-scene { flex-direction: column; align-items: center; text-align: center; }
    .bubble { border-radius: 18px; }
    .controls { bottom: 14px; gap: 4px; }
    .ctl { min-width: 38px; padding: 0 10px; }
    .js-cinema.state-rolling .roll { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
    .marquee-gem img, .marquee-gem::before, .stinger-gem { animation: none !important; }
    .js-cinema.state-stinger .stinger { animation: none; }
}
