/* =========================================================
   Decode Computing — Design Tokens
   Concept: a well-kept lecture notebook meets a syntax editor.
   Paper (cool, not cream) + graphite ink + indigo accent for
   navigation, amber "highlighter" accent for marks/emphasis.
   Signature: the hero previews the Test module — a live-look
   exam question card — since sitting a timed paper with a
   real report afterward is the site's main differentiator.
   ========================================================= */

:root {
  /* --- color: light (default) --- */
  --paper: #FAFAF8;
  --paper-dim: #F1EFE8;
  --paper-raised: #FFFFFF;
  --ink: #1B1F2A;
  --ink-soft: #5B6072;
  --ink-faint: #8A8F9F;
  --line: #E3E0D7;
  --line-strong: #CFCBBE;

  --accent: #4740D4;
  --accent-ink: #FFFFFF;
  --accent-soft: #EEEDFB;

  --highlight: #FFC53D;
  --highlight-ink: #2B2100;

  --good: #2F9E44;
  --good-soft: #E9F7EC;
  --bad: #D6484A;
  --bad-soft: #FBEAEA;

  /* --- type --- */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  /* --- scale --- */
  --content-w: 860px;
  --wide-w: 1160px;
  --radius: 10px;
  --radius-sm: 6px;

  --shadow-card: 0 1px 2px rgba(27, 31, 42, 0.04);

  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #13151C;
  --paper-dim: #191C26;
  --paper-raised: #1D202B;
  --ink: #ECEDF3;
  --ink-soft: #A2A7B8;
  --ink-faint: #6B7086;
  --line: #2A2D3A;
  --line-strong: #383C4C;

  --accent: #9291FF;
  --accent-ink: #14152B;
  --accent-soft: #21223A;

  --highlight: #FFD166;
  --highlight-ink: #2B2100;

  --good: #52C97A;
  --good-soft: #17281C;
  --bad: #F0787A;
  --bad-soft: #2C1A1B;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* --- reset --- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 5%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
p { margin: 0 0 1em; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

.wrap {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 28px;
}
.wrap--read {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 0 28px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

/* --- notebook perforation divider --- */
.perforation {
  height: 1px;
  background-image: repeating-linear-gradient(
    to right,
    var(--line-strong) 0, var(--line-strong) 4px,
    transparent 4px, transparent 12px
  );
  margin: 0;
}

/* --- highlighter mark --- */
mark.hl {
  background: none;
  color: inherit;
  position: relative;
  white-space: nowrap;
}
mark.hl::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px; bottom: 0.06em;
  height: 0.34em;
  background: var(--highlight);
  z-index: -1;
  border-radius: 2px 4px 2px 4px;
  opacity: 0.85;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  transform: rotate(-4deg);
}
.logo .by {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  font-weight: 400;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 8px;
}
.main-nav a {
  font-size: 14.5px;
  color: var(--ink-soft);
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.main-nav a:hover { color: var(--ink); border-color: var(--line-strong); }
.main-nav a.active { color: var(--ink); border-color: var(--accent); }

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  width: 220px;
  transition: width 0.2s ease, border-color 0.2s ease;
}
.search-box:focus-within {
  width: 280px;
  border-color: var(--accent);
}
.search-box input {
  border: 0;
  background: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}
.search-box svg { flex: none; color: var(--ink-faint); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink-soft);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

.hamburger { display: none; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent);
}
.btn-secondary {
  background: var(--paper-raised);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: none;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--line-strong); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* =========================================================
   Hero (Test-module preview signature)
   ========================================================= */
.hero {
  padding: 64px 0 40px;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(34px, 4.4vw, 54px);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.hero .lede {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 44ch;
  margin-bottom: 30px;
}
.hero .lede em {
  font-style: italic;
  color: var(--ink);
}
.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}
.hero-stats {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
}
.hero-stats b {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  font-weight: 700;
}

/* --- hero mock: a small preview of the Test UI --- */
.book-stage {
  perspective: 1800px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  min-height: 340px;
}
.book-stage::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 68%);
  opacity: 0.9;
  z-index: 0;
  border-radius: 50%;
}
.hero-mock {
  position: relative;
  z-index: 1;
  width: 360px;
  max-width: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 24px 60px color-mix(in srgb, var(--ink) 12%, transparent);
  transform: rotate(-1.4deg);
}
.hero-mock-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.hero-mock-q { font-family: var(--font-body); font-size: 16px; font-weight: 600; line-height: 1.5; margin-bottom: 18px; }
.hero-mock-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.hero-mock-foot {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint);
  padding-top: 14px; border-top: 1px dashed var(--line);
}
.hero-mock-foot b { color: var(--accent); }

