/* =====================================================================
   nooly · i see you deck — Night Shift · 야간 실록
   Deep-ink editorial dossier · strategic document at lamplight
   ===================================================================== */

:root {
  /* Warm dark — candlelight charcoal */
  --bg: #1a1510;
  --surface: #221c16;
  --surface-1: #2a221a;
  --surface-2: #342a20;

  /* Ink — golden ivory, lantern warmth */
  --ink: #f2e8d4;
  --ink-soft: #b5a898;
  --ink-faint: #7a6e5e;
  --mute: #5a4f42;

  /* Accent — amber coral, iris gold */
  --accent: #e0803a;
  --accent-hover: #ec9152;
  --accent-light: #f4b684;
  --accent-bg: rgba(224, 128, 58, 0.16);
  --accent-bg-strong: rgba(224, 128, 58, 0.24);
  --accent-glow: rgba(224, 128, 58, 0.5);

  /* Lines — warm sepia borders */
  --line: #3a2e22;
  --line-soft: #2a2118;
  --rule: #3d3126;

  /* Shape */
  --radius: 4px;
  --radius-lg: 12px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Warm ambient grain */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.95 0 0 0 0 0.82 0 0 0 0 0.65 0 0 0 0.3 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "NanumSquareNeoVariable", "NanumSquareNeo",
    -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo",
    "Malgun Gothic", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  font-variant-ligatures: common-ligatures;
}

body {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 48px);
  background:
    radial-gradient(1100px 800px at 18% -5%, rgba(224, 128, 58, 0.10) 0%, transparent 55%),
    radial-gradient(900px 700px at 100% 110%, rgba(100, 62, 38, 0.35) 0%, transparent 50%),
    var(--bg);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.28;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}

/* =====================================================================
   Deck — strategic document surface
   ===================================================================== */

.deck {
  --max-w: min(1640px, 96vw);
  --max-h: calc(100vh - clamp(32px, 6vw, 96px));
  --h: min(calc(var(--max-w) * 10 / 16), var(--max-h));
  position: relative;
  width: calc(var(--h) * 16 / 10);
  height: var(--h);
  background: var(--surface);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px var(--line),
    0 40px 80px -40px rgba(0, 0, 0, 0.9),
    0 12px 28px rgba(0, 0, 0, 0.35);
}

.deck::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.22;
  mix-blend-mode: overlay;
  pointer-events: none;
  border-radius: inherit;
}

/* =====================================================================
   Instrument bar — unified top strip (folio + corner actions)
   ===================================================================== */

.folio {
  position: absolute;
  top: 18px;
  left: clamp(28px, 3.5vw, 52px);
  display: flex;
  align-items: baseline;
  gap: 5px;
  z-index: 5;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.folio-num {
  color: var(--accent);
  font-weight: 500;
  min-width: 32px;
  display: inline-block;
  transition: color 0.3s var(--ease);
}
.folio-slash {
  color: var(--ink-faint);
  opacity: 0.5;
  font-size: 12px;
}
.folio-total {
  color: var(--ink-faint);
}
.folio.folio-hidden { visibility: hidden; }

.corner {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 2px;
  z-index: 10;
}

/* Side navigation arrows — large, fixed to viewport edges, OUTSIDE deck */
.nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 128px;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0.38;
  transition: opacity 0.2s var(--ease), color 0.2s var(--ease);
  z-index: 100;
  border-radius: 10px;
}
.nav:hover {
  opacity: 1;
  color: var(--accent);
}
.nav:active { transform: translateY(-50%) scale(0.94); }
.nav:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 4px;
  opacity: 1;
  color: var(--accent);
}
.nav svg {
  width: 56px;
  height: 56px;
  stroke-width: 1.2;
  transition: filter 0.2s var(--ease);
}
.nav:hover svg { filter: drop-shadow(0 0 10px var(--accent-glow)); }

.nav-prev { left: clamp(6px, 1vw, 24px); }
.nav-next { right: clamp(6px, 1vw, 24px); }

.corner button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
.corner button:hover { opacity: 1; background: rgba(255, 255, 255, 0.04); }
.corner button:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
  opacity: 1;
}

