/* =================================================================
   PrepDeck — single stylesheet.
   Warm-neutral paper palette, serif display, one burnt-orange accent.
   No web fonts: everything uses system stacks so first paint is instant.
   ================================================================= */

:root {
  --bg:        #f7f6f3;
  --surface:   #ffffff;
  --surface-2: #f1efea;
  --text:      #1b1a18;
  --muted:     #6d6862;
  --faint:     #938d85;
  --border:    #e3e0d9;
  --border-2:  #d3cec4;
  --accent:    #b4531f;
  --accent-sf: #fdf1e8;
  --tip:       #1f6f52;
  --tip-sf:    #eaf5f0;
  --warn:      #9a5b06;
  --warn-sf:   #fdf3e3;
  --exam:      #7b3aa8;
  --exam-sf:   #f5eefb;
  --code-bg:   #f5f3ef;
  --shadow:    0 1px 2px rgba(27,26,24,.05), 0 6px 20px -12px rgba(27,26,24,.18);

  --serif: ui-serif, Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans:  system-ui, -apple-system, 'Segoe UI', Roboto, Inter, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, 'JetBrains Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --wrap: 1120px;
  --r:    12px;
}

html[data-theme='dark'] {
  --bg:        #121110;
  --surface:   #1a1917;
  --surface-2: #211f1d;
  --text:      #ecebe8;
  --muted:     #a09a92;
  --faint:     #7c766e;
  --border:    #2c2a27;
  --border-2:  #3a3733;
  --accent:    #e2884c;
  --accent-sf: #2a1d13;
  --tip:       #6cc7a2;
  --tip-sf:    #142420;
  --warn:      #dfa54e;
  --warn-sf:   #29200f;
  --exam:      #c398e8;
  --exam-sf:   #241a2e;
  --code-bg:   #201e1c;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px -14px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.01em;
  margin: 0;
}

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: #fff; padding: 9px 14px; border-radius: 8px;
  text-decoration: none; font-size: 14px;
}
.skip:focus { left: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- header */

.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.head-inner { display: flex; align-items: center; gap: 14px; height: 58px; }

.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
/* The mark goes home; the wordmark next to it hides something else. */
.brand-home { display: inline-flex; text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: #fff; font-family: var(--serif); font-size: 15px; font-weight: 700;
  display: grid; place-items: center; line-height: 1;
}
.brand-name { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -.015em; }

/* primary navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 100%;
}
.nav-link,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.nav-link:hover,
.nav-trigger:hover,
.nav-menu[open] .nav-trigger {
  color: var(--text);
  background: var(--surface);
}
.nav-trigger::-webkit-details-marker { display: none; }
.nav-trigger::after {
  content: '⌄';
  font-size: 11px;
  color: var(--faint);
  transform: translateY(-1px);
}
.nav-menu {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.nav-drop {
  position: absolute;
  top: calc(100% - 4px);
  left: 0;
  min-width: 230px;
  padding: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity .14s, transform .14s, visibility .14s;
}
.nav-menu:hover .nav-drop,
.nav-menu:focus-within .nav-drop,
.nav-menu[open] .nav-drop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-drop a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.35;
}
.nav-drop a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.crumbs {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--muted); overflow: hidden; white-space: nowrap;
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--text); text-overflow: ellipsis; overflow: hidden; }

.icon-btn {
  flex: none; width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); display: grid; place-items: center;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme='light'] .i-moon { display: none; }
html[data-theme='dark']  .i-sun  { display: none; }

/* ---------------------------------------------------------------- main */

main { flex: 1 0 auto; outline: none; }
.page { padding: 44px 0 76px; }

.eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 12px;
}

.lede { color: var(--muted); font-size: 16.5px; max-width: 62ch; margin: 12px 0 0; }

/* hero */
.hero { padding: 56px 0 30px; }
.hero h1 { font-size: clamp(32px, 5.2vw, 47px); }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero .lede { font-size: 17.5px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin: 0 0 16px; padding-top: 14px;
}
.section-head h2 { font-size: 21px; }
.section-head .hint { font-size: 13px; color: var(--faint); }

