/* ==========================================================================
   cinematography.school — styles. "Gray card and gels" system.
   Base: cool charcoal + silver-halide neutrals; accents are lighting gels.
   ========================================================================== */

:root {
  --bg: #0f1114;
  --bg-2: #13161b;
  --panel: #181c23;
  --panel-2: #1e232c;
  --line: rgba(232, 234, 240, 0.09);
  --line-strong: rgba(232, 234, 240, 0.18);
  --ink: #e8eaf0;
  --muted: #9aa4b5;
  --faint: #667080;

  /* gels */
  --straw: #e8b64c;
  --steel: #7fb4d8;
  --magenta: #c96fa8;
  --plusgreen: #a8c66c;
  --safelight: #d96459;
  --tungsten: #e59a63;
  --daylight: #9ec9e8;

  --accent: var(--straw);

  --font-ui: "Archivo", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --radius: 10px;
  --maxw: 1180px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* subtle grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h4 { margin: 1.4em 0 0.4em; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.01em; }
p { margin: 0 0 1em; }
a { color: var(--daylight); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.accent { color: var(--accent); }

::selection { background: rgba(232, 182, 76, 0.28); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--accent); color: #101216; padding: 10px 18px; font-weight: 600;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px;
  background: rgba(15, 17, 20, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffd985, var(--straw) 55%, #7a5a1d);
  box-shadow: 0 0 14px rgba(232, 182, 76, 0.55);
}
.brand-name { font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.1em; font-size: 0.82rem; }
@media (max-width: 480px) { .brand-name { font-size: 0.7rem; letter-spacing: 0.06em; } }
.site-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted); font-size: 0.86rem; font-weight: 500;
  padding: 7px 12px; border-radius: 7px;
}
.site-nav a:hover { color: var(--ink); background: var(--panel); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--accent); background: rgba(232, 182, 76, 0.08); }
.nav-toggle { display: none; }

@media (max-width: 900px) {
  .site-header { padding: 12px 16px; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px; margin-left: auto;
    background: none; border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; cursor: pointer;
  }
  .nav-toggle span { width: 18px; height: 2px; background: var(--ink); }
  .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; padding: 10px 16px 16px;
    background: rgba(15, 17, 20, 0.97); border-bottom: 1px solid var(--line);
  }
  body.nav-open .site-nav { display: flex; }
}

/* ==========================================================================
   Hero (letterboxed 2.39-ish)
   ========================================================================== */
.hero { padding: 42px 24px 20px; }
.hero-frame {
  position: relative;
  max-width: var(--maxw); margin: 0 auto;
  background:
    radial-gradient(120% 160% at 18% 0%, rgba(232, 182, 76, 0.13), transparent 45%),
    radial-gradient(100% 140% at 100% 100%, rgba(127, 180, 216, 0.10), transparent 50%),
    var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(36px, 6vw, 84px) clamp(24px, 6vw, 90px);
  overflow: hidden;
}
.hero-inner { max-width: 720px; position: relative; z-index: 2; }
.hero-art {
  position: absolute; right: clamp(6px, 3vw, 40px); bottom: 0; top: 34px;
  width: min(44%, 440px); pointer-events: none; z-index: 1;
}
.hero-art svg { width: 100%; height: 100%; }
@media (max-width: 1080px) {
  .hero-art { opacity: 0.35; width: min(60%, 380px); right: -30px; }
}
@media (max-width: 700px) { .hero-art { display: none; } }
.hero-slate { margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); letter-spacing: -0.01em; }
.hero-sub { color: var(--muted); font-size: 1.05rem; max-width: 58ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 8px; }
.hero-meta { margin-top: 26px; opacity: 0.75; }

.frame-corner {
  position: absolute; width: 26px; height: 26px;
  border: 2px solid rgba(232, 182, 76, 0.5);
}
.frame-corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.frame-corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.frame-corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.frame-corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }

.btn {
  display: inline-block; padding: 11px 22px; border-radius: 8px;
  font-weight: 600; font-size: 0.95rem; cursor: pointer;
  border: 1px solid transparent; font-family: var(--font-ui);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--straw); color: #17130a; }