/* =====================================================================
   Stage — slide container
   ===================================================================== */

.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

/* Content slides — left-hinge architecture */
.slide:not(.cover) {
  padding:
    clamp(56px, 6.5vw, 88px)
    clamp(56px, 5.5vw, 96px)
    clamp(40px, 4.5vw, 64px)
    clamp(88px, 7.5vw, 118px);
  gap: clamp(22px, 2.2vw, 34px);
}

/* Left hinge rule — warm amber glow in the margin gutter */
.slide:not(.cover)::before {
  content: "";
  position: absolute;
  left: clamp(52px, 4.8vw, 78px);
  top: clamp(86px, 9vw, 120px);
  bottom: clamp(56px, 5vw, 80px);
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(224, 128, 58, 0.26) 18%,
    rgba(224, 128, 58, 0.26) 82%,
    transparent 100%);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

.slide:not(.cover).active::before {
  opacity: 1;
  transition-delay: 220ms;
}

/* Staggered editorial reveal */
.slide > .date,
.slide > .headline,
.slide > .bullets > li {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease);
}

.slide.active > .date           { opacity: 1; transform: none; transition-delay: 60ms; }
.slide.active > .headline       { opacity: 1; transform: none; transition-delay: 140ms; }
.slide.active > .bullets > li   { opacity: 1; transform: none; }
.slide.active > .bullets > li:nth-child(1) { transition-delay: 220ms; }
.slide.active > .bullets > li:nth-child(2) { transition-delay: 270ms; }
.slide.active > .bullets > li:nth-child(3) { transition-delay: 320ms; }
.slide.active > .bullets > li:nth-child(4) { transition-delay: 370ms; }
.slide.active > .bullets > li:nth-child(5) { transition-delay: 420ms; }
.slide.active > .bullets > li:nth-child(6) { transition-delay: 470ms; }

.slide:not(.active) { transition: opacity 0.2s var(--ease); }

/* =====================================================================
   Date — kicker with top rule
   ===================================================================== */

.date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.date::before {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* =====================================================================
   Headline
   ===================================================================== */

.headline {
  font-size: clamp(36px, 3.8vw, 59px);
  line-height: 1.2;
  letter-spacing: -0.026em;
  font-weight: 800;
  color: var(--ink);
  max-width: none;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: auto;
}

.headline.flow {
  line-height: 1.22;
  letter-spacing: -0.02em;
  /* Wrap naturally — no nowrap shrink. Inherits full .headline font-size. */
}

.headline.flow mark {
  padding: 0.04em 0.28em;
  border-radius: 4px;
}

/* Refined mark — editor's highlight, not bubble pill */
.headline mark,
.bullets li mark {
  background: var(--accent-bg);
  color: var(--accent-light);
  font-weight: 700;
  padding: 0.06em 0.32em;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: inset 0 0 0 1px rgba(232, 112, 58, 0.22);
}

.headline mark {
  font-weight: 800;
  padding: 0.04em 0.34em;
  border-radius: 4px;
}

.headline .sub {
  font-size: 0.78em;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
}

/* =====================================================================
   Bullets
   ===================================================================== */

.bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.2vw, 18px);
  margin-top: clamp(4px, 0.5vw, 10px);
}

.bullets li {
  font-size: clamp(18px, 1.5vw, 24px);
  line-height: 1.5;
  color: var(--ink);
  opacity: 0.88;
  padding-left: 30px;
  position: relative;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: auto;
}

.bullets li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.68em;
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(232, 112, 58, 0.5);
}

.bullets li strong {
  color: var(--ink);
  font-weight: 700;
  opacity: 1;
}

.bullets li em {
  font-style: italic;
  color: var(--ink-soft);
  font-weight: 400;
  opacity: 0.7;
}

/* =====================================================================
   Pill nav — page numbers with active coral underline
   Home button (house icon) detached at far left
   ===================================================================== */

.pills {
  display: flex;
  gap: 0;
  padding: 0 clamp(20px, 3vw, 56px);
  height: 42px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0));
  position: relative;
}