/* =========================================================
   Section scaffolding
   ========================================================= */
.section { padding: 68px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}
.section-head h2 { font-size: 27px; letter-spacing: -0.01em; }
.section-head .see-all { font-size: 14px; color: var(--accent); font-family: var(--font-mono); }

/* =========================================================
   Subject grid
   ========================================================= */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.subject-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--paper-raised);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow .18s ease;
}
.subject-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 22px 22px 0;
  border-color: transparent var(--paper-dim) transparent transparent;
  transition: border-color 0.18s ease;
}
.subject-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 8%, transparent);
}
.subject-card:hover::after {
  border-color: transparent var(--accent-soft) transparent transparent;
}
.subject-card .abbr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.subject-card h3 {
  font-size: 18px;
  margin: 10px 0 8px;
}
.subject-card .meta {
  font-size: 13px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

/* =========================================================
   Topic cards (home / subject listings)
   ========================================================= */
.topic-row { display: flex; flex-direction: column; gap: 14px; }
.topic-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 20px 22px 20px 25px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.topic-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.18s ease;
}
.topic-card:hover {
  border-color: var(--line-strong);
  transform: translateX(2px);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--ink) 6%, transparent);
}
.topic-card:hover::before { background: var(--accent); }
.topic-unit {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  white-space: nowrap;
}
.topic-card h3 { font-size: 17px; margin-bottom: 5px; }
.topic-card .snippet {
  font-size: 14px;
  color: var(--ink-soft);
  font-family: var(--font-body);
  max-width: 60ch;
}
.topic-card .tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper-dim);
  border-radius: 5px;
  padding: 3px 8px;
}
.includes {
  display: flex;
  gap: 8px;
}
.includes .chip {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: var(--paper-dim);
  color: var(--ink-faint);
  border: 1px solid var(--line);
}
.includes .chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* =========================================================
   Value props
   ========================================================= */
.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.value-card { padding: 4px; }
.value-card .num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
}
.value-card h3 { font-size: 19px; margin: 8px 0 10px; }
.value-card p { color: var(--ink-soft); font-size: 15px; }

/* =========================================================
   Breadcrumb
   ========================================================= */
.crumbs {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 20px 0 0;
}
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--accent); }

/* =========================================================
   Subject page
   ========================================================= */
.subject-hero { padding: 20px 0 40px; border-bottom: 1px solid var(--line); }
.subject-hero .abbr-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 14px;
}
.subject-hero h1 { font-size: 38px; margin-bottom: 12px; }
.subject-hero .desc { color: var(--ink-soft); max-width: 68ch; font-size: 16px; }
.subject-hero .stats { display: flex; gap: 26px; margin-top: 22px; font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }

.unit-group { margin-bottom: 36px; }
.unit-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-left: 2px;
}

/* =========================================================
   Topic page
   ========================================================= */
.topic-page { padding-bottom: 64px; }
.topic-header { padding: 22px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.topic-header .badges { display: flex; gap: 8px; margin-bottom: 14px; }
.badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 5px;
  background: var(--paper-dim);
  color: var(--ink-soft);
}
.badge.unit { background: var(--accent-soft); color: var(--accent); }
.topic-header h1 { font-size: 36px; margin-bottom: 10px; }
.topic-header .updated { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); }

.topic-desc {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--ink);
  max-width: 72ch;
  margin-bottom: 30px;
}
.topic-desc::first-letter {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 700;
  float: left;
  line-height: 0.8;
  padding: 6px 8px 0 0;
  color: var(--accent);
}

.action-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 40px;
}
.action-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--paper-raised);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--ink) 7%, transparent);
  border-color: var(--line-strong);
}
.action-card.primary:hover { box-shadow: 0 10px 26px color-mix(in srgb, var(--ink) 30%, transparent); }
.action-card .icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.action-card h3 { font-size: 15.5px; font-family: var(--font-display); }
.action-card p { font-size: 13px; color: var(--ink-faint); margin-bottom: 4px; font-family: var(--font-mono); }
.action-card.primary { background: var(--ink); border-color: var(--ink); }
.action-card.primary .icon { background: var(--accent); color: var(--accent-ink); }
.action-card.primary h3, .action-card.primary p { color: var(--paper); }
.action-card.primary p { color: color-mix(in srgb, var(--paper) 60%, transparent); }