.btn-primary:hover { background: #f2c766; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ==========================================================================
   Page shell for subpages
   ========================================================================== */
.page-head { max-width: var(--maxw); margin: 46px auto 8px; padding: 0 24px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.page-head .lede { color: var(--muted); max-width: 68ch; font-size: 1.02rem; }
.page-kicker { display: block; margin-bottom: 12px; }

main { min-height: 60vh; }

.section-title { font-size: 1.6rem; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.section-kicker { color: var(--accent); }

/* ==========================================================================
   Toolbar (roadmap controls) + filter bars
   ========================================================================== */
.toolbar { position: sticky; top: 57px; z-index: 50; padding: 10px 24px; background: rgba(15, 17, 20, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.toolbar-inner, .filterbar-inner { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.search-wrap { position: relative; flex: 1 1 220px; max-width: 340px; }
input[type="search"], select {
  width: 100%; padding: 9px 13px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--ink); font-family: var(--font-ui); font-size: 0.92rem;
}
input[type="search"]:focus, select:focus { outline: 2px solid rgba(232, 182, 76, 0.5); outline-offset: 1px; }
.search-clear {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 2px 7px;
}
select { width: auto; cursor: pointer; }

.tracks { display: flex; gap: 8px; flex-wrap: wrap; }
.track-chip {
  padding: 7px 15px; border-radius: 99px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-strong);
  color: var(--muted); font-size: 0.84rem; font-weight: 600; font-family: var(--font-ui);
}
.track-chip:hover { color: var(--ink); }
.track-chip[aria-pressed="true"] { background: rgba(232, 182, 76, 0.14); border-color: var(--straw); color: var(--straw); }

.focus-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.86rem; cursor: pointer; user-select: none; }
.focus-toggle input { accent-color: var(--straw); width: 15px; height: 15px; }

/* chips (topic tags, glossary links, etc.) */
.chip {
  display: inline-block; padding: 4px 12px; margin: 3px 5px 3px 0;
  border-radius: 99px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--muted);
  font-size: 0.78rem; font-weight: 500; cursor: pointer; font-family: var(--font-ui);
}
.chip:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }
.chip[aria-pressed="true"], .chip.active { background: rgba(232, 182, 76, 0.15); border-color: var(--straw); color: var(--straw); }
.chip-tool { border-color: var(--steel); color: var(--steel); }
.chip-tool:hover { border-color: var(--daylight); color: var(--daylight); }

/* ==========================================================================
   Roadmap
   ========================================================================== */
.roadmap { max-width: var(--maxw); margin: 26px auto 60px; padding: 0 24px; }

.map-section { position: relative; margin: 0 0 18px; padding: 26px 0 26px 34px; border-left: 2px solid var(--line); }
.map-section::before {
  content: ""; position: absolute; left: -7px; top: 38px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--sec-accent, var(--straw));
  box-shadow: 0 0 12px var(--sec-accent, var(--straw));
}
.map-section[data-accent="straw"] { --sec-accent: var(--straw); }
.map-section[data-accent="steel"] { --sec-accent: var(--steel); }
.map-section[data-accent="magenta"] { --sec-accent: var(--magenta); }
.map-section[data-accent="plusgreen"] { --sec-accent: var(--plusgreen); }
.map-section[data-accent="safelight"] { --sec-accent: var(--safelight); }
.map-section[data-accent="tungsten"] { --sec-accent: var(--tungsten); }
.map-section[data-accent="daylight"] { --sec-accent: var(--daylight); }

.map-section-head { margin-bottom: 16px; }
.map-section-head .section-kicker { color: var(--sec-accent, var(--straw)); }
.map-section-head h2 { font-size: 1.5rem; margin: 6px 0 4px; }
.map-section-head .section-blurb { color: var(--muted); margin: 0; max-width: 62ch; }

.map-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 12px; }