/* Home button — house icon, far left, clearly detached from page numbers */
.pill.pill-cover {
  flex: 0 0 auto;
  width: 34px;
  height: 28px;
  padding: 0;
  margin-right: 22px;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  font-size: 0;
  transition: color 0.2s var(--ease);
  border-radius: 4px;
}

.pill.pill-cover::before { display: none; }

.pill.pill-cover::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  right: -12px;
  width: 1px;
  background: var(--line);
}

.pill.pill-cover svg {
  width: 17px;
  height: 17px;
  display: block;
  transition: transform 0.25s var(--ease);
}

.pill.pill-cover:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.03);
}
.pill.pill-cover:hover svg { transform: translateY(-1px); }

.pill.pill-cover.active { color: var(--accent); }
.pill.pill-cover.active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

/* Closing pill — mirrors the home pill but lives at the END of the strip.
   Wider left margin + a leftward separator line clearly detach it from the
   last appendix page (matches the cover pill's right-side separator). */
.pill.pill-closing {
  margin-right: 0;
  margin-left: 22px;
}
.pill.pill-closing::after {
  left: -12px;
  right: auto;
}

/* Cover and closing pills don't borrow the underline-style active marker
   from body pills — they signal active state via icon color + drop-shadow.
   Without this override, .pill.active::after morphs the separator hairline
   into an 18px amber block beside the icon, which reads as if the marker
   sat on the WRONG button. Pin the ::after back to its 1px separator role. */
.pill.pill-cover.active::after,
.pill.pill-cover.past::after,
.pill.pill-closing.active::after,
.pill.pill-closing.past::after {
  width: 1px;
  background: var(--line);
  box-shadow: none;
}

/* Page-number pills — mono tabular numerals with coral active underline */
.pill {
  flex: 0 0 auto;
  min-width: 30px;
  height: 100%;
  background: transparent;
  border: none;
  padding: 6px 8px 8px;
  position: relative;
  cursor: pointer;
  color: var(--ink-faint);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: color 0.18s var(--ease);
}

.pill::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: width 0.2s var(--ease), background 0.2s var(--ease);
}

.pill:hover { color: var(--ink); }
.pill:hover::after { width: 10px; background: rgba(224, 128, 58, 0.45); }

.pill.past {
  color: var(--mute);
}
.pill.past::after {
  width: 6px;
  background: rgba(224, 128, 58, 0.3);
}

.pill.active {
  color: var(--accent);
  font-weight: 700;
}
.pill.active::after {
  width: 18px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.pill:focus-visible {
  outline: none;
  color: var(--ink);
}
.pill:focus-visible::after { width: 14px; }

/* =====================================================================
   Audio player
   ===================================================================== */

.player {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(32px, 5vw, 64px) 18px;
  background: transparent;
}

.player-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 14px 7px 18px;
  background: var(--surface-1);
  border-radius: 999px;
  min-height: 38px;
  box-shadow:
    inset 0 1px 0 rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.play {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.2s var(--ease);
  flex-shrink: 0;
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 0 0 0 rgba(232, 112, 58, 0);
}

.play:hover {
  background: var(--accent-bg);
  box-shadow:
    inset 0 0 0 1px var(--accent),
    0 0 16px var(--accent-glow);
  color: var(--accent-hover);
}
.play:active { transform: scale(0.97); }

.play > svg.icon-play,
.play > svg.icon-pause { position: relative; z-index: 1; }

.play .ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.ring-track { fill: none; stroke: transparent; }
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.15s linear;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}

.play .icon-pause { display: none; }
.play.playing .icon-play { display: none; }
.play.playing .icon-pause { display: block; }

.time, .count {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 11.5px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  opacity: 0.9;
}

.time {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 114px;
}
.time::before {
  content: "NARRATION";
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--ink-faint);
  font-weight: 600;
}

.count {
  min-width: 50px;
  text-align: right;
  color: var(--ink-faint);
}

.scrub {
  flex: 1;
  height: 22px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.scrub::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--line);
  border-radius: 999px;
}

.scrub-fill {
  position: absolute;
  left: 0;
  height: 2px;
  background: var(--ink);
  border-radius: 999px;
  width: 0%;
  transition: width 0.12s linear;
  opacity: 0.9;
}

