/* TIME CYCLE MASTERY - Design system ported from tracker (Forge grammar) */
:root {
  --fg: #16181D; --fg-muted: #585E6A; --fg-soft: #8B919D;
  --border: #DDE0E5; --border-strong: #C2C7CF;
  --surface: #E9EBEE; --ink: #F4F5F7; --elevated: #E1E4E9;
  --gold: #0284C7; --gold-deep: #075985; --gold-soft: #38BDF8;
  --ember: #F97316;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: system-ui, -apple-system, 'Helvetica Neue', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fg: #E8EAEE; --fg-muted: #9AA1AC; --fg-soft: #5F6672;
    --border: #262A32; --border-strong: #3A404B;
    --surface: #191C22; --ink: #101318; --elevated: #21252D;
    --gold: #38BDF8; --gold-deep: #0284C7; --gold-soft: #7DD3FC;
  }
}
:root[data-theme="dark"] {
  --fg: #E8EAEE; --fg-muted: #9AA1AC; --fg-soft: #5F6672;
  --border: #262A32; --border-strong: #3A404B;
  --surface: #191C22; --ink: #101318; --elevated: #21252D;
  --gold: #38BDF8; --gold-deep: #0284C7; --gold-soft: #7DD3FC;
}
:root[data-theme="light"] {
  --fg: #16181D; --fg-muted: #585E6A; --fg-soft: #8B919D;
  --border: #DDE0E5; --border-strong: #C2C7CF;
  --surface: #E9EBEE; --ink: #F4F5F7; --elevated: #E1E4E9;
  --gold: #0284C7; --gold-deep: #075985; --gold-soft: #38BDF8;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; font-family: var(--sans); color: var(--fg);
  background: var(--ink); -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }

/* Scroll progress */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--gold); z-index: 400; pointer-events: none;
  transition: width 0.1s linear;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 300;
  background: var(--ink); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px; height: 52px; gap: 8px;
}
.nav-logo {
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; font-weight: 800; color: var(--fg);
  text-decoration: none; margin-right: auto; white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; color: var(--gold); }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 700; color: var(--fg-muted);
  padding: 6px 10px; text-decoration: none; transition: color .15s;
  position: relative;
}
.nav-link:hover { color: var(--fg); text-decoration: none; }
.nav-link.active { color: var(--gold); }
.nav-link.active::after {
  content: ''; position: absolute; bottom: -1px; left: 10px; right: 10px;
  height: 2px; background: var(--gold);
}
.nav-progress {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  color: var(--gold); font-weight: 800; font-variant-numeric: tabular-nums;
  margin-left: 12px; white-space: nowrap;
}
.theme-toggle {
  background: none; border: 1px solid var(--border-strong);
  color: var(--fg-muted); padding: 5px 8px; font-size: 13px;
  transition: border-color .15s, color .15s; margin-left: 8px;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--gold); color: var(--gold); }

/* Mobile nav */
@media (max-width: 640px) {
  .nav { display: none; }
  .mobile-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
    background: var(--ink); border-top: 1px solid var(--border);
    display: flex; height: 56px;
  }
  .mobile-nav-link {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; color: var(--fg-muted);
    text-decoration: none; font-family: var(--mono); font-size: 8px;
    letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
    transition: color .15s;
  }
  .mobile-nav-link.active { color: var(--gold); }
  .mobile-nav-icon { font-size: 16px; line-height: 1; }
  body { padding-bottom: 64px; }
}
@media (min-width: 641px) { .mobile-nav { display: none; } }

/* Page container */
.wrap { max-width: 920px; margin: 0 auto; padding: 48px 24px 72px; }
@media (max-width: 640px) { .wrap { padding: 28px 16px 20px; } }

/* Typography */
.fm-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--gold); font-weight: 700;
  margin-bottom: 12px; display: block;
}
h1 {
  font-weight: 900; font-size: clamp(36px, 6vw, 64px);
  letter-spacing: -.04em; line-height: .95; margin: 0 0 16px;
}
h1 em { font-style: italic; font-weight: 500; color: var(--gold); }
h2 { font-weight: 900; font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -.03em; line-height: 1.05; margin: 0 0 8px; }
h3 { font-weight: 700; font-size: 18px; margin: 0 0 6px; }
.lede { color: var(--fg-muted); font-size: 17px; line-height: 1.6;
  max-width: 58ch; margin: 0 0 8px; }