/* ---------------------------------------------------------------- cards */

.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
  display: block; text-decoration: none; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px 22px 22px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { font-size: 20px; margin-bottom: 7px; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 13px; }
.badge {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--border-2); color: var(--muted);
  line-height: 1.5;
}
.badge.solid { background: var(--accent-sf); border-color: transparent; color: var(--accent); }
.badge.hot {
  background: #ffefe8;
  border-color: #ff6b35;
  color: #d93800;
  font-weight: 700;
}
html[data-theme='dark'] .badge.hot {
  background: #3b1d12;
  border-color: #ff6b35;
  color: #ff8c61;
}

.hot-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid #ff5722;
  border-radius: var(--r);
  padding: 12px 16px;
  margin-bottom: 22px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.hot-banner:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  border-left-color: #ff5722;
}
.hot-tag {
  background: linear-gradient(135deg, #ff5722, #e64a19);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  flex: none;
  box-shadow: 0 2px 6px rgba(255, 87, 34, 0.35);
}
.hot-text {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

.card-foot {
  margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--faint);
}
.go { color: var(--accent); font-weight: 600; }

.card.soon { opacity: .62; pointer-events: none; }

/* ---------------------------------------------------------------- syllabus */

.chapter {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px 24px 10px; margin-bottom: 20px;
}
.chapter-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 6px; }
.ch-num {
  flex: none; width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent-sf); color: var(--accent);
  font-family: var(--serif); font-weight: 700; font-size: 16px;
  display: grid; place-items: center;
}
.chapter-head h2 { font-size: 19px; }
.chapter-head .ch-sum { color: var(--muted); font-size: 14px; margin: 6px 0 0; line-height: 1.6; }

.topic-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--border); }
.topic-list li { border-bottom: 1px solid var(--border); }
.topic-list li:last-child { border-bottom: 0; }

.topic-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 4px;
  text-decoration: none; transition: padding-left .14s;
}
.topic-row:hover { padding-left: 9px; }
.topic-row:hover .t-title { color: var(--accent); }

