/* =====================================================================
   Discovery — the trade films (js/discovery/discovery-films.js)
   The Videos button on the game's bar (brass, a size up, with a shine),
   the Videos panel's grid grouped like the Book, the theater (one film
   large over the darkened page), and a chapter's poster in the Book.
   The game's tokens (css/discovery.css): slate, bone, brass, rust.
   ===================================================================== */

/* ── The bar's Videos button: the one brass button, a size up; a light runs across it now and then ──
   The bar centres its row, so the other buttons keep their own height instead of stretching to this one. */
.dq-bar { align-items: center; }
.dq-btn.dq-films-btn {
    position: relative; overflow: hidden; isolation: isolate;
    min-height: 44px; padding: 8px 17px 8px 14px; gap: 8px;
    font-size: calc(16.5px * var(--dq-text)); color: #f6dc98;
    border-color: rgba(217, 164, 65, .7);
    background: linear-gradient(180deg, #5a4120 0%, #3d2b13 100%);
    box-shadow: inset 0 1px 0 rgba(246, 220, 152, .28), 0 0 0 1px rgba(18, 13, 10, .45), 0 4px 14px rgba(217, 164, 65, .16);
}
.dq-btn.dq-films-btn svg { width: 19px; height: 19px; fill: currentColor; flex: none; }
.dq-btn.dq-films-btn .dq-mono { color: rgba(246, 220, 152, .7); }
.dq-btn.dq-films-btn:hover, .dq-btn.dq-films-btn:focus-visible {
    color: #fff3d6; background: linear-gradient(180deg, #6b4d24 0%, #4a3416 100%);
    box-shadow: inset 3px 0 0 var(--rust), inset 0 1px 0 rgba(246, 220, 152, .3), 0 4px 18px rgba(217, 164, 65, .3);
}
.dq-btn.dq-films-btn::after {
    content: ''; position: absolute; z-index: -1; top: -30%; bottom: -30%; left: 0; width: 46%;
    background: linear-gradient(100deg, rgba(255, 240, 200, 0) 0%, rgba(255, 240, 200, .55) 50%, rgba(255, 240, 200, 0) 100%);
    transform: translateX(-130%) skewX(-20deg); pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
    .dq-btn.dq-films-btn::after { animation: dqShine 6.5s cubic-bezier(.45, .05, .35, 1) 1.5s infinite; }
    @keyframes dqShine {
        0% { transform: translateX(-130%) skewX(-20deg); }
        18% { transform: translateX(330%) skewX(-20deg); }
        100% { transform: translateX(330%) skewX(-20deg); }
    }
}
.dq.is-still .dq-btn.dq-films-btn::after { animation: none; }
/* Phones: the bar keeps one row, so the button keeps its film glyph and its name goes to screen readers only,
   and the bar's buttons sit a little closer (the other buttons' padding 10 -> 8 px, gap 6 -> 4 px). */
@container stage (max-width: 640px) {
    .dq-bar { gap: 4px; }
    .dq-bar .dq-btn { padding: 6px 8px; }
    .dq-btn.dq-films-btn { padding: 6px 10px; min-height: 42px; }
    .dq-btn.dq-films-btn .dq-films-word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.dq.is-touch .dq-btn.dq-films-btn { min-height: 44px; }   /* the bar's one row is 44 px on touch (game-test) */

/* ── The Videos panel: a wide sheet, the films in a grid under the Book's part names ── */
.dq-panel.dq-films { width: min(1100px, calc(100% - 28px)); height: min(760px, calc(100% - 28px)); }
.vf-lede { margin-bottom: 4px; }
.vf-part { margin-top: 18px; }
.vf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 16px 14px; margin: 0; padding: 0; list-style: none; }
.vf-card { min-width: 0; }
.vf-play {
    display: grid; gap: 3px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--bone);
}
.vf-thumb {
    position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; margin-bottom: 6px;
    border: 1px solid var(--line2); border-radius: 3px; background: #2b1d14;
    box-shadow: 0 6px 16px rgba(18, 13, 10, .45);
}
.vf-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease, filter .35s ease; filter: saturate(.92) brightness(.92); }
.vf-play:hover .vf-thumb img, .vf-play:focus-visible .vf-thumb img { transform: scale(1.04); filter: none; }
.vf-play:focus-visible { outline: none; }
.vf-play:focus-visible .vf-thumb { outline: 2px solid var(--brass); outline-offset: 2px; }
.vf-disc {
    position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
    display: grid; place-items: center; color: #2a1d0c;
    background: radial-gradient(circle at 34% 30%, #f6dc98 0 18%, var(--brass) 52%, #9d7328 100%);
    box-shadow: 0 0 0 1px rgba(18, 13, 10, .55), 0 6px 18px rgba(18, 13, 10, .55);
    opacity: 0; transform: scale(.82); transition: opacity .2s ease, transform .25s ease;
}
.vf-disc svg { width: 20px; height: 20px; fill: currentColor; margin-left: 3px; }
.vf-play:hover .vf-disc, .vf-play:focus-visible .vf-disc, .dq.is-touch .vf-disc { opacity: 1; transform: none; }
.vf-time {
    position: absolute; right: 6px; bottom: 6px; padding: 0 6px; border-radius: 3px;
    background: rgba(18, 13, 10, .82); color: var(--bone); font-size: calc(11.5px * var(--dq-text)); line-height: 1.6;
}
.vf-seen {
    display: none; position: absolute; left: 6px; top: 6px; padding: 0 7px; border-radius: 3px;
    background: rgba(18, 13, 10, .82); color: var(--good); font-size: calc(11.5px * var(--dq-text)); font-weight: 600; line-height: 1.6;
}
.vf-card.is-seen .vf-seen { display: block; }
.vf-name { font-weight: 600; font-size: calc(14.5px * var(--dq-text)); line-height: 1.3; }
.vf-told { color: var(--dust); font-size: calc(12.5px * var(--dq-text)); }
@media (prefers-reduced-motion: reduce) { .vf-thumb img, .vf-disc { transition: none; } }
.dq.is-still .vf-thumb img, .dq.is-still .vf-disc { transition: none; }
@container stage (max-width: 640px) {
    .vf-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 10px; }
}