.lede strong { color: var(--fg); font-weight: 700; }

/* Proof strip */
.fm-proof {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
  margin: 40px 0 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.fm-proof-item { padding: 22px 16px; border-right: 1px solid var(--border); }
.fm-proof-item:last-child { border-right: none; }
.fm-proof-num {
  font-weight: 900; font-size: 44px; letter-spacing: -.04em; line-height: 1;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.fm-proof-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--fg-muted); font-weight: 700;
  margin-top: 8px; line-height: 1.5;
}
@media (max-width: 640px) {
  .fm-proof { grid-template-columns: repeat(2, 1fr); }
  .fm-proof-item:nth-child(2) { border-right: none; }
  .fm-proof-num { font-size: 36px; }
}

/* Global progress bar */
.progress { margin: 24px 0 48px; }
.progress .track {
  height: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); position: relative;
}
.progress .fill {
  position: absolute; inset: 0; width: 0%; background: var(--gold);
  transition: width .5s var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  .progress .fill { transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Module cards on dashboard */
.module-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 32px 0;
}
@media (max-width: 768px) { .module-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .module-grid { grid-template-columns: 1fr; } }

.module-card {
  border: 1px solid var(--border-strong); background: var(--ink);
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: var(--fg); transition: background .15s;
  position: relative; overflow: hidden;
}
.module-card:hover { background: var(--elevated); text-decoration: none; }
.module-card.complete { box-shadow: inset 3px 0 0 var(--gold); }
.module-card-wk {
  font-family: var(--mono); font-size: 9px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold); font-weight: 800;
}
.module-card-title { font-weight: 900; font-size: 16px; letter-spacing: -.02em; }
.module-card-sub { font-size: 12px; color: var(--fg-muted); line-height: 1.4; }
.module-ring-wrap { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.module-ring { width: 32px; height: 32px; flex-shrink: 0; }
.module-pct {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums;
}

/* "Continue" card */
.continue-card {
  border: 1px solid var(--gold); background: rgba(2,132,199,.06);
  padding: 20px 24px; margin: 32px 0; display: flex;
  align-items: center; justify-content: space-between; gap: 16px;
}
.continue-card .label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold); font-weight: 800;
  margin-bottom: 6px;
}
.continue-card .task-name { font-weight: 700; font-size: 15px; }
.continue-card .task-mod { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.continue-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 800; color: #fff;
  background: var(--gold); border: none; padding: 10px 16px;
  text-decoration: none; white-space: nowrap; transition: opacity .15s;
}
.continue-btn:hover { opacity: .85; text-decoration: none; }

/* Mastery panel */
.mastery {
  margin-top: 48px; padding: 32px 28px; background: var(--surface);
  border: 1px solid var(--border-strong);
}
.mastery.won { box-shadow: inset 0 0 0 2px var(--gold); }
.mastery .big {
  font-weight: 900; font-size: clamp(20px, 3.5vw, 28px);
  letter-spacing: -.03em; line-height: 1.1; margin: 0 0 10px;
}
.mastery p { color: var(--fg-muted); margin: 0; max-width: 56ch; }
.mastery p strong { color: var(--fg); }