.t-dot {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  border: 1.5px solid var(--border-2); display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: var(--faint);
}
.topic-row.done .t-dot { background: var(--tip); border-color: var(--tip); color: #fff; }

.t-body { flex: 1; min-width: 0; }
.t-title { font-weight: 550; font-size: 15.5px; display: block; }
.t-one { color: var(--muted); font-size: 13.5px; display: block; margin-top: 1px;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-min { flex: none; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

.progress-bar { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-bar i { display: block; height: 100%; background: var(--tip); border-radius: 999px; transition: width .3s; }

/* --------------------------------------------------------- assignment answers */

.ans-src { margin: 22px 0 0; }

.ans-toc {
  margin: 26px 0 8px; padding: 16px 20px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}
.ans-toc-h {
  margin: 0 0 10px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}
.ans-toc ol { margin: 0; padding-left: 0; list-style: none; counter-reset: none; }
.ans-toc li { margin: 0; }
.ans-toc a {
  display: block; padding: 4px 0; font-size: 14px; color: var(--muted);
  text-decoration: none; border-bottom: 1px solid transparent;
}
.ans-toc a:hover { color: var(--accent); }
.ans-list { margin-top: 34px; }

.ans-item {
  padding-top: 30px; margin-top: 30px; border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.ans-item:first-child { padding-top: 0; margin-top: 0; border-top: 0; }

.ans-q {
  display: flex; gap: 12px; align-items: baseline;
  font-family: var(--serif); font-size: clamp(18px, 2.2vw, 21px);
  line-height: 1.35; font-weight: 600; margin: 0 0 14px;
}
.ans-n {
  flex: none; font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  color: var(--accent); background: var(--accent-sf);
  border-radius: 6px; min-width: 26px; height: 24px;
  display: inline-grid; place-items: center;
  font-variant-numeric: tabular-nums;
}

/* Answers sit slightly inset from the question so the page scans as
   question / answer rather than as one undifferentiated column. */
.ans-body { padding-left: 38px; }
.ans-body > :first-child { margin-top: 0; }
.ans-body p { margin: 0 0 12px; }
.ans-body ul, .ans-body ol { margin: 0 0 12px; }
.ans-body li { margin-bottom: 6px; }
.ans-body > :last-child { margin-bottom: 0; }

@media (max-width: 560px) {
  .ans-body { padding-left: 0; }
}

/* ------------------------------------------------------------ course material */

/* The lecture decks and handouts. Downloads only — a .pptx has no in-page
   viewer, so the row is sized for scanning a list, not for reading. */
.materials { margin-top: 30px; }
.materials .section-head { margin-bottom: 12px; }

.mat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.mat-row {
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); padding: 12px 15px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mat-row:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--shadow); }

.mat-kind {
  flex: none; min-width: 46px; text-align: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-sf);
  border-radius: 6px; padding: 5px 7px;
}
.mat-body { flex: 1; min-width: 0; }
.mat-title { display: block; font-size: 14.5px; font-weight: 600; }
.mat-note { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mat-size {
  flex: none; font-size: 12px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.mat-row:hover .mat-title { color: var(--accent); }

@media (max-width: 560px) {
  .mat-size { display: none; }
}

/* ---------------------------------------------------------------- past papers */

/* the entry point, sitting on the syllabus page */
.papers-banner {
  display: flex; align-items: center; gap: 15px; margin-top: 26px;
  text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 15px 18px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.papers-banner:hover { border-color: var(--border-2); border-left-color: var(--accent);
                       transform: translateY(-1px); box-shadow: var(--shadow); }
.pb-icon {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent-sf); color: var(--accent); display: grid; place-items: center;
}
.pb-icon svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pb-body { flex: 1; min-width: 0; }
.pb-title { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; }
.pb-note { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.papers-banner .go { flex: none; font-size: 13px; }

/* the viewer page */
.paper-list { margin-top: 30px; }

.paper {
  margin: 0 0 26px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
}
.paper-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; padding: 17px 20px 15px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.paper-id h2 { font-size: 19px; }
.paper-meta { margin: 4px 0 0; font-size: 12.5px; color: var(--faint);
              font-variant-numeric: tabular-nums; }
.paper-acts { display: flex; gap: 9px; flex-wrap: wrap; }

.p-btn {
  display: inline-block; text-decoration: none; font-size: 13px; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 14px;
  transition: border-color .15s, color .15s;
}
.p-btn:hover { border-color: var(--accent); color: var(--accent); }
.p-btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.p-btn.solid:hover { color: #fff; filter: brightness(1.08); }

.paper-note {
  margin: 0; padding: 13px 20px; font-size: 14px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.paper-frame { background: var(--surface-2); }
.paper-frame object { display: block; width: 100%; height: min(84vh, 1000px); border: 0; }

.paper-fallback { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.paper-fallback p { margin: 0 0 14px; }
.paper-fallback p:last-child { margin: 0; }

@media (max-width: 620px) {
  .paper-head { align-items: flex-start; }
  .paper-frame object { height: 62vh; }
  .papers-banner .go { display: none; }
}

/* ---------------------------------------------------------------- topic page */

.topic-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 44px; align-items: start; }

.toc { position: sticky; top: 74px; font-size: 14px; }
.toc-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em;
             color: var(--faint); font-weight: 600; margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: block; padding: 5px 0 5px 12px; text-decoration: none; color: var(--muted);
  border-left: 2px solid var(--border); line-height: 1.45; font-size: 13.8px;
}
.toc li a:hover { color: var(--text); border-left-color: var(--border-2); }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc li a.seen::after { content: ' ✓'; color: var(--tip); font-weight: 700; }

article { min-width: 0; max-width: 74ch; }
article > h1 { font-size: clamp(27px, 4vw, 35px); margin-bottom: 10px; }
.topic-meta { display: flex; gap: 10px; align-items: center; color: var(--faint);
              font-size: 13px; margin-bottom: 26px; }

article h2 {
  font-size: 21px; margin: 40px 0 12px; padding-top: 4px;
  scroll-margin-top: 76px;
}
article p { margin: 0 0 15px; }
article ul, article ol { margin: 0 0 16px; padding-left: 22px; }
article li { margin-bottom: 6px; }
article li::marker { color: var(--faint); }

article strong { font-weight: 650; }
article code {
  font-family: var(--mono); font-size: .875em; background: var(--code-bg);
  border: 1px solid var(--border); border-radius: 5px; padding: .1em .38em;
  word-break: break-word;
}

/* code blocks */
.snippet { margin: 0 0 22px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--code-bg); }
.snippet figcaption {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.snippet pre { margin: 0; padding: 15px 16px; overflow-x: auto; }
.snippet code { background: none; border: 0; padding: 0; font-size: 13.4px; line-height: 1.62; display: block; }
.snippet .out {
  border-top: 1px dashed var(--border-2); background: var(--surface);
  padding: 12px 16px; overflow-x: auto;
}
.snippet .out-label {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; margin-bottom: 6px; font-family: var(--sans);
}
.snippet .out pre { padding: 0; }
.snippet .out code { color: var(--muted); }

.copy-btn {
  font-family: var(--sans); font-size: 11.5px; color: var(--muted); cursor: pointer;
  background: transparent; border: 1px solid var(--border-2); border-radius: 6px; padding: 2px 8px;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* python syntax colours */
.tok-kw  { color: var(--exam); font-weight: 600; }
.tok-str { color: var(--tip); }
.tok-num { color: var(--accent); }
.tok-com { color: var(--faint); font-style: italic; }
.tok-fn  { color: var(--warn); }
.tok-bi  { color: var(--warn); }

/* callouts */
.callout {
  border: 1px solid var(--border); border-left: 3px solid var(--muted);
  border-radius: 8px; padding: 13px 16px; margin: 0 0 20px; font-size: 14.8px;
  background: var(--surface);
}
.callout p:last-child { margin-bottom: 0; }
.callout .co-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  display: block; margin-bottom: 5px;
}
.callout.tip  { border-left-color: var(--tip);  background: var(--tip-sf);  }
.callout.tip  .co-tag { color: var(--tip); }
.callout.warn { border-left-color: var(--warn); background: var(--warn-sf); }
.callout.warn .co-tag { color: var(--warn); }
.callout.exam { border-left-color: var(--exam); background: var(--exam-sf); }
.callout.exam .co-tag { color: var(--exam); }

/* figures: dark-ink drawings and charts, always on a white card */
.fig { margin: 0 0 22px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; overflow-x: auto; background: #fff; }
/* Diagrams carry small labels: on a phone they keep a readable width and
   the card scrolls sideways instead of shrinking the text to nothing. */
.fig img[src*="/diag-"] { min-width: 540px; max-height: none; }
.fig img { display: block; max-width: 100%; height: auto; margin: 0 auto; padding: 16px; max-height: 420px; }
.fig figcaption { padding: 9px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); background: var(--surface-2); }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { caption-side: top; text-align: left; padding: 10px 14px; font-size: 12.5px;
          color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface-2); }
th, td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td code { white-space: nowrap; }

/* Q&A */
.qa {
  border: 1px solid var(--border); border-radius: 10px; margin: 0 0 12px;
  background: var(--surface); overflow: hidden;
}
.qa summary {
  cursor: pointer; padding: 13px 16px; font-weight: 550; font-size: 15px;
  list-style: none; display: flex; gap: 11px; align-items: flex-start;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before {
  content: 'Q'; flex: none; font-family: var(--serif); font-weight: 700; font-size: 13px;
  color: var(--accent); background: var(--accent-sf); width: 21px; height: 21px;
  border-radius: 5px; display: grid; place-items: center; margin-top: 2px;
}
.qa[open] summary { border-bottom: 1px solid var(--border); }
.qa .ans { padding: 14px 16px 14px 48px; color: var(--muted); font-size: 14.7px; }
.qa .ans p:last-child { margin-bottom: 0; }

.qa-head { margin-top: 42px !important; }

/* prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px;
         padding-top: 26px; border-top: 1px solid var(--border); }
.pager a {
  text-decoration: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 16px; transition: border-color .15s;
}
.pager a:hover { border-color: var(--accent); }
.pager .dir { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.pager .nm { display: block; margin-top: 3px; font-weight: 550; font-size: 14.5px; }
.pager .nx { text-align: right; grid-column: 2; }

.mark-done {
  margin-top: 26px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 9px 15px; font-size: 14px; font-family: inherit;
}
.mark-done:hover { border-color: var(--tip); color: var(--tip); }
.mark-done[aria-pressed='true'] { background: var(--tip-sf); border-color: var(--tip); color: var(--tip); font-weight: 600; }

/* ---------------------------------------------------------------- footer */

.site-foot { flex: none; border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.foot-inner {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px;
  padding-top: 34px; padding-bottom: 26px;
}
.foot-brand { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 0 0 6px; }

/* The wordmarks are the way in — header and footer each hide a different
   gif. They sit where the eye already lands and behave like something
   clickable, so they get found, but neither says what it does. */
.egg-btn {
  appearance: none; background: none; border: 0; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  transition: color .15s;
}
.egg-btn:hover { color: var(--accent); }
.egg-btn.found { color: var(--accent); }

.brand-egg::after {
  content: '·'; margin-left: 5px; color: var(--faint);
  transition: color .15s, transform .15s; display: inline-block;}
.brand-egg:hover::after { color: var(--accent); transform: translateX(2px) rotate(20deg); }
.foot-note { font-size: 13px; color: var(--muted); margin: 0 0 12px; max-width: 42ch; line-height: 1.6; }
.foot-links { display: flex; gap: 16px; font-size: 13px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--accent); }

.fb-label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
            color: var(--faint); display: block; margin-bottom: 7px; }

#feedback-form textarea, #feedback-form input[type=text] {
  width: 100%; font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 11px; resize: vertical;
}
#feedback-form textarea::placeholder, #feedback-form input::placeholder { color: var(--faint); }
#feedback-form textarea:focus, #feedback-form input:focus { border-color: var(--accent); outline: none; }

.fb-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.fb-actions { display: flex; align-items: center; gap: 11px; margin-top: 9px; }
.fb-send {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 18px;
}
.fb-send:hover { filter: brightness(1.08); }
.fb-send:disabled { opacity: .55; cursor: default; }
.fb-status { font-size: 12.5px; color: var(--muted); }
.fb-status.ok  { color: var(--tip); }
.fb-status.err { color: #c0392b; }
html[data-theme='dark'] .fb-status.err { color: #ef8a7d; }

.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.foot-base {
  border-top: 1px solid var(--border); padding-top: 13px; padding-bottom: 16px;
  display: flex; gap: 8px; align-items: center;
  font-size: 11.5px; color: var(--faint);
}
.foot-base .by { color: var(--faint); }

/* Reads as the separator dot it replaced. It is a real button so it can be
   tabbed to, but it gives nothing away until it is pressed. */
.dot {
  appearance: none; background: none; border: 0; padding: 0;
  font: inherit; color: var(--faint); cursor: default;
  line-height: 1; opacity: .8;
}
.dot::before { content: '·'; }
.dot:hover { color: var(--accent); }
.dot.found { color: var(--accent); }

/* Centred popup. It closes itself after two loops of whichever gif opened
   it, so there is no close button — a click anywhere, or Escape, also does
   it for anyone who does not want to wait. */
.egg-pop {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background: rgba(24, 18, 12, .55);
  backdrop-filter: blur(3px);
  animation: egg-fade .16s ease-out;
}
.egg-pop[hidden] { display: none; }

.egg-card { animation: egg-pop .22s cubic-bezier(.2, .9, .3, 1.25); }
.egg-card img {
  display: block; width: 100%; max-width: min(80vw, 360px); height: auto;
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

@keyframes egg-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes egg-pop  { from { opacity: 0; transform: scale(.88) } to { opacity: 1; transform: scale(1) } }

@media (prefers-reduced-motion: reduce) {
  .egg-pop, .egg-card { animation: none; }
}

/* ---------------------------------------------------------------- misc */

.skel { color: var(--faint); font-size: 14.5px; padding: 40px 0; }

.notfound { text-align: center; padding: 80px 0; }
.notfound h1 { font-size: 40px; margin-bottom: 10px; }

.btn-back {
  display: inline-block; margin-top: 18px; text-decoration: none; font-size: 14px;
  color: var(--accent); font-weight: 600;
}

.prose-note { font-size: 13.5px; color: var(--faint); margin-top: 30px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .topic-layout { grid-template-columns: 1fr; gap: 26px; }
  .toc { position: static; border: 1px solid var(--border); border-radius: 10px;
         padding: 14px 16px; background: var(--surface); }
  .toc ol { columns: 2; column-gap: 20px; }
  .toc li a { border-left: 0; padding-left: 0; }
}

@media (max-width: 760px) {
  .foot-inner { grid-template-columns: 1fr; gap: 26px; }
  .crumbs { display: none; }
  .hero { padding: 40px 0 22px; }
  .page { padding: 30px 0 56px; }
}

@media (max-width: 520px) {
  .wrap { padding-inline: 17px; }
  .toc ol { columns: 1; }
  .pager { grid-template-columns: 1fr; }
  .pager .nx { grid-column: 1; text-align: left; }
  .fb-row { grid-template-columns: 1fr; }
  article h2 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-head, .site-foot, .toc, .pager, .mark-done, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
  article { max-width: none; }
  .qa { break-inside: avoid; }
  .qa .ans { display: block !important; }
}


.assignment-image{margin:28px 0 0;border:1px solid var(--line);border-radius:14px;overflow:auto;background:var(--panel)}
.assignment-image img{display:block;width:100%;height:auto;max-width:862px;margin:0 auto}

@media (max-width: 760px) {
  .head-inner { gap: 8px; }
  .main-nav { gap: 1px; }
  .nav-link, .nav-trigger { padding-inline: 7px; font-size: 12.5px; }
  .crumbs { display: none; }
  .nav-drop { left: 0; }
}

@media (max-width: 500px) {
  .brand-name { display: none; }
  .main-nav { margin-left: auto; }
  .nav-link, .nav-trigger { padding-inline: 6px; font-size: 12px; }
  .nav-drop { min-width: 215px; }
}

/* Exam syllabus, as announced: a closed menu that opens on click */
.syl-menu > summary {
  display: flex; align-items: baseline; gap: 12px; cursor: pointer; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 16px;
}
.syl-menu > summary::-webkit-details-marker { display: none; }
.syl-menu > summary::before { content: '▸'; color: var(--muted); flex: none; }
.syl-menu[open] > summary::before { content: '▾'; }
.syl-menu > summary:hover .syl-sum-title { color: var(--accent); }
.syl-sum-title { font-weight: 650; font-size: 16px; }
.syl-menu > summary .hint { font-size: 13px; color: var(--faint); }
.syl-menu[open] > summary { margin-bottom: 10px; }
.unit-row .t-min { white-space: nowrap; }
.syl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.syl-list li {
  display: flex; gap: 14px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 16px;
}
.syl-unit { flex: none; font-weight: 700; font-size: 13px; color: var(--muted); min-width: 56px; }
.syl-text { line-height: 1.55; }
