/* ─────────────────────────────────────────────────────────────
   Coursework — "Reading Room"

   An editorial, long-form reading interface.
   Type:   Fraunces (display) · Literata (body) · IBM Plex Mono (code)
   Theme:  Bordeaux-on-Parchment (light) / Bordeaux Night (dark)
   ───────────────────────────────────────────────────────────── */

/* ─── Theme tokens ─────────────────────────────────────────── */

:root {
  /* Light — Parchment */
  --bg:            #f3eee3;
  --bg-elevated:   #fbf7ee;
  --bg-sidebar:    #efe8da;
  --bg-code:       #ece4d5;
  --bg-hover:      rgba(42, 33, 28, 0.05);

  --ink:           #2a211c;
  --ink-soft:      #6c5f54;
  --ink-faint:     #9b8d7e;

  --accent:        #8a2f2f;   /* bordeaux */
  --accent-hover:  #6f2424;
  --on-accent:     #fbf7ee;

  --rule:          #e0d7c5;
  --rule-strong:   #2a211c;
  --rule-mid:      #c3b6a0;

  /* Callout palette — warm-friendly tints */
  --note-bg:       #f8edcf;  --note-bd:     #c79a2e;  --note-ink:     #5c4708;
  --warn-bg:       #f7e0d8;  --warn-bd:     #c0533c;  --warn-ink:     #6e2516;
  --exercise-bg:   #e3eedd;  --exercise-bd: #5f8a4f;  --exercise-ink: #2f4d24;
  --think-bg:      #dfeaf2;  --think-bd:    #3f7aa6;  --think-ink:    #214a66;
  --answer-bg:     #ece1ee;  --answer-bd:   #8a4f9c;  --answer-ink:   #4d2657;
  --car-bg:        #f6e6d2;  --car-bd:      #c5862f;  --car-ink:      #6a4413;
  --deep-bg:       #e7e1f2;  --deep-bd:     #6a55b0;  --deep-ink:     #352a66;

  --shadow:        0 8px 30px rgba(42, 33, 28, 0.10);
  --shadow-soft:   0 2px 10px rgba(42, 33, 28, 0.07);

  --sidebar-w:     288px;
  --content-max:   720px;
  --ease:          cubic-bezier(0.22, 0.61, 0.36, 1);

  --font-display:  'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:     'Literata', Georgia, 'Times New Roman', serif;
  --font-mono:     'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg:            #1b1714;
  --bg-elevated:   #221d18;
  --bg-sidebar:    #1f1a15;
  --bg-code:       #262019;
  --bg-hover:      rgba(236, 227, 214, 0.06);

  --ink:           #ece3d6;
  --ink-soft:      #b1a594;
  --ink-faint:     #7d7264;

  --accent:        #d98a82;
  --accent-hover:  #e7a59d;
  --on-accent:     #1b1714;

  --rule:          #352d24;
  --rule-strong:   #ece3d6;
  --rule-mid:      #4a3f33;

  --note-bg:       #2e2710;  --note-bd:     #9c7c2a;  --note-ink:     #e6cf86;
  --warn-bg:       #34201a;  --warn-bd:     #b85540;  --warn-ink:     #eab3a4;
  --exercise-bg:   #1e2a19;  --exercise-bd: #5f8a4f;  --exercise-ink: #b6d3a6;
  --think-bg:      #182734;  --think-bd:    #4a86b3;  --think-ink:    #a6cce6;
  --answer-bg:     #271b2c;  --answer-bd:   #9a5fac;  --answer-ink:   #d9b6e2;
  --car-bg:        #2f2313;  --car-bd:      #c5862f;  --car-ink:      #e6c08a;
  --deep-bg:       #211c33;  --deep-bd:     #8472c8;  --deep-ink:     #c4b9ec;

  --shadow:        0 10px 36px rgba(0, 0, 0, 0.45);
  --shadow-soft:   0 2px 12px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  min-height: 100vh;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

/* Subtle paper grain so the background isn't a flat fill */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: radial-gradient(var(--rule) 0.5px, transparent 0.5px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 78%);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* ─── Reading progress ─────────────────────────────────────── */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ─── Floating controls ────────────────────────────────────── */

.ctrl-cluster {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 55;
  display: flex;
  gap: 8px;
}

.ctrl {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: var(--bg-elevated);
  color: var(--ink-soft);
  border-radius: 11px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
              transform 0.2s var(--ease), background 0.2s var(--ease);
}

.ctrl:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.ctrl:active { transform: translateY(0); }

.ctrl-sidebar {
  position: fixed;
  top: 20px;
  left: calc(var(--sidebar-w) + 22px);
  z-index: 55;
  transition: left 0.42s var(--ease), color 0.2s var(--ease),
              border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

html.sidebar-collapsed .ctrl-sidebar {
  left: 22px;
}

/* Icons — pure CSS glyphs */
.ctrl-icon { display: block; position: relative; }

.icon-panel {
  width: 16px; height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 3px;
}
.icon-panel::before {
  content: ""; position: absolute;
  top: -1.8px; bottom: -1.8px; left: 4px;
  width: 1.8px; background: currentColor;
}
html.sidebar-collapsed .icon-panel::after {
  content: ""; position: absolute;
  left: -1px; top: 50%; width: 9px; height: 9px;
  border-top: 1.8px solid currentColor;
  border-right: 1.8px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.icon-help {
  width: 18px; height: 18px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  display: grid; place-items: center;
  line-height: 1;
}
.icon-help::before { content: "?"; }

.icon-sun, .icon-moon { width: 18px; height: 18px; }
.icon-sun {
  border-radius: 50%;
  box-shadow: 0 0 0 1.8px currentColor inset,
              0 -9px 0 -7px currentColor, 0 9px 0 -7px currentColor,
              -9px 0 0 -7px currentColor, 9px 0 0 -7px currentColor,
              6px 6px 0 -7px currentColor, -6px -6px 0 -7px currentColor,
              6px -6px 0 -7px currentColor, -6px 6px 0 -7px currentColor;
  width: 10px; height: 10px;
}
.icon-moon {
  border-radius: 50%;
  box-shadow: 5px 4px 0 0 currentColor inset;
  transform: rotate(-32deg);
}
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ─── Sidebar ──────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  overflow: hidden;
  transition: transform 0.42s var(--ease), opacity 0.32s var(--ease);
}

.sidebar-inner {
  height: 100%;
  overflow-y: auto;
  padding: 26px 22px 28px;
  font-family: var(--font-body);
  font-size: 14.5px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-mid) transparent;
}

html.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
}