/* Learn page: expandable week sections */
.week {
  border: 1px solid var(--border-strong); margin-bottom: -1px;
  background: var(--ink);
}
.week.complete { box-shadow: inset 3px 0 0 var(--gold); }
.whead {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  cursor: pointer; user-select: none; transition: background .15s;
}
.whead:hover { background: var(--elevated); }
.whead:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.wk {
  font-family: var(--mono); font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--gold); font-weight: 800;
  white-space: nowrap;
}
.week.complete .wk { color: var(--fg-soft); }
.wtitle { flex: 1; min-width: 0; }
.wtitle .t {
  font-weight: 900; font-size: 20px; letter-spacing: -.025em; line-height: 1.05;
}
.week.complete .wtitle .t {
  color: var(--fg-soft); text-decoration: line-through;
  text-decoration-color: var(--gold); text-decoration-thickness: 2px;
}
.wtitle .s { font-size: 13px; color: var(--fg-muted); margin-top: 3px; }
.wcount {
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  color: var(--fg-muted); font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.week.complete .wcount { color: var(--gold); }
.chev {
  color: var(--fg-soft); font-size: 10px;
  transition: transform .2s var(--ease);
}
.week.open .chev { transform: rotate(90deg); }
.wbody { display: none; border-top: 1px solid var(--border); }
.week.open .wbody { display: block; }

/* Media player area */
.media-wrap {
  background: #000; position: relative;
}
video, audio.styled {
  width: 100%; display: block;
}
.audio-wrap {
  background: var(--surface); padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.audio-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--fg-muted); font-weight: 700;
  margin-bottom: 8px;
}
audio { width: 100%; }

/* Speed control */
.speed-row {
  display: flex; gap: 6px; align-items: center; padding: 8px 12px;
  background: var(--elevated); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.speed-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--fg-muted); font-weight: 700;
  margin-right: 4px;
}
.speed-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  font-weight: 700; border: 1px solid var(--border-strong);
  background: var(--ink); color: var(--fg-muted);
  padding: 3px 8px; transition: all .12s;
}
.speed-btn:hover, .speed-btn.active {
  border-color: var(--gold); color: var(--gold); background: rgba(2,132,199,.06);
}

/* Key ideas strip */
.key-ideas {
  padding: 16px 24px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.key-ideas .ki-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold); font-weight: 700;
  margin-bottom: 8px;
}
.key-ideas ul { margin: 0; padding: 0 0 0 16px; }
.key-ideas li {
  font-size: 13px; color: var(--fg-muted); margin-bottom: 4px;
  line-height: 1.4;
}
.key-ideas li strong { color: var(--fg); }