.node-card {
  position: relative; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 13px; color: var(--ink); font-family: var(--font-ui);
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.node-card:hover { border-color: var(--sec-accent, var(--straw)); transform: translateY(-2px); background: var(--panel-2); }
.node-card:focus-visible { outline: 2px solid var(--sec-accent, var(--straw)); outline-offset: 2px; }
.node-num { color: var(--sec-accent, var(--straw)); }
.node-title { display: block; font-weight: 600; font-size: 0.99rem; margin: 6px 0 4px; line-height: 1.3; }
.node-summary { display: block; color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.node-meta { display: flex; gap: 10px; margin-top: 10px; }
.node-card[data-kind="project"] { border-style: dashed; border-color: var(--line-strong); }
.node-card[data-kind="project"] .node-num::after { content: " · PROJECT"; }
.node-card[data-offtrack="true"] { opacity: 0.34; }
.node-card[data-hidden="true"] { display: none; }
.map-section[data-empty="true"] { display: none; }

.map-empty { text-align: center; color: var(--muted); padding: 60px 0; }
.map-empty button { margin-top: 10px; }

/* ==========================================================================
   Drawer (lesson / dp / breakdown detail)
   ========================================================================== */
.drawer[hidden], .drawer-overlay[hidden] { display: none; }

.drawer-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 6, 8, 0.66); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90;
  width: min(620px, 100vw);
  background: var(--bg-2); border-left: 1px solid var(--line-strong);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  animation: drawer-in 0.22s ease-out;
}
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-head { position: relative; padding: 24px 28px 14px; border-bottom: 1px solid var(--line); }
.drawer-head-meta { display: flex; gap: 16px; margin-bottom: 8px; }
.drawer-head h2 { font-size: 1.45rem; margin: 0 0 6px; padding-right: 40px; }
.drawer-summary { color: var(--muted); margin: 0; font-size: 0.95rem; }
.drawer-close {
  position: absolute; top: 16px; right: 16px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--ink); font-size: 1.25rem; line-height: 1; padding: 6px 11px; cursor: pointer;
}
.drawer-close:hover { border-color: var(--ink); }

.drawer-tabs { display: flex; gap: 2px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.drawer-tabs [role="tab"] {
  background: none; border: none; cursor: pointer;
  padding: 12px 16px; color: var(--muted); font-weight: 600; font-size: 0.9rem; font-family: var(--font-ui);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.drawer-tabs [role="tab"]:hover { color: var(--ink); }
.drawer-tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.drawer-body { flex: 1; overflow-y: auto; padding: 22px 28px 30px; font-size: 0.95rem; }
.drawer-body h4 { color: var(--accent); font-size: 0.92rem; letter-spacing: 0.04em; }
.drawer-body ul, .drawer-body ol { padding-left: 22px; margin: 0 0 1em; }
.drawer-body li { margin-bottom: 6px; }
.drawer-body .why {
  border-left: 3px solid var(--accent); background: rgba(232, 182, 76, 0.06);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin-bottom: 20px; color: var(--ink);
  font-size: 0.93rem;
}
.drawer-body .diagram-embed { margin: 20px 0; }
.drawer-body .diagram-embed .diagram-title { font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }

.drawer-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 20px; border-top: 1px solid var(--line);
}
.drawer-foot .btn { padding: 8px 16px; font-size: 0.86rem; }

.exercise-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 20px;
}
.exercise-card h4 { margin-top: 0; }
.deliverable { border-top: 1px dashed var(--line-strong); margin-top: 12px; padding-top: 12px; color: var(--muted); font-size: 0.9rem; }
.deliverable strong { color: var(--ink); }

.mistake-list li::marker { color: var(--safelight); }
.checklist-static li { list-style: none; position: relative; padding-left: 24px; }
.checklist-static li::before { content: "☐"; position: absolute; left: 0; color: var(--faint); }

.watch-film { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.watch-film:last-child { border-bottom: none; }
.watch-film .film-year { color: var(--faint); font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; padding-top: 3px; }
.watch-film .film-name { font-weight: 600; }
.watch-film .film-dp { color: var(--accent); font-size: 0.82rem; }
.watch-film .film-note { color: var(--muted); font-size: 0.87rem; margin: 2px 0 0; }

.resource-row { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.resource-row:last-child { border-bottom: none; }
.resource-type { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--line-strong); padding: 2px 7px; border-radius: 4px; white-space: nowrap; }

/* ==========================================================================
   YouTube facade
   ========================================================================== */
.yt-facade {
  position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 14px;
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: #000; border: 1px solid var(--line);
}
.yt-facade img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 0.2s, transform 0.3s; }
.yt-facade:hover img { opacity: 1; transform: scale(1.02); }
.yt-facade .yt-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(15, 17, 20, 0.82); border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center; color: var(--straw);
}
.yt-facade:hover .yt-play { background: rgba(232, 182, 76, 0.9); color: #17130a; }
.yt-facade .yt-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 14px 10px; font-size: 0.85rem; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
}
.yt-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-note { color: var(--muted); font-size: 0.85rem; margin: -6px 0 18px; }