.content-wrap {
  margin-left: var(--sidebar-w);
  flex-grow: 1;
  position: relative;
  z-index: 1;
  padding: 88px clamp(24px, 6vw, 96px) 120px;
  width: calc(100% - var(--sidebar-w));
  transition: margin-left 0.42s var(--ease), width 0.42s var(--ease);
}

html.sidebar-collapsed .content-wrap {
  margin-left: 0;
  width: 100%;
}

/* Distraction-free mode: let the content fill more of the screen,
   leaving ~20% gutters on each side. Desktop only — on mobile the
   sidebar is collapsed by default and uses the responsive layout below. */
@media (min-width: 881px) {
  html.sidebar-collapsed .content-wrap {
    padding-left: 0;
    padding-right: 0;
  }
  html.sidebar-collapsed .content {
    max-width: 60%;
  }
}

.sidebar-header {
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--rule-strong);
}

.home-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 3px 0;
  line-height: 1.15;
}

.sidebar-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 13px;
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 12.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  transition: color 0.18s var(--ease);
}
.back-home[hidden] { display: none; }
.back-home .back-arrow { transition: transform 0.2s var(--ease); }
.back-home:hover { color: var(--accent); }
.back-home:hover .back-arrow { transform: translateX(-3px); }

.nav-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}

.phase-nav, .section-nav, .reference-nav, .help-nav {
  margin-bottom: 26px;
}

.phase-list, .section-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.phase-list li, .section-list li { margin: 0; }

.phase-list a {
  display: block;
  position: relative;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.phase-list a:hover { background: var(--bg-hover); }

.phase-list a.active {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-soft);
}
.phase-list a.active:hover { background: var(--accent); }

.phase-list .phase-title {
  font-weight: 600;
  display: block;
  line-height: 1.35;
}

.phase-list .phase-subtitle {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  display: block;
  margin-top: 1px;
}

.phase-list a.active .phase-subtitle { color: rgba(251, 247, 238, 0.78); }
[data-theme="dark"] .phase-list a.active .phase-subtitle { color: rgba(27, 23, 20, 0.7); }

.section-list a {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  padding: 5px 10px 5px 14px;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid var(--rule);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.section-list a:hover { color: var(--ink); border-left-color: var(--rule-mid); }

.section-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.section-list .section-h3 {
  padding-left: 26px;
  font-size: 12.5px;
}

/* Scrim for mobile drawer */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 38;
  background: rgba(20, 16, 12, 0.4);
  backdrop-filter: blur(2px);
  border: 0;
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

/* ─── Content / typography ─────────────────────────────────── */

.content {
  max-width: var(--content-max);
  margin: 0 auto;
}

.loading {
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
  padding: 80px 0;
}

.content h1, .content h2, .content h3, .content h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.content h1 {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.1;
  font-weight: 600;
  margin: 0 0 0.5em;
  padding-bottom: 0.4em;
  border-bottom: 3px solid var(--rule-strong);
}

.content h2 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 2.4em 0 0.7em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 28px;
}

