/* The slide engine's styles. A deck is a page whose <body class="deck"> holds
   one <main>, and every <section> in it is one slide, drawn on a fixed
   1920 × 1080 stage that deck.js scales to the window. All sizes below are
   in that stage's pixels, so a slide looks the same on any projector. */
@import url(/deck/fonts.css);

:root {
  --sans: Jost, 'PingFang SC', 'Apple SD Gothic Neo', 'Hiragino Sans', 'Microsoft YaHei', 'Malgun Gothic', system-ui, sans-serif;
  --serif: Newsreader, 'Songti SC', 'AppleMyungjo', 'Noto Serif CJK SC', Georgia, serif;
  --type: 'Courier Prime', 'Courier New', ui-monospace, 'PingFang SC', 'Apple SD Gothic Neo', monospace;
  --orange: #d4612f;
  --cream: #efe9dc;
  --night: #0b0a09;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
/* a Korean deck asks for Korean faces first, so shared Han characters are
   drawn in the same family as the hangul beside them */
:root:lang(ko) {
  --sans: Jost, 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', system-ui, sans-serif;
  --serif: Newsreader, 'AppleMyungjo', 'Nanum Myeongjo', Batang, Georgia, serif;
  --type: 'Courier Prime', 'Courier New', ui-monospace, 'Apple SD Gothic Neo', 'Malgun Gothic', monospace;
}

html:has(> .deck) { height: 100%; }
.deck {
  /* cinema: the default, a dark house for film */
  --bg: #0b0a09;
  --fg: #efe9dc;
  --dim: rgba(239, 233, 220, 0.62);
  --line: rgba(239, 233, 220, 0.2);
  margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--fg);
  /* a finger across the stage is a page turn, not a scroll; two still zoom */
  overscroll-behavior: none; touch-action: pinch-zoom;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
.deck[data-theme='paper'] {
  --bg: #f3eee2;
  --fg: #2b2925;
  --dim: #7a766e;
  --line: rgba(43, 41, 37, 0.2);
}

.deck main {
  position: fixed; left: 50%; top: 50%; width: 1920px; height: 1080px; overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--s, 0.5));
  background: var(--bg); opacity: 0; transition: opacity 300ms var(--ease);
}
.deck.is-ready main { opacity: 1; }
.deck.is-black main { opacity: 0; transition-duration: 120ms; }
.deck.is-ready:not(.is-awake) main { cursor: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ── a slide ─────────────────────────────────────────────────────────── */
.slide {
  position: absolute; inset: 0; box-sizing: border-box; padding: 104px 136px 124px;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  background: var(--bg); color: var(--fg); font: 400 40px/1.5 var(--sans); text-wrap: pretty;
  /* no slanted or thickened stand-ins: Chinese and Korean have no italic */
  font-synthesis: none;
  visibility: hidden; opacity: 0; transition: opacity 240ms var(--ease), visibility 0s 240ms;
}
.slide.is-current, .slide.is-clone { visibility: visible; opacity: 1; transition: opacity 240ms var(--ease); }
.slide *, .slide *::before, .slide *::after { box-sizing: border-box; }
.slide :is(h1, h2, h3, p, ul, ol, figure, blockquote) { margin: 0; }
.slide > * { max-width: 100%; }
.slide .notes { display: none; }

.slide h1 { font: 500 132px/1.05 var(--sans); letter-spacing: -0.012em; text-wrap: balance; }
.slide h2 { font: 500 68px/1.16 var(--sans); letter-spacing: -0.006em; max-width: 22em; margin-bottom: 52px; text-wrap: balance; }
.slide h3 { font: 500 40px/1.3 var(--sans); margin-bottom: 14px; }
.slide :is(p, li) { max-width: 31em; }
.slide p + p { margin-top: 0.7em; }
.slide strong { font-weight: 500; }
/* italics are the serif's: a film's title in running text */
.slide em { font: italic 400 1.06em var(--serif); }
.slide a { color: inherit; text-decoration-thickness: 1px; text-decoration-color: var(--dim); text-underline-offset: 0.2em; }
.slide .dim { color: var(--dim); }
.slide :is(code, kbd) { font: 400 0.92em var(--type); }

.slide :is(ul, ol) { padding: 0; list-style: none; display: grid; gap: 0.5em; }
.slide ul > li { position: relative; padding-left: 1.3em; }
.slide ul > li::before { content: ''; position: absolute; left: 0; top: 0.72em; width: 0.62em; height: 2px; background: var(--dim); }
.slide ol { counter-reset: item; }
.slide ol > li { position: relative; padding-left: 2em; counter-increment: item; }
.slide ol > li::before { content: counter(item, decimal-leading-zero); position: absolute; left: 0; top: 0.42em; font: 26px/1 var(--type); color: var(--dim); }

/* typed labels: the line over a heading, the line under a title, captions */
.slide :is(.kicker, .meta, figcaption, cite) { font: 400 26px/1.35 var(--type); font-style: normal; letter-spacing: 0.02em; color: var(--dim); }
.slide .kicker { max-width: none; margin-bottom: 36px; text-transform: uppercase; letter-spacing: 0.1em; }

/* one step at a time: anything with data-step waits for its key */
.slide [data-step] { opacity: 0; translate: 0 14px; transition: opacity 320ms var(--ease), translate 320ms var(--ease); }
.slide [data-step].is-shown { opacity: 1; translate: none; }

/* two columns of anything */
.slide .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 96px; width: 100%; align-items: start; }