.scrub-knob {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--ink);
  border-radius: 50%;
  left: 0%;
  transform: translateX(-50%);
  transition: left 0.12s linear;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.vol {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.18s var(--ease);
  flex-shrink: 0;
  opacity: 0.7;
}

.vol:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  opacity: 1;
}

.vol .icon-muted { display: none; }
.vol.muted .icon-vol { display: none; }
.vol.muted .icon-muted { display: block; color: var(--accent); opacity: 1; }

/* =====================================================================
   Cover — DOSSIER title page (night edition)
   ===================================================================== */

.slide.cover {
  justify-content: space-between;
  gap: 0;
  padding:
    clamp(40px, 4.5vw, 56px)
    clamp(56px, 6vw, 100px)
    clamp(36px, 4vw, 48px);
  overflow: hidden;
}

/* Iris glow — the eye meeting yours across the page.
   Toned down to balance with the cover-eye art's own built-in halo. */
.cover-iris {
  position: absolute;
  right: clamp(-120px, -8vw, -60px);
  bottom: clamp(-140px, -10vw, -80px);
  width: clamp(420px, 56vw, 720px);
  height: clamp(420px, 56vw, 720px);
  border-radius: 50%;
  background:
    radial-gradient(circle at center,
      rgba(224, 128, 58, 0.16) 0%,
      rgba(224, 128, 58, 0.10) 18%,
      rgba(224, 128, 58, 0.04) 42%,
      transparent 70%);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
  z-index: 0;
  filter: blur(6px);
}

.cover-iris::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 50%;
  background: radial-gradient(circle at center,
    rgba(224, 128, 58, 0.22) 0%,
    rgba(224, 128, 58, 0.08) 60%,
    transparent 100%);
  filter: blur(10px);
}

.slide.cover.active .cover-iris {
  opacity: 1;
  transform: scale(1);
  transition-delay: 100ms;
}

/* Cover eye — All-Seeing Eye art, sits at the visual center of the iris glow.
   The source image has a luminous off-white halo, so the mask is kept tight
   and saturation is pulled down to keep the lantern atmosphere (no white bloom). */
.cover-eye {
  position: absolute;
  /* Match the visual center of .cover-iris (right + width/2, bottom + height/2) */
  right: clamp(140px, 17vw, 245px);
  bottom: clamp(120px, 15vw, 220px);
  width: 36%;
  height: auto;
  transform: translate(50%, 50%) scale(0.94);
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  mix-blend-mode: screen;
  /* Tight circular vignette — clips the bright off-white background before it can bloom,
     but loose enough to let the inner ray-burst halo emerge */
  -webkit-mask-image: radial-gradient(circle at center,
    black 28%,
    rgba(0, 0, 0, 0.85) 44%,
    rgba(0, 0, 0, 0.35) 58%,
    transparent 72%);
          mask-image: radial-gradient(circle at center,
    black 28%,
    rgba(0, 0, 0, 0.85) 44%,
    rgba(0, 0, 0, 0.35) 58%,
    transparent 72%);
  filter: saturate(0.62) contrast(0.98) brightness(0.92);
  transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}
.slide.cover.active .cover-eye {
  opacity: 0.72;
  transform: translate(50%, 50%) scale(1);
  transition-delay: 240ms;
}

/* Closing-dossier portrait — face-forward art for the CLOSING page.
   Source: 1354x2048 photographic portrait (FACE_03 — woman with brown hair,
   pale background). Sized at ~75% of the original v3 footprint so the face
   reads as a calm coda, not a forceful header. Tuned with `object-fit: cover`
   so the upper-mid third of the source carries the eye-line, plus a two-layer
   mask that:
   (1) applies a face-centered radial vignette
   (2) erases the rectangular photo plate to the LEFT of the face line so
       the cheek/jaw contour dissolves into the lantern dark rather than
       sitting on a visible bluish-white photo background. */