.content h3 {
  font-size: 1.25rem;
  margin: 1.9em 0 0.5em;
  scroll-margin-top: 28px;
}

.content h4 {
  font-size: 1.05rem;
  margin: 1.5em 0 0.4em;
}

.content p { margin: 0 0 1.1em; }

.content a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 1.08em;
  transition: color 0.18s var(--ease), background-size 0.18s var(--ease);
}
.content a:hover {
  color: var(--accent-hover);
  background-size: 100% 2px;
}

.content hr {
  margin: 2.6em 0;
  border: none;
  border-top: 2px solid var(--rule-strong);
}

.content ul, .content ol {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}
.content li { margin-bottom: 0.35em; }
.content li::marker { color: var(--accent); }

.content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.4em 0;
  padding: 0.2em 0 0.2em 1.1em;
  color: var(--ink-soft);
  font-style: italic;
}

.content em { font-style: italic; }
.content strong { font-weight: 600; color: var(--ink); }

/* Drop-cap-free but warm first-paragraph emphasis */
.content > p:first-of-type { color: var(--ink); }

/* ─── Code ─────────────────────────────────────────────────── */

.content code {
  background: var(--bg-code);
  padding: 0.12em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.82em;
  border-radius: 5px;
  border: 1px solid var(--rule);
}

.content pre {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  margin: 1.4em 0;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  scrollbar-width: thin;
}

.content pre code {
  background: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: inherit;
}

/* ─── Code copy button ─────────────────────────────────────── */

.code-block {
  position: relative;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1;
  color: var(--ink-soft);
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 7px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
              color 0.18s var(--ease), border-color 0.18s var(--ease),
              background 0.18s var(--ease);
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
  transform: translateY(0);
}

.code-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.code-copy.copied {
  color: var(--exercise-bd);
  border-color: var(--exercise-bd);
}
.code-copy.failed {
  color: var(--warn-bd);
  border-color: var(--warn-bd);
}

/* Keep the button visible briefly after a copy, even off-hover. */
.code-copy.copied,
.code-copy.failed {
  opacity: 1;
  transform: translateY(0);
}

/* Copy icon: two overlapping rounded rectangles. */
.code-copy-icon {
  position: relative;
  display: block;
  width: 11px;
  height: 11px;
}
.code-copy-icon::before,
.code-copy-icon::after {
  content: "";
  position: absolute;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.code-copy-icon::before {
  width: 7px; height: 7px;
  right: 0; top: 0;
}
.code-copy-icon::after {
  width: 7px; height: 7px;
  left: 0; bottom: 0;
  background: var(--bg-elevated);
}

/* Swap the icon for a checkmark once copied. */
.code-copy.copied .code-copy-icon::before {
  width: 6px; height: 10px;
  right: 2px; top: -1px;
  border-width: 0 1.7px 1.7px 0;
  border-radius: 0;
  transform: rotate(40deg);
}
.code-copy.copied .code-copy-icon::after { display: none; }

@media (max-width: 880px) {
  /* No hover on touch — keep the button always visible. */
  .code-copy { opacity: 1; transform: none; }
}

/* ─── Copy-prompt button ───────────────────────────────────── */
/* A persistent call-to-action at the head of the prompt region —
   unlike the code-copy button, this one is always visible. */

.prompt-copy-bar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  margin: 0.5em 0 -0.5em;
  pointer-events: none;
}

.prompt-copy {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
              transform 0.18s var(--ease);
}

.prompt-copy:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.prompt-copy:active { transform: translateY(1px); }

.prompt-copy .code-copy-icon::after { background: var(--accent); }
.prompt-copy:hover .code-copy-icon::after { background: var(--accent-hover); }

.prompt-copy.copied,
.prompt-copy.copied:hover {
  background: var(--exercise-bd);
  border-color: var(--exercise-bd);
}
.prompt-copy.copied .code-copy-icon::before {
  width: 6px; height: 10px;
  right: 2px; top: -1px;
  border-width: 0 1.7px 1.7px 0;
  border-radius: 0;
  transform: rotate(40deg);
}
.prompt-copy.copied .code-copy-icon::after { display: none; }

.prompt-copy.failed,
.prompt-copy.failed:hover {
  background: var(--warn-bd);
  border-color: var(--warn-bd);
}

/* ─── Tables ───────────────────────────────────────────────── */

.content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.4em 0;
  font-size: 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
}

.content th, .content td {
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 9px 13px;
  text-align: left;
  vertical-align: top;
}
.content th:last-child, .content td:last-child { border-right: none; }
.content tr:last-child td { border-bottom: none; }