.ad-slot {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  margin-bottom: 40px;
}

.resource-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 40px; }
.resource-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.resource-item:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
.resource-item:hover svg { color: var(--accent); }
.resource-item svg { flex: none; color: var(--ink-faint); transition: color .18s ease; }

.quiz-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  background: var(--paper-dim);
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.quiz-cta h3 { font-size: 19px; margin-bottom: 6px; }
.quiz-cta p { color: var(--ink-soft); font-size: 14px; margin: 0; }

.related-title { font-family: var(--font-mono); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.related-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14px;
}
.related-card .tag { display: inline-block; margin-bottom: 8px; }


/* =========================================================
   Quiz
   ========================================================= */
.quiz-shell { padding: 40px 0 70px; }
.quiz-head { margin-bottom: 24px; }
.quiz-head .qh-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); }
.quiz-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.quiz-bar > span { display: block; height: 100%; background: var(--accent); width: 40%; }

.q-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  background: var(--paper-raised);
  margin-bottom: 24px;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--ink) 5%, transparent);
}
.q-card h2 { font-size: 21px; font-family: var(--font-body); font-weight: 600; margin-bottom: 22px; line-height: 1.5; }
.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.q-option:hover { border-color: var(--accent); transform: translateX(3px); }
.q-option .letter {
  width: 26px; height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  flex: none;
}
.q-option.correct { border-color: var(--good); background: var(--good-soft); }
.q-option.correct .letter { border-color: var(--good); color: var(--good); background: var(--paper-raised); }
.q-option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.q-option.wrong .letter { border-color: var(--bad); color: var(--bad); background: var(--paper-raised); }

.quiz-actions { display: flex; justify-content: space-between; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 30px;
  margin-top: 40px;
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { font-size: 13.5px; color: var(--ink-soft); }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }

/* =========================================================
   Test module — status pill (also used by paper/sectional cards)
   ========================================================= */
.module-status {
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.module-status.live { background: var(--good-soft); color: var(--good); }
.module-status.soon { background: var(--paper-dim); color: var(--ink-faint); }

/* =========================================================
   Test module — paper hub
   ========================================================= */
.paper-grid { display: flex; flex-direction: column; gap: 14px; }
.paper-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 22px 24px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.paper-card.enabled:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 10px 24px color-mix(in srgb, var(--ink) 8%, transparent); }
.paper-card.disabled { opacity: 0.55; }
.paper-card h3 { font-size: 18px; margin-bottom: 6px; }
.paper-card .paper-meta { display: flex; gap: 14px; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); flex-wrap: wrap; }
.paper-card .paper-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* =========================================================
   Test module — exam engine (setup / in-progress / report)
   ========================================================= */
.exam-setup {
  max-width: 700px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 36px;
}
.exam-setup h1 { font-size: 26px; margin-bottom: 6px; }
.exam-setup .setup-meta { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); margin-bottom: 26px; }
.setup-sections { list-style: none; padding: 0; margin: 0 0 26px; display: flex; flex-direction: column; gap: 8px; }
.setup-sections li { display: flex; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 14px; }
.setup-sections li b { font-family: var(--font-mono); color: var(--ink-faint); font-weight: 500; }

.timer-field { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; padding: 16px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--paper-dim); }
.timer-field label { font-size: 14px; color: var(--ink-soft); flex: 1; }
.timer-field input { width: 80px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 16px; text-align: center; background: var(--paper-raised); color: var(--ink); }
.timer-field span { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }

.attempt-history { margin-top: 10px; }
.attempt-history h4 { font-size: 13px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 12px; }
.attempt-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 8px; }
.attempt-row .a-score { font-family: var(--font-mono); color: var(--accent); font-weight: 600; }

/* --- in-progress exam --- */
.exam-topbar {
  position: sticky; top: 64px; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 0;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}
.exam-timer {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  letter-spacing: 0.02em;
}
.exam-timer.low { background: var(--bad-soft); color: var(--bad); animation: pulseTimer 1s ease-in-out infinite; }
@keyframes pulseTimer { 50% { opacity: 0.55; } }
.exam-progress-text { font-family: var(--font-mono); font-size: 13px; color: var(--ink-faint); }