.cover-portrait {
  position: absolute;
  right: clamp(40px, 5vw, 96px);
  top: 50%;
  transform: translate(0, -50%) scale(0.96);
  width: clamp(256px, 25.5vw, 420px);
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  object-position: center 32%;
  z-index: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  /* Mask layers — composited with `intersect` so visible area = both layers' alpha */
  -webkit-mask-image:
    radial-gradient(circle at 50% 46%,
      black 36%,
      rgba(0, 0, 0, 0.88) 56%,
      rgba(0, 0, 0, 0.44) 76%,
      transparent 92%),
    linear-gradient(94deg,
      transparent 12%,
      rgba(0, 0, 0, 0.5) 22%,
      rgba(0, 0, 0, 0.9) 32%,
      black 40%);
          mask-image:
    radial-gradient(circle at 50% 46%,
      black 36%,
      rgba(0, 0, 0, 0.88) 56%,
      rgba(0, 0, 0, 0.44) 76%,
      transparent 92%),
    linear-gradient(94deg,
      transparent 12%,
      rgba(0, 0, 0, 0.5) 22%,
      rgba(0, 0, 0, 0.9) 32%,
      black 40%);
  -webkit-mask-composite: source-in;
          mask-composite: intersect;
  filter: brightness(0.8) contrast(1.04) saturate(0.55) sepia(0.22) hue-rotate(-6deg);
  transition: opacity 1.4s var(--ease), transform 1.4s var(--ease);
}
.slide.cover.closing.active .cover-portrait {
  opacity: 0.82;
  transform: translate(0, -50%) scale(1);
  transition-delay: 260ms;
}

/* Closing dossier: dim the iris glow so the photographic skin tones carry
   the page rather than competing with a bright amber halo. */
.slide.cover.closing .cover-iris {
  opacity: 0;
}
.slide.cover.closing.active .cover-iris {
  opacity: 0.55;
}

/* Closing dossier — title shrink + body width constraint to keep the
   body/mast/foot off the right-hand portrait. */
.slide.cover.closing .cover-title {
  font-size: clamp(72px, 11vw, 168px);
  letter-spacing: -0.042em;
}
.slide.cover.closing .cover-body {
  max-width: min(820px, 68%);
}
.slide.cover.closing .cover-mast,
.slide.cover.closing .cover-foot {
  max-width: min(900px, 74%);
}

.slide.cover > .cover-mast,
.slide.cover > .cover-body,
.slide.cover > .cover-foot {
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
.slide.cover.active > .cover-mast { opacity: 1; transform: none; transition-delay: 60ms; }
.slide.cover.active > .cover-body { opacity: 1; transform: none; transition-delay: 180ms; }
.slide.cover.active > .cover-foot { opacity: 1; transform: none; transition-delay: 320ms; }

.cover-mast {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-soft);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.cover-mast-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cover-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px var(--accent-glow);
}

.cover-mast-right {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.cover-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  padding: clamp(20px, 3.5vw, 44px) 0;
}

.cover-eyebrow {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: clamp(18px, 2vw, 32px);
  font-weight: 600;
}

.cover-title {
  font-size: clamp(140px, 19vw, 280px);
  font-weight: 900;
  line-height: 0.84;
  letter-spacing: -0.058em;
  color: var(--ink);
  margin: 0;
  text-shadow: 0 0 40px rgba(232, 226, 210, 0.04);
}

.cover-rule {
  width: 84px;
  height: 3px;
  background: var(--accent);
  margin: clamp(32px, 3.5vw, 48px) 0 clamp(24px, 2.5vw, 32px);
  border-radius: 1px;
  box-shadow: 0 0 12px var(--accent-glow);
}

.cover-thesis {
  font-size: clamp(24px, 2.3vw, 34px);
  line-height: 1.36;
  letter-spacing: -0.022em;
  font-weight: 700;
  color: var(--ink);
  max-width: 32ch;
  word-break: keep-all;
  overflow-wrap: break-word;
  margin: 0;
}

.cover-thesis mark {
  background: var(--accent-bg);
  color: var(--accent-light);
  padding: 0.04em 0.32em;
  border-radius: 4px;
  font-weight: 800;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: inset 0 0 0 1px rgba(232, 112, 58, 0.26);
}