/* ── kinds of slide ──────────────────────────────────────────────────── */
/* .title: the opening. The dot is the site's one accent. */
.slide.title { justify-content: flex-end; padding-bottom: 116px; }
.slide.title .kicker::before { content: ''; display: inline-block; width: 14px; height: 14px; margin-right: 18px; border-radius: 50%; background: var(--orange); vertical-align: 0.04em; }
.slide.title .sub { max-width: 24em; margin-top: 28px; font: italic 400 54px/1.25 var(--serif); color: var(--dim); }
.slide.title .meta { display: flex; gap: 56px; width: 100%; max-width: none; margin-top: 84px; padding-top: 28px; border-top: 1px solid var(--line); }

/* .section: a chapter heading */
.slide.section h2 { margin: 0; font-size: 112px; line-height: 1.08; }

/* .quote: someone else's words */
.slide.quote blockquote { max-width: 1440px; font: 400 62px/1.34 var(--serif); text-wrap: balance; }
.slide.quote blockquote::before { content: '“'; display: block; height: 76px; font-size: 150px; line-height: 1; color: var(--dim); }
.slide.quote cite { display: block; margin-top: 52px; }

/* pictures. A frame from a film is never cropped: it is fitted whole, on
   black, whatever its ratio. Add .bleed to a figure to let it fill instead. */
.slide figure { position: relative; }
.slide figure > :is(img, .ph, .yt, .clip__box) { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: contain; }
.slide figure.bleed > img, .slide figure.bleed video { object-fit: cover; }
.slide figcaption { margin-top: 16px; }
.slide figcaption b { font-weight: 400; color: var(--fg); }