/* ==========================================================================
   Card grids (interviews / dps / breakdowns / diagrams)
   ========================================================================== */
.card-grid {
  max-width: var(--maxw); margin: 26px auto 70px; padding: 0 24px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.count-line { max-width: var(--maxw); margin: 18px auto 0; padding: 0 24px; color: var(--faint); }

.card {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 20px 16px;
  transition: border-color 0.18s, transform 0.18s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.card h3 { font-size: 1.12rem; margin: 8px 0 6px; }
.card .card-note { color: var(--muted); font-size: 0.88rem; }
.card-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 2px; }

.series-badge {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--muted);
}
.badge-audio { color: var(--tungsten); border-color: rgba(229, 154, 99, 0.5); }
.badge-video { color: var(--steel); border-color: rgba(127, 180, 216, 0.5); }

.card-dps { font-size: 0.85rem; color: var(--accent); margin: 0 0 6px; }
.card-dps a { color: inherit; }
.card-films { color: var(--faint); font-size: 0.8rem; font-style: italic; }
.card-actions { margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.card .chip { font-size: 0.72rem; padding: 3px 10px; }

/* clickable whole-card pattern */
.card-button { cursor: pointer; text-align: left; color: var(--ink); font-family: var(--font-ui); width: 100%; }
.card-button:focus-visible { outline: 2px solid var(--straw); outline-offset: 2px; }

/* DP slate cards */
.dp-card { border-top: 3px solid var(--dp-accent, var(--straw)); }
.dp-card[data-accent="straw"] { --dp-accent: var(--straw); }
.dp-card[data-accent="steel"] { --dp-accent: var(--steel); }
.dp-card[data-accent="magenta"] { --dp-accent: var(--magenta); }
.dp-card[data-accent="plusgreen"] { --dp-accent: var(--plusgreen); }
.dp-card[data-accent="safelight"] { --dp-accent: var(--safelight); }
.dp-card[data-accent="tungsten"] { --dp-accent: var(--tungsten); }
.dp-card[data-accent="daylight"] { --dp-accent: var(--daylight); }
.dp-card h3 { font-size: 1.3rem; }
.dp-era { color: var(--faint); font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.08em; }
.dp-sig { color: var(--muted); font-size: 0.87rem; margin-top: 8px; }

.dp-films-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 8px 0 18px; }
.dp-films-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.dp-films-table .y { color: var(--faint); font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.dp-films-table .d { color: var(--muted); }

/* breakdown moments */
.moment-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.moment-row:last-child { border-bottom: none; }
.moment-t { font-family: var(--font-mono); color: var(--straw); font-size: 0.8rem; white-space: nowrap; }

/* ==========================================================================
   Lighting diagrams
   ========================================================================== */
.diagram-card { padding: 20px; }
.diagram-card h3 { margin-top: 0; }
.diagram-card .diagram-context { color: var(--muted); font-size: 0.88rem; margin-bottom: 12px; }
.diagram-svg-wrap { background: #0b0d10; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.diagram-svg-wrap svg { display: block; width: 100%; height: auto; }
.diagram-notes { margin: 14px 0 0; padding-left: 20px; color: var(--muted); font-size: 0.88rem; }
.diagram-notes li { margin-bottom: 5px; }
.diagram-specs { display: flex; gap: 18px; margin-top: 12px; }
.diagram-refs {
  display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: baseline;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 0.84rem;
}
.diagram-refs a::after { content: " ↗"; color: var(--faint); font-size: 0.75em; }

.yt-link {
  display: flex; align-items: center; gap: 14px;
  margin-top: 14px; padding: 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); font-weight: 600; font-size: 0.88rem; line-height: 1.35;
}
.yt-link:hover { text-decoration: none; border-color: var(--straw); }
.yt-link-thumb { position: relative; flex: 0 0 128px; }
.yt-link-thumb img { display: block; width: 128px; height: 72px; object-fit: cover; border-radius: 6px; }
.yt-link-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%; font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 17, 20, 0.85); color: var(--straw); border: 1px solid rgba(255, 255, 255, 0.3);
}
.yt-link:hover .yt-link-play { background: var(--straw); color: #17130a; }
.yt-link-text { min-width: 0; }
.yt-link-sub { display: block; margin-top: 4px; }

/* ==========================================================================
   Tools page
   ========================================================================== */
.tool-panel {
  max-width: var(--maxw); margin: 30px auto; padding: 26px 26px 30px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  scroll-margin-top: 120px;
}
.tool-panel > h2 { font-size: 1.45rem; }
.tool-panel .tool-lede { color: var(--muted); max-width: 70ch; }
.tool-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 30px; margin-top: 18px; }
@media (max-width: 800px) { .tool-layout { grid-template-columns: 1fr; } }

