/* Lesson pages: meta chips, video (+ transcript) and the "Visual lesson" slide deck with its full-screen viewer
   (player: slides.js). The media stage is always dark, like a screen; everything around it uses the site tokens. */
:root {
  --stage: #090d16;
  --stage-ink: #f1f5f9;
  --stage-muted: #a3afbf;
  --stage-line: rgb(255 255 255 / 0.2);
  --stage-glass: rgb(9 13 22 / 0.82);
  --stage-accent: #1f6b57;          /* answer-sheet green, fixed: the stage is dark in both themes */
  --stage-accent-hi: #5fb89c;
}

/* meta line under the h1 */
.lmeta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 0.88rem/1.2 var(--body); text-decoration: none; }
.chip .ico { flex: none; fill: var(--accent); }
@media (hover: hover) { a.chip:hover { border-color: var(--accent); color: var(--accent); } }
.chip-go { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

/* video */
.lvideo { max-width: 1100px; margin-block: 24px 26px; display: grid; gap: 12px; scroll-margin-top: 76px; }
.vframe { position: relative; aspect-ratio: 16 / 9; background: var(--stage); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 32px rgb(15 23 42 / 0.16); }
.vframe video { display: block; width: 100%; height: 100%; background: var(--stage); }
.vfallback { margin: 0; padding: 16px; color: var(--stage-ink); }
@media (max-width: 640px) {
  /* phones: the video bleeds to the screen edges */
  .vframe { margin-inline: -16px; border-radius: 0; box-shadow: none; }
}

/* "coming soon" panels (video and slides) */
.media-ph { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 16px; text-align: center; color: var(--stage-muted);
  background: radial-gradient(120% 90% at 50% 0%, #142033 0%, var(--stage) 70%); }
.media-ph .ph-ico { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; color: var(--stage-ink); border: 2px solid var(--stage-line); background: rgb(255 255 255 / 0.04); }
.media-ph b { font: 700 clamp(1.25rem, 3.2vw, 1.75rem)/1.1 var(--display); letter-spacing: 0.02em; color: var(--stage-ink); }
.media-ph span:not(.ph-ico) { max-width: 30rem; font-size: 0.92rem; }

/* transcript */
.transcript { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.transcript summary { cursor: pointer; font-weight: 700; padding: 10px 16px; min-height: 44px; display: flex; align-items: center; gap: 10px; list-style: none; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); flex: none; }
.transcript[open] summary::before { transform: rotate(45deg); }
.transcript[open] summary { border-bottom: 1px solid var(--line); }
.transcript-body { max-width: none; max-height: 28rem; overflow: auto; padding: 14px 16px 4px; }
.transcript-body p { max-width: 46rem; }
.transcript .ts { display: inline-block; min-width: 3.2em; margin-right: 4px; font-size: 0.78rem; color: var(--muted); }
.transcript a.ts { text-decoration: none; border-radius: 4px; }
@media (hover: hover) { .transcript a.ts:hover { color: var(--accent); text-decoration: underline; } }
.transcript a.ts:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* visually hidden (headings for screen readers / crawlers that the design does not show) */
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* slide deck */
.lesson-main { min-width: 0; }
.deck-sec { padding-top: 22px; display: grid; gap: 12px; scroll-margin-top: 76px; }
.deck-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.deck-head > div { display: grid; gap: 4px; }
.deck-kicker { color: var(--accent); }
.deck-head h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
.deck-count { flex: none; padding: 6px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 0.75rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.deck { position: relative; background: var(--stage); border: 1px solid rgb(148 163 184 / 0.28); border-radius: 12px; overflow: hidden; box-shadow: 0 12px 32px rgb(15 23 42 / 0.14); }
.deck-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--stage); }
.deck-img { display: block; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; -webkit-user-select: none; user-select: none; }
.deck-stage.is-zoom .deck-img { cursor: zoom-out; }
.deck-msg { margin: 0; padding: 16px; color: var(--stage-muted); font-weight: 600; text-align: center; }
.deck.is-loading .deck-msg { visibility: hidden; }
.deck.is-loading .deck-stage::after { content: ""; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 3px solid rgb(255 255 255 / 0.18); border-top-color: var(--stage-accent-hi); border-radius: 50%; animation: sv-spin 0.8s linear infinite; }
.deck-err, .sv-err { position: absolute; inset: auto 0 50%; margin: 0; transform: translateY(50%); padding: 0 16px; text-align: center; color: var(--stage-muted); font-weight: 600; }
.deck-err[hidden], .sv-err[hidden] { display: none; }
.deck-fs { position: absolute; z-index: 2; top: 12px; right: 12px; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; color: #fff; background: var(--stage-glass); border: 1px solid var(--stage-line); border-radius: 10px; cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.deck-bar { position: absolute; z-index: 2; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; width: max-content; max-width: calc(100% - 24px); padding: 4px; color: var(--stage-ink); background: var(--stage-glass); border: 1px solid var(--stage-line); border-radius: 999px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.45); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.deck-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 42px; min-height: 40px; padding: 0 15px; color: #fff; background: rgb(255 255 255 / 0.1); border: 1px solid transparent; border-radius: 999px; font: 700 0.86rem/1 var(--body); cursor: pointer; -webkit-user-select: none; user-select: none; }
.deck-pos { padding: 0 6px; font-size: 0.84rem; font-weight: 600; white-space: nowrap; }
.deck-fs:focus-visible, .deck-btn:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.deck.is-empty .deck-stage { cursor: default; }
.deck-list { margin: 0; padding-left: 1.4em; font-size: 0.9rem; }   /* <noscript> links to every slide */
@media (max-width: 600px) {
  /* phones: the controls sit under the slide instead of covering it */
  .deck-bar { position: static; transform: none; width: auto; max-width: none; justify-content: space-between; padding: 6px; border: 0; border-top: 1px solid var(--stage-line); border-radius: 0; background: #0e1522; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .deck-fs { top: 8px; right: 8px; }
}
@media (max-width: 359px) { .deck-btn .lbl { display: none; } }
/* hover colours only where hovering exists (no sticky green after a tap on phones) */
@media (hover: hover) {
  .deck-fs:hover, .sv-btn:hover { background: var(--stage-accent); border-color: var(--stage-accent); }
  .deck-btn:hover { background: var(--stage-accent); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .deck-img { transition: transform 0.18s ease-out; }
}

/* full-screen viewer */
html.sv-lock, html.sv-lock body { overflow: hidden; }
.sv { position: fixed; inset: 0; z-index: 1000; display: none; color: #fff; background: #000; overscroll-behavior: contain; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.sv.active { display: block; }
.sv-frame { position: absolute; inset: 0; }
.sv.is-rotated .sv-frame { inset: auto; top: 50%; left: 50%; width: 100vh; width: 100dvh; height: 100vw; transform: translate(-50%, -50%) rotate(90deg); }
.sv-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.sv.is-zoomed .sv-stage { cursor: grab; }
.sv.is-dragging .sv-stage { cursor: grabbing; }
.sv-zoom { position: relative; line-height: 0; transform-origin: center center; will-change: transform; }
.sv-img { display: block; width: auto; height: auto; max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; pointer-events: none; }
.sv.is-rotated .sv-img { max-width: 100vh; max-width: 100dvh; max-height: 100vw; }
@media (hover: hover) and (pointer: fine) {
  .sv-img { max-width: calc(100vw - 150px); max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); border-radius: 6px; }
}
.sv-title { position: absolute; z-index: 2; top: calc(14px + env(safe-area-inset-top, 0px)); left: calc(16px + env(safe-area-inset-left, 0px)); right: 80px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 700 1.05rem/44px var(--display); letter-spacing: 0.03em; text-transform: uppercase; color: rgb(255 255 255 / 0.78); pointer-events: none; transition: opacity 0.2s; }
.sv-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: #fff; background: rgb(0 0 0 / 0.55); border: 1px solid rgb(255 255 255 / 0.22); border-radius: 50%; font: 600 20px/1 var(--body); cursor: pointer; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: opacity 0.2s, background-color 0.15s; }
.sv-btn:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.sv-close { position: absolute; z-index: 3; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); }
.sv-nav { position: absolute; z-index: 2; top: 50%; width: 52px; height: 52px; font-size: 34px; line-height: 1; padding-bottom: 4px; transform: translateY(-50%); }
.sv-prev { left: calc(12px + env(safe-area-inset-left, 0px)); }
.sv-next { right: calc(12px + env(safe-area-inset-right, 0px)); }
.sv.is-touch .sv-title { display: none; }
.sv.is-touch .sv-nav { width: 42px; height: 42px; font-size: 28px; opacity: 0.6; }
.sv-counter { position: absolute; z-index: 2; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); padding: 7px 15px; color: #fff; background: rgb(0 0 0 / 0.55); border: 1px solid rgb(255 255 255 / 0.14); border-radius: 999px; font-size: 0.88rem; font-weight: 600; transform: translateX(-50%); pointer-events: none; transition: opacity 0.2s; }
.sv.controls-hidden .sv-btn, .sv.controls-hidden .sv-counter, .sv.controls-hidden .sv-title { opacity: 0; pointer-events: none; }
.sv.is-zoomed .sv-nav, .sv.is-zoomed .sv-title { opacity: 0; pointer-events: none; }
.sv-spinner { position: absolute; top: 50%; left: 50%; display: none; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 3px solid rgb(255 255 255 / 0.2); border-top-color: var(--stage-accent-hi); border-radius: 50%; animation: sv-spin 0.8s linear infinite; }
.sv.is-loading .sv-spinner { display: block; }
@keyframes sv-spin { to { transform: rotate(360deg); } }
@keyframes sv-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .sv.active { animation: sv-in 0.18s ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  .sv-spinner, .deck.is-loading .deck-stage::after { animation-duration: 2.4s; }
  .sv-btn, .sv-counter, .sv-title { transition: none; }
}

/* slide text boxes (translation overlay, slides.js): boxes over the slide picture, in the slide's own pixel grid */
.stb-ov { position: absolute; z-index: 1; pointer-events: none; line-height: normal; }
.stb-ov[hidden] { display: none; }
.stb { position: absolute; display: flex; align-items: center; justify-content: center; padding: 1px 3px; overflow: hidden; color: #fff; text-align: center;
  background: rgb(9 13 22 / 0.88); border: 1px solid rgb(255 255 255 / 0.35); border-radius: 4px; font-family: var(--body); font-weight: 600; line-height: 1.1;
  pointer-events: auto; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.stb > span { display: block; width: 100%; min-width: 0; white-space: normal; overflow-wrap: anywhere; hyphens: auto; }
.stb.is-loading { color: rgb(255 255 255 / 0.55); }
.stb.box-hidden { opacity: 0; }
@media (hover: hover) {
  .stb:hover { background: rgb(31 107 87 / 0.95); border-color: #fff; }
  .stb.box-hidden:hover { opacity: 0.35; }
}
.deck.text-on .deck-img { cursor: pointer; }
.deck-txt { position: absolute; z-index: 2; top: 12px; right: 62px; height: 42px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: #fff; background: var(--stage-glass); border: 1px solid var(--stage-line); border-radius: 10px; font: 700 0.8rem/1 var(--body); cursor: pointer; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.deck-txt[hidden] { display: none; }
.deck-txt[aria-pressed="true"] { background: var(--stage-accent); border-color: var(--stage-accent); }
.deck-txt:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
@media (hover: hover) { .deck-txt:hover { background: var(--stage-accent); border-color: var(--stage-accent); } }
@media (max-width: 600px) { .deck-txt { top: 8px; right: 56px; height: 38px; padding: 0 10px; } }

/* viewer: round translate button (bottom right) with the language flag, full-page language picker */
.sv-ov { left: 0; top: 0; }
.sv-tr { position: absolute; z-index: 3; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; }
.sv-tr[hidden] { display: none; }
.sv-tr.active { background: var(--stage-accent); border-color: var(--stage-accent); box-shadow: 0 6px 18px rgb(31 107 87 / 0.5); }
.sv-tr-flag { position: absolute; right: -3px; bottom: -3px; display: none; width: 22px; height: 16px; object-fit: cover; border: 1.5px solid #fff; border-radius: 3px; }
.sv-tr.active .sv-tr-flag { display: block; }
.sv.picker-open .sv-frame { visibility: hidden; }
.sv-picker { position: absolute; inset: 0; z-index: 10; overflow-y: auto; color: var(--stage-ink); background: #0b111c; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; -webkit-user-select: text; user-select: text; }
.sv-picker[hidden] { display: none; }
.sv-picker-in { max-width: 880px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(28px + env(safe-area-inset-bottom, 0px)); }
.sv-picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.sv-picker-head h2 { margin: 2px 0 6px; color: #fff; font: 700 clamp(1.5rem, 4vw, 1.9rem)/1.1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; }
.sv-picker-head p { margin: 0; color: var(--stage-muted); font-size: 0.92rem; line-height: 1.45; max-width: 38rem; }
.sv-picker-head .sv-btn { flex: none; }
.sv-picker-search { width: 100%; height: 50px; padding: 0 16px; color: #fff; background: #172131; border: 1px solid var(--stage-line); border-radius: 12px; font: 400 1rem/1 var(--body); }
.sv-picker-search::placeholder { color: rgb(255 255 255 / 0.5); }
.sv-picker-search:focus { outline: none; border-color: var(--stage-accent-hi); box-shadow: 0 0 0 1px var(--stage-accent-hi); }
.sv-picker-off { display: flex; align-items: center; gap: 12px; width: 100%; margin: 14px 0 22px; padding: 14px 16px; color: #fff; text-align: left; background: #172131; border: 1px solid var(--stage-line); border-radius: 14px; font: inherit; cursor: pointer; }
.sv-picker-off.active { border-color: var(--stage-accent-hi); box-shadow: inset 0 0 0 1px var(--stage-accent-hi); }
.sv-picker-off-ico { font-size: 1.5rem; line-height: 1; color: var(--stage-muted); }
.sv-picker-off strong { display: block; font-size: 0.95rem; }
.sv-picker-off small { display: block; margin-top: 2px; color: var(--stage-muted); font-size: 0.82rem; }
.sv-picker-sec { margin: 0 0 14px; color: #fff; font: 700 1rem/1.2 var(--body); }
.sv-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 18px 8px; }
.sv-lang { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; padding: 4px 2px; color: rgb(255 255 255 / 0.78); background: none; border: 0; border-radius: 10px; font: 500 0.76rem/1.25 var(--body); cursor: pointer; }
.sv-lang-flag { display: grid; place-items: center; width: 58px; height: 58px; overflow: hidden; background: #172131; border: 1.5px solid var(--stage-line); border-radius: 50%; }
.sv-lang-flag img { width: 34px; height: 24px; object-fit: cover; border-radius: 3px; }
.sv-lang-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-lang.active { color: var(--stage-accent-hi); font-weight: 700; }
.sv-lang.active .sv-lang-flag { background: rgb(95 184 156 / 0.18); border: 2.5px solid var(--stage-accent-hi); box-shadow: 0 0 12px rgb(95 184 156 / 0.45); }
.sv-lang:focus-visible, .sv-picker-off:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
@media (hover: hover) { .sv-lang:hover .sv-lang-flag { border-color: var(--stage-accent-hi); } .sv-picker-off:hover { border-color: var(--stage-accent-hi); } }
.sv-picker-empty { grid-column: 1 / -1; margin: 0; padding: 20px; color: var(--stage-muted); text-align: center; }
.sv.is-touch .sv-tr { width: 50px; height: 50px; }