/* .still and .clip: the picture is the slide */
.slide:is(.still, .clip) { padding: 0; background: #000; }
.slide:is(.still, .clip) > figure { position: absolute; inset: 0; }
.slide:is(.still, .clip, .split) > figure > :is(img, .ph, .yt, .clip__box) { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.slide:is(.still, .clip, .split) > figure > figcaption,
.clip__time {
  position: absolute; left: 56px; bottom: 44px; z-index: 2; margin: 0; padding: 9px 16px 7px;
  background: rgba(11, 10, 9, 0.74); color: var(--cream); font: 400 24px/1.35 var(--type); letter-spacing: 0.02em;
  transition: opacity 400ms var(--ease);
}
.slide:is(.still, .clip, .split) > figure > figcaption b { color: #fff; }

/* .split: a picture on the left, what you say about it on the right */
.slide.split { display: grid; grid-template-columns: 60% 1fr; align-items: stretch; padding: 0; }
.slide.split > figure { background: #000; }
.slide.split > div { display: flex; flex-direction: column; justify-content: center; padding: 104px 104px 124px 88px; }
.slide.split h2 { font-size: 56px; margin-bottom: 40px; }
.slide.split :is(p, li) { font-size: 34px; }

/* .pair: two frames side by side. .frames: a run of shots, numbered. */
.slide .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; width: 100%; }
.slide .frames { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 28px; width: 100%; counter-reset: shot; }
.slide .frames figure { counter-increment: shot; }
.slide .frames figcaption { font-size: 22px; }
.slide .frames figcaption::before { content: counter(shot, decimal-leading-zero); margin-right: 14px; color: var(--fg); }

/* a stand-in for a picture that is not there yet */
.ph {
  display: grid !important; place-items: center; color: rgba(239, 233, 220, 0.5); font: 400 24px var(--type);
  background: repeating-linear-gradient(135deg, rgba(239, 233, 220, 0.055) 0 2px, transparent 2px 24px), #171513 !important;
}
.ph::after { content: attr(data-label); }

/* ── clips ───────────────────────────────────────────────────────────── */
/* deck.js wraps a <video> in .clip__box and adds the bar, the time and the
   play mark. The clip is a step: one key starts it, the next moves on. */
.clip__box { position: relative; overflow: hidden; cursor: pointer; }
.clip__box > :is(video, img) { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.clip__box::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 132px; height: 132px; translate: -50% -50%;
  border-radius: 50%;
  background: rgba(11, 10, 9, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 52'%3E%3Cpath d='M2 2l40 24L2 50z' fill='%23efe9dc'/%3E%3C/svg%3E") no-repeat 56% 50% / 44px 52px;
  pointer-events: none; transition: opacity 240ms var(--ease);
}
.clip__box.is-playing::after { opacity: 0; }
.clip__bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; height: 6px; background: rgba(239, 233, 220, 0.16); cursor: pointer; }
.clip__bar::before { content: ''; position: absolute; inset: -18px 0 0; }
.clip__bar i { display: block; width: 0; height: 100%; background: var(--cream); }
.clip__time { left: auto; right: 56px; font-variant-numeric: tabular-nums; }
/* once it runs and the mouse is still, the labels leave the picture */
.deck:not(.is-awake) .clip__box.is-playing .clip__time,
.deck:not(.is-awake) .clip__box.is-playing .clip__bar,
.deck:not(.is-awake) figure:has(.clip__box.is-playing, .yt iframe) > figcaption { opacity: 0; }
.clip__bar { transition: opacity 400ms var(--ease); }
video::cue { font: 400 0.9em var(--sans); color: #fff; background: rgba(0, 0, 0, 0.55); }

/* a YouTube clip: empty until its step, then the player */
.yt { position: relative; }
.yt::after { content: 'YouTube'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(239, 233, 220, 0.5); font: 400 24px var(--type); }
.yt iframe { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; border: 0; }

/* ── the stage's own furniture ───────────────────────────────────────── */
.deck__count { position: absolute; right: 56px; bottom: 44px; z-index: 5; font: 400 22px/1 var(--type); color: var(--dim); opacity: 0.75; pointer-events: none; transition: opacity 240ms var(--ease); }
main:has(> .slide.is-current:is(.title, .still, .clip, .split)) .deck__count { opacity: 0; }

.deck__bar { position: fixed; left: 50%; bottom: 16px; z-index: 30; display: flex; gap: 6px; translate: -50% 0; opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); }
.deck.is-awake .deck__bar { opacity: 1; pointer-events: auto; }
.deck__bar :is(button, span, a), .deck__help button {
  border: 0; padding: 6px 11px 5px; background: rgba(28, 25, 22, 0.9); color: var(--cream);
  font: 400 13px/1.4 var(--type); white-space: nowrap; box-shadow: 0 0 0 1px rgba(239, 233, 220, 0.12);
}
.deck__bar a { text-decoration: none; }
.deck__bar button { cursor: pointer; }
.deck__bar :is(button, a):hover { background: var(--cream); color: #1c1916; }
.deck__bar span { font-variant-numeric: tabular-nums; }
/* under a finger: no fullscreen or second window to offer, and the bar goes
   to the top, off the subtitles */
@media (pointer: coarse), (max-width: 560px) {
  .deck__bar { top: 12px; bottom: auto; }
  .deck__bar [data-wide] { display: none; }
}

.deck__help { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); }
.deck__help div { max-width: calc(100vw - 32px); padding: 26px 30px; background: #1c1916; color: var(--cream); font: 400 14px/1.9 var(--type); box-shadow: 0 0 0 1px rgba(239, 233, 220, 0.14); }
.deck__help dl { display: grid; grid-template-columns: auto 1fr; gap: 0 28px; margin: 0 0 18px; }
.deck__help dt { color: rgba(239, 233, 220, 0.6); }
.deck__help dd { margin: 0; }

/* every slide at once */
.overview { position: fixed; inset: 0; z-index: 40; overflow: auto; touch-action: pan-y pinch-zoom; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; align-content: start; padding: 40px; background: var(--night); }
.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; box-shadow: 0 0 0 1px rgba(239, 233, 220, 0.16); }
.thumb__stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; transform: scale(var(--k, 0.14)); pointer-events: none; }
.thumb__hit { position: absolute; inset: 0; z-index: 2; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; }
.thumb[data-n]::after { content: attr(data-n); position: absolute; left: 8px; bottom: 7px; z-index: 1; padding: 1px 6px 0; background: rgba(11, 10, 9, 0.78); color: var(--cream); font: 400 12px/1.5 var(--type); }
.thumb[aria-current='true'] { box-shadow: 0 0 0 2px var(--orange); }
@media (max-width: 560px) { .overview { grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; } }

/* the presenter's window: this slide, the next one, the notes, the time */
.presenter { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-columns: 1.55fr 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 18px 24px; padding: 18px 24px 24px; background: var(--night); color: var(--cream); font: 400 14px/1.4 var(--type); }
.presenter header { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 28px; font-size: 26px; font-variant-numeric: tabular-nums; }
.presenter header button { border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.presenter header small { margin-right: 8px; font-size: 13px; color: rgba(239, 233, 220, 0.55); }
.presenter header .p-count { margin-left: auto; }
.presenter .p-side { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 18px; min-height: 0; }
.presenter .p-next { opacity: 0.8; }
.presenter .p-notes { overflow: auto; font: 400 23px/1.6 var(--sans); }
.presenter .p-notes:empty::before { content: 'no notes on this slide'; font: 400 14px var(--type); color: rgba(239, 233, 220, 0.4); }
.presenter .p-notes :is(p, ul, ol) { margin: 0 0 0.7em; }
.deck.is-presenter main, .deck.is-presenter .deck__bar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .deck main, .slide, .slide [data-step] { transition: none !important; translate: none; }
}

/* ── paper: Print → Save as PDF gives one slide a page ───────────────── */
@page { size: 1920px 1080px; margin: 0; }
@media print {
  html:has(> .deck), .deck { height: auto; overflow: visible; background: none; }
  .deck main { position: static; width: auto; height: auto; overflow: visible; transform: none; opacity: 1; }
  .slide { position: relative; inset: auto; width: 1920px; height: 1080px; overflow: hidden; visibility: visible; opacity: 1; break-after: page; break-inside: avoid; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .slide [data-step] { opacity: 1; translate: none; }
  .deck__count, .deck__bar, .deck__help, .overview, .presenter, .clip__bar, .clip__time, .clip__box::after { display: none !important; }
}