.cover-foot {
  display: flex;
  gap: clamp(30px, 4.2vw, 68px);
  padding-top: 18px;
  border-top: 1px solid var(--line);
  align-items: flex-end;
}

.cover-col { display: flex; flex-direction: column; gap: 6px; }
.cover-col-right { margin-left: auto; }

.cover-label {
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.cover-value {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   Edit modal
   ===================================================================== */

.edit-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 50;
}
.edit-modal[hidden] { display: none; }

.edit-panel {
  width: min(900px, 100%);
  max-height: 100%;
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 1px var(--line),
    0 40px 80px -20px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.edit-title {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
}
.edit-title span { color: var(--accent-light); }

.edit-tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.edit-tab {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.edit-tab:hover { color: var(--ink); }
.edit-tab.is-active {
  background: var(--accent-bg);
  color: var(--accent-light);
  box-shadow: inset 0 0 0 1px rgba(224, 128, 58, 0.22);
}

/* Toolbar */
.edit-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.edit-toolbar.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.tb-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.tb-group > button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tb-group > button:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
.tb-group > button.is-active {
  background: var(--accent-bg);
  color: var(--accent-light);
  border-color: rgba(224, 128, 58, 0.3);
  box-shadow: inset 0 0 0 1px rgba(224, 128, 58, 0.18);
}
.tb-bold { font-weight: 900; }
.tb-italic { font-style: italic; font-family: "Georgia", serif; }
.tb-mark-icon {
  background: var(--accent-bg);
  color: var(--accent-light);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  letter-spacing: 0;
}

.tb-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}
.tb-spacer { flex: 1; }

.tb-font {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-1);
}
.tb-font > button {
  border: none;
}
.tb-font-input {
  width: 44px;
  height: 22px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 11.5px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.tb-font-input::-webkit-outer-spin-button,
.tb-font-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.tb-font-input::placeholder { color: var(--ink-faint); }
.tb-font-input:focus {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--accent);
  border-radius: 3px;
}
.tb-font-reset { font-size: 11px !important; }

/* Edit body — holds rich editor + textarea */
.edit-body {
  flex: 1;
  display: flex;
  min-height: 320px;
  background: var(--surface);
}
.edit-rich,
.edit-textarea {
  flex: 1;
  width: 100%;
  min-height: 320px;
  max-height: 60vh;
  overflow: auto;
}

.edit-textarea {
  padding: 18px 20px;
  border: none;
  resize: none;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  caret-color: var(--accent);
}
.edit-textarea::selection {
  background: var(--accent-bg-strong);
}

/* ProseMirror editor surface (rich mode) */
.edit-rich {
  padding: 22px 26px;
  background: var(--surface);
  color: var(--ink);
}
.edit-rich .pm-surface {
  outline: none;
  min-height: 280px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  caret-color: var(--accent);
}
.edit-rich .pm-surface > * + * { margin-top: 0.7em; }
.edit-rich h1 {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.022em;
  color: var(--ink);
}
.edit-rich h2 {
  font-size: 21px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.edit-rich h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.edit-rich p {
  font-size: 16px;
  color: var(--ink);
  opacity: 0.92;
}
.edit-rich ul,
.edit-rich ol {
  padding-left: 1.4em;
}
.edit-rich li {
  margin: 0.25em 0;
  font-size: 16px;
}
.edit-rich li::marker { color: var(--accent); }
.edit-rich strong { color: var(--accent-light); font-weight: 800; }
.edit-rich em { color: var(--ink-soft); font-style: italic; }
.edit-rich mark {
  background: var(--accent-bg);
  color: var(--accent-light);
  padding: 0 4px;
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.edit-rich ::selection { background: var(--accent-bg-strong); }
.edit-rich .pm-surface p.is-editor-empty:first-child::before {
  content: "내용을 입력하세요…";
  color: var(--ink-faint);
  pointer-events: none;
  height: 0;
  float: left;
}

.edit-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.edit-foot .edit-spacer { flex: 1; }

.edit-foot button {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: all 0.15s var(--ease);
}
.edit-foot button:hover {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.02);
}
.edit-foot .primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.edit-foot .primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* =====================================================================
   Serendipity thread — crimson appendix accent (우연성 설계 부록)
   Sits at the back of the deck as supporting material;
   deep-red counterpoint to the amber main arc, still warm and lantern-toned
   ===================================================================== */

:root {
  --crimson: #d96b6b;
  --crimson-light: #f0a3a3;
  --crimson-bg: rgba(217, 107, 107, 0.16);
  --crimson-rim: rgba(217, 107, 107, 0.32);
  --crimson-glow: rgba(217, 107, 107, 0.5);
}

.slide.serendipity .date {
  color: var(--crimson-light);
  /* Honor the author's chosen casing on the appendix kicker — base .date has
     `text-transform: uppercase` and 0.24em tracking, but "Additional
     Perspective: PART N · subtitle" reads better in mixed case so we relax
     both. The Korean subtitle is unaffected by transform either way. */
  text-transform: none;
  letter-spacing: 0.04em;
}
.slide.serendipity .date::before {
  background: var(--crimson);
}

.slide.serendipity:not(.cover)::before {
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(217, 107, 107, 0.30) 18%,
    rgba(217, 107, 107, 0.30) 82%,
    transparent 100%);
}

.slide.serendipity .headline mark,
.slide.serendipity .bullets li mark {
  background: var(--crimson-bg);
  color: var(--crimson-light);
  box-shadow: inset 0 0 0 1px var(--crimson-rim);
}
.slide.serendipity .headline mark {
  font-weight: 800;
}

.slide.serendipity .bullets li::before {
  background: var(--crimson);
  box-shadow: 0 0 8px var(--crimson-glow);
}

/* Pills for appendix slides 20–24: switch the entire interactive palette
   from amber to crimson so the nav surface itself signals "different
   register — Additional Perspective". */
.pill.pill-serendipity {
  color: rgba(217, 107, 107, 0.6);
}
.pill.pill-serendipity:hover {
  color: var(--crimson-light);
}
.pill.pill-serendipity:hover::after {
  background: rgba(217, 107, 107, 0.45);
}
.pill.pill-serendipity.past {
  color: rgba(217, 107, 107, 0.4);
}
.pill.pill-serendipity.past::after {
  background: rgba(217, 107, 107, 0.32);
}
.pill.pill-serendipity.active {
  color: var(--crimson-light);
}
.pill.pill-serendipity.active::after {
  background: var(--crimson);
  box-shadow: 0 0 8px var(--crimson-glow);
}

/* =====================================================================
   Responsive
   ===================================================================== */

@media (max-width: 900px) {
  body { padding: 10px; }
  .deck { width: 100%; height: calc(100vh - 20px); }
  .slide:not(.cover) {
    padding: 72px 24px 24px 64px;
    gap: 18px;
  }
  .slide:not(.cover)::before { left: 36px; top: 84px; bottom: 20px; }
  .folio { left: 20px; top: 14px; font-size: 10px; }
  .headline { font-size: 25px; line-height: 1.28; }
  .bullets li { font-size: 14.5px; padding-left: 22px; }
  .bullets li::before { left: 4px; width: 6px; height: 6px; top: 0.6em; }
  .date { font-size: 10.5px; letter-spacing: 0.2em; }
  .pills { padding: 0 20px; height: 34px; }
  .player { padding: 10px 14px 14px; gap: 10px; }
  .time { min-width: 96px; font-size: 11px; }
  .time::before { font-size: 8px; }
  .count { min-width: 40px; font-size: 10.5px; }
  .play { width: 38px; height: 38px; }
  .player-bar { padding: 5px 12px 5px 14px; gap: 10px; min-height: 32px; }
  .cover-title { font-size: clamp(88px, 22vw, 160px); }
  .cover-thesis { font-size: 22px; }
  .cover-foot { flex-wrap: wrap; gap: 20px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .slide,
  .slide > .date,
  .slide > .headline,
  .slide > .bullets > li,
  .slide:not(.cover)::before,
  .slide.cover > *,
  .ring-fill,
  .scrub-fill,
  .scrub-knob,
  .pill::before { transition: none !important; }
}