/* Task list */
.task-list { padding: 12px 24px 20px; }
.sources-row {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 700; color: var(--fg-muted);
  border: 1px dashed var(--border-strong); padding: 8px 12px;
  margin-bottom: 12px;
}
.sources-row b { color: var(--gold); }
label.task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 10px 8px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
label.task:last-child { border-bottom: none; }
label.task:hover { background: var(--elevated); }
label.task input[type="checkbox"] {
  appearance: none; width: 20px; height: 20px;
  border: 2px solid var(--border-strong); background: var(--surface);
  margin: 2px 0 0; flex-shrink: 0; cursor: pointer; position: relative;
  transition: all .12s;
}
label.task input:checked { background: var(--gold); border-color: var(--gold); }
label.task input:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
label.task input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.task .tx { flex: 1; font-size: 14px; line-height: 1.5; }
.task input:checked ~ .tx { color: var(--fg-soft); }
.task input:checked ~ .tx .main {
  text-decoration: line-through; text-decoration-color: var(--gold);
}
.kind {
  font-family: var(--mono); font-size: 9px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 800; padding: 3px 7px;
  margin-right: 8px; white-space: nowrap; vertical-align: 2px;
  display: inline-block;
}
.k-video { background: var(--gold); color: #fff; }
.k-audio { background: var(--fg); color: var(--ink); }
.k-study { border: 1px solid var(--border-strong); color: var(--fg-muted); }
.k-do { border: 1px solid var(--ember); color: var(--ember); }
.stpill {
  font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 800; padding: 2px 6px;
  vertical-align: 2px; display: inline-block;
}
.st-ready { color: var(--gold); border: 1px solid var(--gold); }
.prompt { font-size: 12px; color: var(--fg-muted); font-style: italic; margin-top: 3px; }

/* Inline deck toggle (learn page) */
.task-row { border-bottom: 1px solid var(--border); }
.task-row label.task { border-bottom: none; }
.deck-toggle {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left; font-size: 14px; line-height: 1.5;
  display: inline; text-decoration: underline; text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.deck-toggle:hover { color: var(--gold); }
.deck-toggle-arrow {
  font-size: 9px; display: inline-block; transition: transform .2s;
  margin-left: 4px; vertical-align: 1px;
}
.deck-toggle.open .deck-toggle-arrow { transform: rotate(90deg); }
.deck-panel {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 0 24px; margin: 0 -24px;
}

/* Ratio Lab */
.ratio-layout { display: grid; grid-template-columns: 200px 1fr; gap: 0; }
@media (max-width: 720px) { .ratio-layout { grid-template-columns: 1fr; } }
.ratio-rail {
  border-right: 1px solid var(--border); padding: 24px 16px;
  position: sticky; top: 52px; height: calc(100vh - 52px); overflow-y: auto;
}
@media (max-width: 720px) {
  .ratio-rail { position: static; height: auto; border-right: none;
    border-bottom: 1px solid var(--border); padding: 16px; }
}
.ratio-rail-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; background: none; border: none; text-align: left;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 700; color: var(--fg-muted);
  cursor: pointer; transition: color .12s; border-left: 2px solid transparent;
}
.ratio-rail-btn:hover { color: var(--fg); }
.ratio-rail-btn.active { color: var(--gold); border-left-color: var(--gold); }
.ratio-content { padding: 32px 40px; }
@media (max-width: 720px) { .ratio-content { padding: 24px 16px; } }

/* Report rendering */
.report-body { max-width: 65ch; line-height: 1.7; }
.report-body h1 { font-size: 28px; margin-bottom: 16px; }
.report-body h2 { font-size: 22px; margin: 28px 0 10px; }
.report-body h3 { font-size: 18px; margin: 20px 0 8px; }
.report-body p { margin: 0 0 14px; color: var(--fg-muted); }
.report-body p strong, .report-body li strong { color: var(--fg); }
.report-body ul, .report-body ol { padding-left: 20px; margin: 0 0 14px; }
.report-body li { color: var(--fg-muted); margin-bottom: 5px; line-height: 1.5; }
.report-body hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.report-body code {
  font-family: var(--mono); font-size: 12px; background: var(--surface);
  padding: 2px 5px; border: 1px solid var(--border);
}
.img-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; font-weight: 700; color: var(--gold);
  background: rgba(2,132,199,.06); border: 1px solid var(--gold);
  padding: 2px 8px; margin: 2px 0;
}

/* Quiz engine */
.quiz-wrap { max-width: 640px; }
.quiz-question { font-weight: 700; font-size: 18px; line-height: 1.5; margin-bottom: 20px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.quiz-opt {
  padding: 14px 16px; border: 1px solid var(--border-strong);
  background: var(--ink); text-align: left; font-size: 15px;
  color: var(--fg); cursor: pointer; transition: all .12s; line-height: 1.4;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--gold); background: var(--elevated); }