/* ── The theater: the film large over the whole page, darkened behind it ── */
.vf-theater {
    position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; padding: 20px;
    font-family: 'Sora', system-ui, sans-serif; color: #efe6d2;
    --bone: #efe6d2; --soft: #d3c8b1; --dust: #937f6b; --brass: #d9a441; --rust: #b4462a;
    --raised: #2a2019; --selected: #3a2b18; --line: #3a2e24; --line2: #4a3b2e; --dq-text: 1;
}
.vf-shade { position: absolute; inset: 0; background: rgba(9, 6, 4, .9); }
.vf-frame {
    position: relative; display: grid; gap: 12px;
    width: min(1280px, calc(100vw - 40px), calc((100vh - 150px) * 16 / 9));
    width: min(1280px, calc(100vw - 40px), calc((100dvh - 150px) * 16 / 9));
}
.vf-screen {
    position: relative; aspect-ratio: 16 / 9; background: #120d0a; border-radius: 4px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(217, 164, 65, .45), 0 30px 80px rgba(0, 0, 0, .7);
}
.vf-video { display: block; width: 100%; height: 100%; background: #120d0a; }
.vf-video:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; }
.vf-bar { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; }
.vf-meta { flex: 1 1 260px; min-width: 0; }
.vf-theater .vf-name { margin: 0; color: var(--brass); font-size: 28px; line-height: 1; font-family: 'Big Shoulders Stencil Display', 'Sora', sans-serif; font-weight: 700; letter-spacing: .02em; }
.vf-by { margin: 4px 0 0; color: var(--soft); font-size: 14px; }
.vf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vf-theater .dq-btn {
    display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 7px 14px;
    background: var(--raised); border: 1px solid var(--line2); border-radius: 3px; color: var(--soft);
    font: 600 14px 'Sora', system-ui, sans-serif; cursor: pointer;
}
.vf-theater .dq-btn:hover, .vf-theater .dq-btn:focus-visible { background: var(--selected); color: var(--bone); box-shadow: inset 3px 0 0 var(--rust); }
.vf-theater .dq-btn:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.vf-theater .dq-btn[disabled] { opacity: .45; cursor: default; box-shadow: none; }
.vf-theater .dq-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.vf-theater .dq-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-weight: 500; font-size: 12px; color: var(--dust); }
.vf-theater [hidden] { display: none !important; }
@media (prefers-reduced-motion: no-preference) {
    .vf-shade { opacity: 0; transition: opacity .3s ease; }
    .vf-theater.is-open .vf-shade { opacity: 1; }
    .vf-theater.is-growing .vf-frame { transition: transform .42s cubic-bezier(.2, .8, .2, 1), opacity .3s ease; }
}
@media (max-width: 640px) {
    .vf-theater { padding: 10px; align-content: center; }
    .vf-frame { width: calc(100vw - 20px); }
    .vf-theater .vf-name { font-size: 22px; }
    .vf-step span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .vf-theater .dq-mono { display: none; }
}
@media (max-height: 500px) and (orientation: landscape) {
    .vf-theater { padding: 8px; }
    .vf-frame { width: min(calc(100vw - 16px), calc((100dvh - 70px) * 16 / 9)); gap: 6px; }
    .vf-by { display: none; }
}

/* ── A chapter's film in the Book of Trades: its poster, which opens the theater ── */
.bk .vf-figure { margin: 14px 0 4px; }
.bk .vf-bookfilm { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.bk .vf-poster { position: relative; display: block; aspect-ratio: 16 / 9; max-height: 220px; overflow: hidden; border-radius: 2px; background: #2b1d14; box-shadow: 0 0 0 1px var(--paper-edge); }
.bk .vf-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bk .vf-poster .vf-disc { opacity: 1; transform: none; }
.bk .vf-bookfilm:hover .vf-poster img, .bk .vf-bookfilm:focus-visible .vf-poster img { filter: brightness(1.06); }
.bk .vf-bookfilm:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