.controls { display: flex; flex-direction: column; gap: 16px; }
.control label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.88rem; font-weight: 600; margin-bottom: 6px; }
.control output { font-family: var(--font-mono); font-size: 0.8rem; color: var(--straw); font-weight: 400; }
.control input[type="range"] { width: 100%; accent-color: var(--straw); }
.control select { width: 100%; }
.control .seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 7px 0; background: var(--bg-2); color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 7px; cursor: pointer; font-family: var(--font-ui); font-weight: 600; font-size: 0.84rem;
}
.seg button[aria-pressed="true"] { background: rgba(232, 182, 76, 0.14); border-color: var(--straw); color: var(--straw); }

.tool-visual { min-width: 0; }
.tool-visual svg { display: block; width: 100%; height: auto; background: #0b0d10; border: 1px solid var(--line); border-radius: 8px; }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-top: 14px; }
.readout { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.readout .r-label { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.readout .r-value { font-size: 1.15rem; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.readout .r-value.warn { color: var(--safelight); }
.tool-callout { margin-top: 14px; border-left: 3px solid var(--steel); background: rgba(127, 180, 216, 0.06); padding: 10px 16px; border-radius: 0 8px 8px 0; color: var(--muted); font-size: 0.9rem; }

/* ==========================================================================
   Glossary
   ========================================================================== */
.glossary-wrap { max-width: 880px; margin: 26px auto 80px; padding: 0 24px; }
.alpha-rail { display: flex; flex-wrap: wrap; gap: 4px; margin: 16px 0; }
.alpha-rail button {
  min-width: 30px; padding: 5px 0; background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; cursor: pointer;
}
.alpha-rail button:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.alpha-rail button:disabled { opacity: 0.25; cursor: default; }

.term-entry { padding: 16px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 130px; }
.term-entry dt { display: flex; align-items: baseline; gap: 12px; font-weight: 600; font-size: 1.05rem; }
.term-entry dt .term-cat { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--line-strong); padding: 2px 8px; border-radius: 4px; }
.term-entry dd { margin: 6px 0 0; color: var(--muted); font-size: 0.94rem; }
.term-entry .also { margin-top: 6px; }
.term-entry.flash { animation: term-flash 1.6s ease-out; }
@keyframes term-flash { 0% { background: rgba(232, 182, 76, 0.18); } 100% { background: transparent; } }

/* ==========================================================================
   FAQ + About + Footer
   ========================================================================== */
.faq-section, .about { max-width: 880px; margin: 60px auto; padding: 0 24px; }
.faq-list details {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 0 20px; margin-bottom: 10px;
}
.faq-list summary { cursor: pointer; font-weight: 600; padding: 15px 0; list-style: none; position: relative; padding-right: 30px; }
.faq-list summary::after { content: "+"; position: absolute; right: 4px; top: 12px; color: var(--straw); font-size: 1.2rem; }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details p { color: var(--muted); padding-bottom: 16px; margin: 0; }
.about-body { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 30px 24px 40px; text-align: center; margin-top: 40px; }
.site-footer .mono a { color: var(--muted); }
.footer-fine { color: var(--faint); font-size: 0.8rem; max-width: 60ch; margin: 10px auto 0; }

.sr-announcer {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* empty states */
.empty-state { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state .btn { margin-top: 12px; }

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  body::before { display: none; }
  .site-header, .toolbar, .hero-actions, .drawer, .drawer-overlay, .nav-toggle, .site-footer { display: none !important; }
  body { background: #fff; color: #111; }
  .node-card, .card { border-color: #ccc; background: #fff; color: #111; }
  .node-summary, .card-note { color: #444; }
  a { color: #111; }
}