.exam-layout { display: grid; grid-template-columns: 1fr 260px; gap: 24px; align-items: start; }
.exam-question-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-raised); padding: 28px 30px; box-shadow: 0 12px 30px color-mix(in srgb, var(--ink) 5%, transparent); }
.exam-question-card .q-section-tag { font-family: var(--font-mono); font-size: 11.5px; color: var(--accent); margin-bottom: 10px; display: block; }
.exam-question-card h2 { font-size: 19px; font-family: var(--font-body); font-weight: 600; line-height: 1.55; margin-bottom: 24px; }
.exam-nav-buttons { display: flex; justify-content: space-between; margin-top: 22px; gap: 10px; }

.q-nav-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-raised); padding: 18px; position: sticky; top: 150px; }
.q-nav-panel .legend { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 12px; color: var(--ink-faint); font-family: var(--font-mono); }
.q-nav-panel .legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-dot.answered { background: var(--good); }
.legend-dot.unanswered { background: var(--line-strong); }
.legend-dot.current { background: var(--accent); }
.q-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 16px; }
.q-grid button {
  aspect-ratio: 1; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--paper-dim); color: var(--ink-soft); font-family: var(--font-mono); font-size: 12.5px;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.q-grid button.answered { background: var(--good); border-color: var(--good); color: #fff; }
.q-grid button.current { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --- report --- */
.report-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 30px; }
.report-stat { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-raised); padding: 18px; text-align: center; }
.report-stat b { display: block; font-family: var(--font-display); font-size: 26px; margin-bottom: 4px; }
.report-stat span { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.report-stat.good b { color: var(--good); }
.report-stat.bad b { color: var(--bad); }

.report-section-table { width: 100%; border-collapse: collapse; margin-bottom: 34px; font-size: 14px; }
.report-section-table th, .report-section-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.report-section-table th { font-family: var(--font-mono); font-size: 11.5px; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }

.review-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 12px; }
.review-item .review-tag { font-family: var(--font-mono); font-size: 11px; padding: 3px 9px; border-radius: 999px; margin-bottom: 10px; display: inline-block; }
.review-tag.correct { background: var(--good-soft); color: var(--good); }
.review-tag.wrong { background: var(--bad-soft); color: var(--bad); }
.review-tag.skipped { background: var(--paper-dim); color: var(--ink-faint); }
.review-item h4 { font-size: 15px; font-weight: 600; margin-bottom: 12px; font-family: var(--font-body); }
.review-options { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.review-options .r-opt { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); }
.review-options .r-opt.mark-correct { border-color: var(--good); background: var(--good-soft); }
.review-options .r-opt.mark-wrong { border-color: var(--bad); background: var(--bad-soft); }

.report-actions { display: flex; gap: 12px; margin: 30px 0 10px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .exam-layout { grid-template-columns: 1fr; }
  .q-nav-panel { position: static; }
  .report-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .site-header, .exam-topbar, .report-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .review-item, .report-stat, .report-section-table { break-inside: avoid; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px) {
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .value-grid { grid-template-columns: 1fr; gap: 30px; }
  .action-panel { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .hero .wrap { grid-template-columns: 1fr; }
  .book-stage { order: -1; margin-bottom: 10px; }
}
@media (max-width: 760px) {
  .main-nav { display: none; }
  .search-box { display: none; }
  .hamburger { display: inline-flex; }
  .subject-grid { grid-template-columns: 1fr 1fr; }
  .topic-card { grid-template-columns: 1fr; }
  .includes { display: none; }
  .action-panel { grid-template-columns: 1fr; }
}
/* =========================================================
   CMS additions: subject downloads + unit-level actions
   ========================================================= */
.subject-downloads {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.subject-downloads .btn svg { margin-right: 6px; vertical-align: -3px; }

.unit-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.unit-label-row .unit-label { margin-bottom: 0; }
.unit-actions {
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.unit-actions a { color: var(--accent); }
.unit-actions a:hover { text-decoration: underline; }

/* CMS additions: question images + review notes (CSV-driven exams/quizzes) */
.q-image {
  display: block;
  max-width: 100%;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius, 8px);
  margin: 14px 0;
  background: var(--paper-dim);
}
.review-q-image { max-height: 220px; margin: 10px 0; }
.review-note {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--paper-dim);
  border-left: 3px solid var(--accent);
  font-size: 13.5px;
  color: var(--ink-soft);
  border-radius: 4px;
}