.content th {
  background: var(--bg-sidebar);
  font-family: var(--font-display);
  font-weight: 600;
}
.content tbody tr:nth-child(even) { background: var(--bg-hover); }

/* ─── Callouts ─────────────────────────────────────────────── */

.callout {
  border: 1px solid;
  border-left-width: 4px;
  padding: 14px 18px;
  margin: 1.5em 0;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.callout > :first-child { margin-top: 0; }
.callout > :last-child  { margin-bottom: 0; }

.callout::before {
  font-family: var(--font-display);
  font-weight: 600;
  display: inline;
  margin-right: 5px;
}

.callout-note      { background: var(--note-bg);     border-color: var(--note-bd);     color: var(--note-ink); }
.callout-warning   { background: var(--warn-bg);     border-color: var(--warn-bd);     color: var(--warn-ink); }
.callout-exercise  { background: var(--exercise-bg); border-color: var(--exercise-bd); color: var(--exercise-ink); }
.callout-think     { background: var(--think-bg);    border-color: var(--think-bd);    color: var(--think-ink); }
.callout-answer    { background: var(--answer-bg);   border-color: var(--answer-bd);   color: var(--answer-ink); }
.callout-car-part  { background: var(--car-bg);      border-color: var(--car-bd);      color: var(--car-ink); }
.callout-deep-dive { background: var(--deep-bg);     border-color: var(--deep-bd);     color: var(--deep-ink); }

.callout strong { color: inherit; }
.callout a { color: inherit; background-image: linear-gradient(currentColor, currentColor); }

.callout-exercise::before  { content: "✏️ Exercise: "; }
.callout-think::before     { content: "🤔 Think: "; }
.callout-answer::before    { content: "💡 Answer: "; }
.callout-car-part::before  { content: "🚗 Car Metaphor: "; }
.callout-deep-dive::before { content: "🔬 Deep Dive: "; }

.callout > h3:first-child,
.callout > h4:first-child { margin-top: 4px; }

/* ─── Landing page ─────────────────────────────────────────── */

.landing-header {
  margin-bottom: 3em;
}

.landing-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 1.6rem + 3vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.04;
  margin: 0;
  padding-bottom: 0.3em;
  border-bottom: 3px solid var(--rule-strong);
}

.landing-subtitle {
  margin: 0.7em 0 0;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.2rem;
}

.topic-section { margin-bottom: 3.4em; }

.topic-section h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.2em;
}

.topic-subtitle {
  margin: 0 0 1.3em;
  color: var(--ink-soft);
  font-style: italic;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.course-card {
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 22px 22px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 14px;
  text-decoration: none;
  color: var(--ink);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}
.course-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.course-card:hover {
  border-color: var(--rule-mid);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.course-card:hover::before { transform: scaleX(1); }

.course-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.course-card-subtitle {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 2px;
}

.course-card-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 12px;
  line-height: 1.55;
}

.course-card-meta {
  margin-top: auto;
  padding-top: 16px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-family: var(--font-mono);
}

/* ─── Reveal animation on load ─────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .content > * {
    animation: rise 0.5s var(--ease) both;
  }
  .content > *:nth-child(1) { animation-delay: 0.02s; }
  .content > *:nth-child(2) { animation-delay: 0.06s; }
  .content > *:nth-child(3) { animation-delay: 0.10s; }
  .content > *:nth-child(4) { animation-delay: 0.14s; }
  .content > *:nth-child(5) { animation-delay: 0.18s; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ─── Responsive ───────────────────────────────────────────── */

@media (max-width: 880px) {
  body { font-size: 17px; }

  .sidebar {
    width: min(86vw, var(--sidebar-w));
    box-shadow: var(--shadow);
  }
  /* On mobile the sidebar is an overlay drawer, shown by default-collapsed */
  .content-wrap {
    margin-left: 0;
    width: 100%;
    padding: 84px 22px 100px;
  }
  .ctrl-sidebar { left: 22px; }
  html:not(.sidebar-collapsed) .sidebar-scrim[hidden] { display: block; }
  html:not(.sidebar-collapsed) .sidebar-scrim { opacity: 1; }
  html.sidebar-collapsed .sidebar-scrim { opacity: 0; pointer-events: none; }
}

/* ─── Print ────────────────────────────────────────────────── */

@media print {
  .sidebar, .ctrl, .ctrl-cluster, .ctrl-sidebar,
  .reading-progress, .sidebar-scrim { display: none !important; }
  body::before { display: none; }
  .content-wrap { margin-left: 0; width: 100%; padding: 0; }
  body { font-size: 12pt; color: #000; background: #fff; }
}