.quiz-opt:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.quiz-opt.correct { border-color: #22c55e; background: rgba(34,197,94,.08); color: #22c55e; }
.quiz-opt.wrong { border-color: var(--ember); background: rgba(249,115,22,.08); color: var(--ember); }
.quiz-opt:disabled { cursor: default; }
.quiz-rationale {
  padding: 12px 16px; background: var(--surface);
  border-left: 3px solid var(--gold); font-size: 14px;
  color: var(--fg-muted); margin-bottom: 16px; display: none; line-height: 1.5;
}
.quiz-rationale.show { display: block; }
.quiz-rationale strong { color: var(--fg); }
.quiz-nav {
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin-top: 8px;
}
.quiz-progress-text {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em;
  color: var(--fg-muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.quiz-score {
  font-family: var(--mono); font-size: 36px; font-weight: 900;
  color: var(--gold); font-variant-numeric: tabular-nums;
  letter-spacing: -.03em; margin: 12px 0;
}
.btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 800; border: 1px solid var(--border-strong);
  background: var(--ink); color: var(--fg-muted); padding: 10px 16px;
  transition: all .15s; cursor: pointer;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.primary:hover { opacity: .85; }

/* Flashcards */
.cards-wrap { max-width: 560px; }
.card-counter {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  color: var(--fg-muted); font-weight: 700; margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.card-scene { perspective: 1000px; height: 200px; cursor: pointer; margin-bottom: 16px; }
.card-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .4s var(--ease); transform-style: preserve-3d;
}
.card-scene.flipped .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border: 1px solid var(--border-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.card-back { transform: rotateY(180deg); background: var(--elevated); }
.card-face-label {
  position: absolute; top: 10px; left: 14px;
  font-family: var(--mono); font-size: 8px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--fg-soft); font-weight: 700;
}
.card-text { font-size: 16px; font-weight: 600; line-height: 1.5; }
.card-hint {
  font-size: 12px; color: var(--fg-muted); text-align: center; margin-bottom: 12px;
  font-family: var(--mono); letter-spacing: .08em;
}
.grade-row { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.grade-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 800; padding: 8px 16px;
  border: 1px solid var(--border-strong); background: var(--ink);
  cursor: pointer; transition: all .12s; color: var(--fg-muted);
}
.grade-btn.again:hover { border-color: var(--ember); color: var(--ember); }
.grade-btn.good:hover { border-color: var(--gold); color: var(--gold); }
.grade-btn.easy:hover { border-color: #22c55e; color: #22c55e; }
.grade-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Library */
.pdf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
@media (max-width: 640px) { .pdf-grid { grid-template-columns: 1fr 1fr; } }
.pdf-card {
  border: 1px solid var(--border-strong); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 6px;
  text-decoration: none; color: var(--fg); transition: background .12s;
}
.pdf-card:hover { background: var(--elevated); text-decoration: none; }
.pdf-card-wk {
  font-family: var(--mono); font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold); font-weight: 800;
}
.pdf-card-title { font-weight: 700; font-size: 14px; }
.pdf-card-icon { font-size: 20px; margin-bottom: 4px; }

.img-gallery {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 16px 0;
}
@media (max-width: 640px) { .img-gallery { grid-template-columns: repeat(2, 1fr); } }
.gallery-item { cursor: pointer; position: relative; overflow: hidden; }
.gallery-item img { width: 100%; height: 100px; object-fit: cover; display: block; transition: opacity .15s; }
.gallery-item:hover img { opacity: .85; }
.gallery-caption {
  font-family: var(--mono); font-size: 8px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-muted); padding: 4px 0;
  line-height: 1.3;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  z-index: 500; display: none; align-items: center;
  justify-content: center; padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; font-weight: 800; color: #fff;
  background: none; border: 1px solid rgba(255,255,255,.3);
  padding: 6px 12px; cursor: pointer;
}

/* External links section */
.link-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.ext-link {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid var(--border-strong); background: var(--ink);
  text-decoration: none; color: var(--fg); transition: background .12s;
}
.ext-link:hover { background: var(--elevated); text-decoration: none; }
.ext-link-icon { font-size: 16px; flex-shrink: 0; }
.ext-link-text { flex: 1; }
.ext-link-title { font-weight: 700; font-size: 14px; }
.ext-link-url {
  font-family: var(--mono); font-size: 10px; color: var(--fg-muted);
  letter-spacing: .04em;
}
.ext-link-arr { color: var(--fg-soft); font-size: 12px; }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--fg-muted);
  border: 1px dashed var(--border-strong);
}
.empty-state .emoji { font-size: 36px; margin-bottom: 12px; }
.empty-state p { margin: 0; font-size: 14px; }

/* Font size FAB */
.font-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 400;
  display: flex; flex-direction: column; border: 1px solid var(--border-strong);
  background: var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,.18);
  zoom: calc(1 / var(--tcm-zoom, 1)); /* keep FAB constant size while page zooms */
}
.font-fab button {
  width: 44px; height: 40px; background: none; border: none;
  color: var(--fg); font-family: var(--mono); font-weight: 800;
  border-bottom: 1px solid var(--border);
}
.font-fab button:last-child { border-bottom: none; }
.font-fab button:hover { color: var(--gold); background: var(--elevated); }
.font-fab button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.font-fab .fab-plus { font-size: 17px; }
.font-fab .fab-minus { font-size: 12px; }
@media (max-width: 640px) { .font-fab { bottom: 72px; } } /* clear mobile nav */
