/* ==========================================================================
   COMP328 — Fundamentals of Machine Learning
   Master stylesheet
   --------------------------------------------------------------------------
   Version:  1.0
   Scope:    All course pages (index, syllabus, orientation, module, unit,
             topic, assignment, capstone, quiz)
   Theme:    Professional / academic
   --------------------------------------------------------------------------
   Contents
   01. Design tokens
   02. Reset & base
   03. Layout containers & utilities
   04. Typography
   05. Top navigation bar
   06. Site footer
   07. Buttons
   08. Section headings & kickers
   09. Cards
   10. Hero
   11. Stat list
   12. Modules & curriculum grid
   13. Learning outcomes & callouts
   14. Steps / process flow
   15. FAQ (details/summary)
   16. Tables
   17. Assessment cards & assignment lists
   18. Stack / tool grid
   19. Badges & tags
   20. Code & syntax
   21. Breadcrumbs
   22. Unit /  layout
   23. Topic content blocks
   24. Interactive activities
   25. Self-check & quiz components
   26. Topic pagination (prev / next)
   27. Sidebar navigation
   28. Progress indicators
   29. CTA band
   30. Print styles
   31. Responsive breakpoints
   ========================================================================== */


/* ==========================================================================
   01. DESIGN TOKENS
   ========================================================================== */

:root {
  /* --- Colour: ink & neutrals --- */
  --ink:          #16191f;
  --ink-soft:     #333a45;
  --muted:        #5b6472;
  --muted-light:  #7d8796;
  --line:         #dfe3e9;
  --line-soft:    #eef1f5;
  --bg:           #f4f6f9;
  --bg-alt:       #ffffff;
  --card:         #ffffff;
  --card-tint:    #fcfdfe;

  /* --- Colour: accent (academic blue) --- */
  --accent:       #1f4e8c;
  --accent-dk:    #13375f;
  --accent-lt:    #2f6db8;
  --accent-soft:  #eaf1fa;
  --accent-line:  #cfdff2;

  /* --- Colour: supporting accents --- */
  --teal:         #0f7b6c;
  --teal-soft:    #e6f4f1;
  --teal-line:    #bfe4dd;

  --gold:         #9a6b12;
  --gold-soft:    #fdf4e3;
  --gold-line:    #f0dcb4;

  --red:          #9b2c1c;
  --red-soft:     #fdecea;
  --red-line:     #f6cdc7;

  --green:        #256d3d;
  --green-soft:   #e7f5ec;
  --green-line:   #c2e3cf;

  /* --- Typography --- */
  --font-sans:    "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-serif:   Georgia, "Iowan Old Style", "Times New Roman", serif;

  --fs-base:      16px;
  --lh-base:      1.65;

  /* --- Radius --- */
  --radius-lg:    12px;
  --radius:       10px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --radius-pill:  999px;

  /* --- Shadow --- */
  --shadow-sm:    0 1px 2px rgba(16,24,40,.05);
  --shadow:       0 1px 2px rgba(16,24,40,.05), 0 8px 24px -10px rgba(16,24,40,.18);
  --shadow-lg:    0 2px 4px rgba(16,24,40,.06), 0 18px 40px -16px rgba(16,24,40,.28);

  /* --- Layout --- */
  --maxw:         68rem;    /* main content width */
  --maxw-narrow:  46rem;    /* long-form reading width */
  --maxw-wide:    78rem;    /* wide layouts (e.g. topic with sidebar) */

  /* --- Motion --- */
  --ease:         cubic-bezier(.4, 0, .2, 1);
}


/* ==========================================================================
   02. RESET & BASE
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

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

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


/* ==========================================================================
   03. LAYOUT CONTAINERS & UTILITIES
   ========================================================================== */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.wrap-narrow { max-width: var(--maxw-narrow); }
.wrap-wide   { max-width: var(--maxw-wide); }

.band {
  padding: 3.5rem 0;
}
.band.tight { padding: 2.75rem 0; }
.band.alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stack-sm > * + * { margin-top: .5rem; }
.stack    > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 2rem; }

.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .8rem 1.1rem;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 0; }


/* ==========================================================================
   04. TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -.015em;
  margin: 0 0 .6rem;
  font-weight: 700;
}

h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem); line-height: 1.15; letter-spacing: -.025em; }
h2 { font-size: clamp(1.45rem, 1.15rem + 1.1vw, 1.95rem); line-height: 1.2; letter-spacing: -.02em; }
h3 { font-size: 1.15rem; letter-spacing: -.01em; }
h4 { font-size: 1rem; }
h5 { font-size: .92rem; }
h6 { font-size: .85rem; }

p {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color .15s var(--ease);
}
a:hover { color: var(--accent-dk); }

strong, b { font-weight: 650; color: var(--ink); }
em, i     { font-style: italic; }

small { font-size: .85em; color: var(--muted); }

ul, ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
  color: var(--ink-soft);
}
li { margin-bottom: .3rem; }
li > ul, li > ol { margin-top: .3rem; }

blockquote {
  margin: 1.5rem 0;
  padding: .75rem 1.25rem;
  border-left: 4px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

.lead {
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

/* Section headings + kicker */
.section-head {
  max-width: var(--maxw-narrow);
  margin-bottom: 2rem;
}
.section-kicker {
  margin: 0 0 .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}
.section-head h2 { margin-bottom: .6rem; }
.section-head p  { margin: 0; color: var(--muted); font-size: 1.02rem; }


/* ==========================================================================
   05. TOP NAVIGATION BAR
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.01em;
  margin-right: auto;
}
.brand:hover { color: var(--ink); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--accent-dk), var(--accent-lt));
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-text b    { font-size: .95rem; }
.brand-text span { font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: .02em; }

.topnav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.topnav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .88rem;
  font-weight: 550;
  padding: .45rem .7rem;
  border-radius: var(--radius-pill);
  transition: background .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.topnav a:hover { background: var(--accent-soft); color: var(--accent-dk); }
.topnav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dk);
}
.topnav a.nav-cta {
  background: var(--accent);
  color: #fff;
  margin-left: .35rem;
}
.topnav a.nav-cta:hover { background: var(--accent-dk); color: #fff; }


/* ==========================================================================
   06. SITE FOOTER
   ========================================================================== */

.site-footer {
  background: #0f1b2b;
  color: #9fb3cb;
  padding: 3rem 0 2rem;
  margin-top: 3.5rem;
  font-size: .88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(9rem, 1fr));
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.footer-brand {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.footer-brand .brand-mark { background: rgba(255,255,255,.14); }
.footer-brand b  { color: #fff; display: block; font-size: .98rem; }
.footer-brand p  {
  margin: .35rem 0 0;
  font-size: .85rem;
  line-height: 1.6;
  max-width: 24rem;
  color: #9fb3cb;
}

.footer-col h3 {
  margin: 0 0 .7rem;
  font-size: .72rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #7f96b3;
  font-weight: 700;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .35rem;
}
.footer-col a {
  color: #c3d5ea;
  text-decoration: none;
  font-size: .87rem;
}
.footer-col a:hover { color: #fff; text-decoration: underline; }

.footer-bottom {
  padding-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: space-between;
  font-size: .82rem;
  color: #7f96b3;
}
.footer-bottom p { margin: 0; color: inherit; }


/* ==========================================================================
   07. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .78rem 1.3rem;
  border-radius: var(--radius-sm);
  font-size: .94rem;
  font-weight: 650;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s var(--ease), background .15s var(--ease),
              box-shadow .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .arrow { font-size: 1.05em; line-height: 1; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(19,55,95,.6);
}
.btn-primary:hover { background: var(--accent-dk); color: #fff; }

.btn-secondary {
  background: var(--card);
  color: var(--accent-dk);
  border-color: var(--accent-line);
}
.btn-secondary:hover { background: var(--accent-soft); }

.btn-ghost {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.35);
  color: #fff;
}
.btn-ghost:hover { background: rgba(255,255,255,.18); color: #fff; }

.btn-white {
  background: #fff;
  color: var(--accent-dk);
  box-shadow: 0 6px 18px -6px rgba(0,0,0,.45);
}
.btn-white:hover { background: #f0f6ff; color: var(--accent-dk); }

.btn-sm { padding: .5rem .85rem; font-size: .85rem; }
.btn-lg { padding: .95rem 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}


/* ==========================================================================
   08. SECTION HEADINGS & KICKERS
   ========================================================================== */

/* (see §04 for .section-head and .section-kicker) */


/* ==========================================================================
   09. CARDS
   ========================================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.6rem;
}

.card-lg { padding: 1.75rem 1.75rem 1.5rem; }
.card-sm { padding: 1.1rem 1.25rem; }

.card > h2:first-child,
.card > h3:first-child,
.card > h4:first-child { margin-top: 0; }

.card > h2 {
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 2px solid var(--accent-soft);
  font-size: 1.35rem;
  letter-spacing: -.01em;
  color: var(--accent-dk);
}

.card-hover {
  transition: box-shadow .18s var(--ease), transform .18s var(--ease),
              border-color .18s var(--ease);
}
.card-hover:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--accent-line);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
}

.card-grid-sm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
}


/* ==========================================================================
   10. HERO
   ========================================================================== */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 460px at 12% -10%, #2f6db8 0%, transparent 62%),
    radial-gradient(900px 420px at 92% 8%, #0f7b6c 0%, transparent 58%),
    linear-gradient(150deg, #0d2745 0%, #163a68 48%, #1f4e8c 100%);
  color: #fff;
  padding: 4rem 0 4.5rem;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 78%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr);
  gap: 3rem;
  align-items: center;
}

.hero-inner.single { grid-template-columns: 1fr; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 1.1rem;
  padding: .3rem .8rem .3rem .55rem;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius-pill);
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #d5e6fa;
}
.hero-eyebrow .dot {
  width: .5rem; height: .5rem; border-radius: 50%;
  background: #5eead4;
  box-shadow: 0 0 0 3px rgba(94,234,212,.25);
}

.hero h1 { color: #fff; margin-bottom: .35rem; }
.hero h1 .light {
  display: block;
  font-size: .52em;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #a9c6e8;
  margin-bottom: .5rem;
}

.hero-lede {
  margin: 0 0 1.75rem;
  font-size: 1.06rem;
  line-height: 1.7;
  color: #d6e5f6;
  max-width: 40rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: 1.75rem;
}
.hero-actions:last-child { margin-bottom: 0; }

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.18);
  font-size: .85rem;
  color: #bcd4f0;
}
.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.hero-meta strong { color: #fff; font-weight: 600; }

/* Compact hero for inner pages */
.hero-compact { padding: 2.5rem 0 2.75rem; }
.hero-compact h1 { font-size: clamp(1.5rem, 1.15rem + 1.8vw, 2.25rem); }
.hero-compact .hero-lede { font-size: .98rem; margin-bottom: 1.25rem; }


/* ==========================================================================
   11. STAT LIST  (hero-card component)
   ========================================================================== */

.hero-card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: var(--shadow-lg);
}
.hero-card h2 {
  margin: 0 0 1rem;
  font-size: .74rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #a9c6e8;
  font-weight: 700;
  padding: 0;
  border: 0;
}

.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .85rem;
}
.stat-list li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  align-items: baseline;
  gap: .9rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid rgba(255,255,255,.13);
  margin: 0;
}
.stat-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.stat-num {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stat-label {
  font-size: .88rem;
  color: #cfe0f4;
  line-height: 1.4;
}
.stat-label b {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
}


/* ==========================================================================
   12. MODULES & CURRICULUM GRID
   ========================================================================== */

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
}

.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.35rem 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease),
              border-color .18s var(--ease);
}
.module-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--accent-line);
}

.module-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .7rem;
}

.module-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  height: 2.35rem;
  padding: 0 .5rem;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dk);
  font-weight: 750;
  font-size: .85rem;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.module-count {
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.module-card h3 {
  margin: 0 0 .5rem;
  font-size: 1.1rem;
  line-height: 1.3;
  letter-spacing: -.01em;
}
.module-card > p {
  margin: 0 0 1rem;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Simple module summary card (module landing pages) */
.module-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--card-tint);
}
.module-summary > h3 {
  margin: 0 0 .6rem;
  font-size: 1.05rem;
  color: var(--accent-dk);
}

/* ==========================================================================
   SIDEBAR — cross-module navigation
   ========================================================================== */

.sidebar .module-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .1rem;
}

.sidebar .module-nav li { margin: 0; }

.sidebar .module-nav a {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  gap: .45rem;
  align-items: baseline;
  padding: .38rem .7rem;
  border-radius: var(--radius-xs);
  font-size: .86rem;
  line-height: 1.4;
  text-decoration: none;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  transition: background .14s var(--ease), color .14s var(--ease),
              border-color .14s var(--ease);
}

.sidebar .module-nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-dk);
}

.sidebar .module-nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dk);
  border-left-color: var(--accent);
  font-weight: 620;
}

.sidebar .module-nav .m-id {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sidebar .module-nav a[aria-current="page"] .m-id {
  color: var(--accent-dk);
}

/* Slightly tighter row on narrow viewports */
@media (max-width: 48rem) {
  .sidebar .module-nav a {
    grid-template-columns: 1.9rem minmax(0, 1fr);
    font-size: .84rem;
    padding: .34rem .55rem;
  }
}

/* Unit link list inside module card */
.unit-links {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: grid;
  gap: .1rem;
  flex: 1;
}
.unit-links li { margin: 0; }
.unit-links a {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: .6rem;
  align-items: baseline;
  padding: .45rem .5rem .45rem .25rem;
  border-radius: var(--radius-xs);
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .9rem;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.unit-links a:hover { background: var(--accent-soft); color: var(--accent-dk); }
.unit-links .u-id {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Footer of module card */
.module-foot {
  padding-top: .9rem;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.module-foot a {
  font-size: .85rem;
  font-weight: 650;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.module-foot a:hover { text-decoration: underline; }


/* ==========================================================================
   13. LEARNING OUTCOMES & CALLOUTS
   ========================================================================== */

.outcome-block {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem .75rem;
  margin-bottom: 1rem;
}
.outcome-block h3,
.outcome-block h4 {
  margin: 0 0 .5rem;
  font-size: .82rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-dk);
}
.outcome-block ul { margin-bottom: .25rem; }
.outcome-block li::marker { color: var(--accent); }

.outcome-cards { display: grid; gap: .9rem; }

.outcome {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.outcome:nth-child(2) { border-left-color: var(--teal); }
.outcome:nth-child(3) { border-left-color: var(--gold); }
.outcome h3 {
  margin: 0 0 .55rem;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.outcome ul { margin: 0; padding-left: 1.1rem; }
.outcome li { margin-bottom: .3rem; font-size: .94rem; color: var(--ink-soft); }
.outcome li:last-child { margin-bottom: 0; }
.outcome li::marker { color: var(--accent); }
.outcome:nth-child(2) li::marker { color: var(--teal); }
.outcome:nth-child(3) li::marker { color: var(--gold); }
.outcome strong { color: var(--ink); font-weight: 650; }

/* Callouts — 4 flavours */
.callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .95rem 1.15rem .75rem;
  margin: 0 0 1rem;
  font-size: .95rem;
}
.callout h4 {
  margin: 0 0 .35rem;
  font-size: .74rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--accent-dk);
}
.callout p:last-child { margin-bottom: 0; }

.callout-tip {
  background: var(--teal-soft);
  border-left-color: var(--teal);
}
.callout-tip h4 { color: var(--teal); }

.callout-warn {
  background: var(--gold-soft);
  border-left-color: var(--gold);
}
.callout-warn h4 { color: var(--gold); }

.callout-danger {
  background: var(--red-soft);
  border-left-color: var(--red);
}
.callout-danger h4 { color: var(--red); }

.callout-success {
  background: var(--green-soft);
  border-left-color: var(--green);
}
.callout-success h4 { color: var(--green); }

/* ==========================================================================
   APPENDIX — Module landing page
   ========================================================================== */

/* Two-column tutorial list inside a unit card */
.unit-links.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: .1rem 1.5rem;
}

/* Unit titles that link to the unit overview page */
.card h3 a,
.module-card h3 a {
  color: inherit;
  text-decoration: none;
}
.card h3 a:hover,
.module-card h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ==========================================================================
   14. STEPS / PROCESS FLOW
   ========================================================================== */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.1rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.4rem 1.2rem 1.2rem;
  box-shadow: var(--shadow-sm);
  margin: 0;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  top: -.75rem;
  left: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  font-size: .9rem;
  box-shadow: 0 4px 12px -4px rgba(31,78,140,.6);
}
.steps b {
  display: block;
  font-size: .98rem;
  margin-bottom: .35rem;
}
.steps p {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
}
.steps a { font-weight: 600; }

/* Vertical flow (numbers with zero-padding) *//* Vertical flow (numbers with zero-padding) */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: flow;
  display: grid;
  gap: .55rem;
}
.flow li {
  counter-increment: flow;
  position: relative;
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);  /* minmax(0,…) allows shrink */
  gap: 0 .9rem;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .7rem .9rem;
  box-shadow: var(--shadow-sm);
  margin: 0;
}

/* Counter sits in column 1 and spans both text rows */
.flow li::before {
  content: counter(flow, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: start;
  font-size: .74rem;
  font-weight: 750;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: .15rem 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

/* Title → row 1, column 2 */
.flow li > b {
  grid-column: 2;
  grid-row: 1;
  display: block;
  font-size: .93rem;
  font-weight: 650;
  color: var(--ink);
  min-width: 0;
}

/* Description → row 2, column 2 */
.flow li > span {
  grid-column: 2;
  grid-row: 2;
  display: block;
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.5;
  min-width: 0;
  overflow-wrap: break-word;
}


/* ==========================================================================
   15. FAQ (details / summary)
   ========================================================================== */

.faq { display: grid; gap: .6rem; }

.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.faq summary {
  cursor: pointer;
  padding: .95rem 1.2rem;
  font-weight: 620;
  font-size: .96rem;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: background .14s var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  width: .55rem;
  height: .55rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg);
  transition: transform .2s var(--ease);
  flex: none;
  margin-bottom: .2rem;
}
.faq details[open] summary::after {
  transform: rotate(-135deg);
  margin-bottom: -.2rem;
}
.faq summary:hover { background: #f7faff; }

.faq .faq-body {
  padding: 0 1.2rem 1.1rem;
  font-size: .92rem;
  color: var(--ink-soft);
  line-height: 1.65;
}
.faq .faq-body p { margin: 0 0 .7rem; }
.faq .faq-body p:last-child { margin-bottom: 0; }
.faq .faq-body ul { margin: 0 0 .7rem; padding-left: 1.2rem; }


/* ==========================================================================
   16. TABLES
   ========================================================================== */

.table-scroll {
  overflow-x: auto;
  margin-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
  color: var(--ink-soft);
}

caption {
  caption-side: top;
  text-align: left;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: .5rem;
}

th, td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

thead th {
  background: var(--accent-soft);
  color: var(--accent-dk);
  font-size: .78rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--accent-line);
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover { background: #f2f6fc; }

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tfoot td {
  font-weight: 700;
  background: var(--accent-soft);
  border-top: 2px solid var(--accent-line);
  border-bottom: 0;
  color: var(--accent-dk);
}


/* ==========================================================================
   17. ASSESSMENT CARDS & ASSIGNMENT LISTS
   ========================================================================== */

.assess-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.assess-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.assess-card .pct {
  font-size: 1.75rem;
  font-weight: 750;
  letter-spacing: -.03em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: .5rem;
  font-variant-numeric: tabular-nums;
}
.assess-card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.assess-card p {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
}

.assign-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .5rem;
}
.assign-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: minmax(9rem, auto) 1fr auto;
  gap: .5rem 1.1rem;
  align-items: center;
  padding: .75rem 1rem;
  box-shadow: var(--shadow-sm);
  margin: 0;
}
.assign-list .a-id {
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent-dk);
}
.assign-list .a-title { font-size: .93rem; color: var(--ink-soft); }
.assign-list a {
  font-size: .84rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.assign-list a:hover { text-decoration: underline; }


/* ==========================================================================
   18. STACK / TOOL GRID
   ========================================================================== */

.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}
.stack-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.stack-item b {
  display: block;
  font-size: .93rem;
  margin-bottom: .2rem;
}
.stack-item span {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
}


/* ==========================================================================
   19. BADGES & TAGS
   ========================================================================== */

.tag {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-dk);
  border: 1px solid var(--accent-line);
  white-space: nowrap;
}
.tag.teal  { background: var(--teal-soft);  color: var(--teal);  border-color: var(--teal-line); }
.tag.gold  { background: var(--gold-soft);  color: var(--gold);  border-color: var(--gold-line); }
.tag.red   { background: var(--red-soft);   color: var(--red);   border-color: var(--red-line); }
.tag.green { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dk);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-pill);
  padding: .05rem .55rem;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-due {
  background: var(--red-soft);
  border-color: var(--red-line);
  color: var(--red);
}
.badge-week {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.grade-chip {
  display: inline-block;
  min-width: 2.6rem;
  text-align: center;
  font-weight: 650;
  color: var(--accent-dk);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: .05rem .4rem;
}


/* ==========================================================================
   20. CODE & SYNTAX
   ========================================================================== */

code,
.mono,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: .87em;
}

/* Inline code */
code {
  background: var(--accent-soft);
  color: var(--accent-dk);
  padding: .1rem .35rem;
  border-radius: 4px;
  word-break: break-word;
}

/* Reset inline styling when inside a block */
pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

pre {
  margin: 0 0 1.25rem;
  background: #0f1b2b;
  color: #e5edf7;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .87rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
  tab-size: 4;
}
pre code { font-family: var(--font-mono); }

/* Light variant for inline examples */
pre.code-light {
  background: #f7f9fc;
  color: var(--ink);
  border: 1px solid var(--line);
}

kbd {
  display: inline-block;
  background: var(--card);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: .1rem .4rem;
  font-size: .82em;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: 1px;
}

/* Output block */
pre.output {
  background: var(--line-soft);
  color: var(--ink);
  border-left: 4px solid var(--muted);
}


/* ==========================================================================
   21. BREADCRUMBS
   ========================================================================== */

.breadcrumb {
  font-size: .84rem;
  color: var(--muted);
  padding: 1rem 0 .25rem;
}
.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
}
.breadcrumb li { margin: 0; display: inline-flex; align-items: center; }
.breadcrumb li + li::before {
  content: "/";
  color: var(--muted-light);
  margin-right: .35rem;
}
.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }
/* ==========================================================================
   22. UNIT / TUTORIAL PAGE LAYOUT
   ========================================================================== */

/* Two-column layout: sidebar + main */
.page-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.page-layout.wide       { grid-template-columns: 17rem minmax(0, 1fr); }
.page-layout.no-sidebar { grid-template-columns: minmax(0, 1fr); }

.page-main { min-width: 0; }

/* Page header for unit / tutorial pages */
.page-header {
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--line);
}
.page-header .page-kicker {
  margin: 0 0 .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
}
.page-header h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem);
  margin-bottom: .5rem;
}
.page-header .page-lede {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  max-width: 42rem;
}

/* Unit landing page: outcome + activity grid */
.unit-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Tutorial grid on a unit page */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: .9rem;
}
.tutorial-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .16s var(--ease), transform .16s var(--ease),
              border-color .16s var(--ease);
}
.tutorial-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--accent-line);
  color: inherit;
}
.tutorial-card .t-id {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .35rem;
}
.tutorial-card h3 {
  margin: 0 0 .35rem;
  font-size: 1rem;
  line-height: 1.35;
}
.tutorial-card p {
  margin: 0;
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.5;
}


/* ==========================================================================
   23. TUTORIAL CONTENT BLOCKS
   ========================================================================== */

/* (prose, figure, worked-example, split rules — unchanged) */

/* Section blocks inside a tutorial page */
.tutorial-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 5.5rem;
}
.tutorial-section > h2 {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  margin: 0 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--accent-soft);
  font-size: 1.35rem;
  color: var(--accent-dk);
  /* do not inherit character-breaking from prose containers */
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.tutorial-section > h2 .num {
  flex: 0 0 auto;              /* never shrink, never wrap */
  min-width: 1.7rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Figure / diagram */
figure {
  margin: 1.5rem 0;
}
figure img,
figure svg {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
}
figcaption {
  margin-top: .55rem;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Worked example */
.worked-example {
  background: var(--card-tint);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.worked-example h4 {
  margin: 0 0 .6rem;
  font-size: .78rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--teal);
}
.worked-example ol { margin-bottom: 0; }

/* Key term / definition list */
dl.terms {
  display: grid;
  gap: .9rem;
  margin: 1.25rem 0;
}
dl.terms dt {
  font-weight: 650;
  color: var(--ink);
  font-size: .96rem;
}
dl.terms dd {
  margin: .2rem 0 0;
  color: var(--ink-soft);
  font-size: .95rem;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}

/* Two-column figure/text layout inside prose */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  align-items: start;
  margin: 1.5rem 0;
}


/* ==========================================================================
   24. INTERACTIVE ACTIVITIES
   ========================================================================== */

.activity {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin: 1.75rem 0;
}
.activity h4 {
  margin: 0 0 .5rem;
  font-size: .78rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--accent-dk);
}
.activity h4::before {
  content: "◆";
  margin-right: .45rem;
  color: var(--accent);
  font-size: .8em;
}
.activity p:last-child { margin-bottom: 0; }
.activity ol, .activity ul { margin-bottom: 0; }

/* Notebook / code launch box */
.notebook {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
  margin: 1rem 0;
}
.notebook .icon {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent-dk);
  font-size: .7rem;
  font-weight: 800;
  flex: none;
}
.notebook .nb-body { flex: 1; min-width: 0; }
.notebook .nb-body b { display: block; font-size: .92rem; }
.notebook .nb-body span { font-size: .84rem; color: var(--muted); }


/* ==========================================================================
   25. SELF-CHECK & QUIZ COMPONENTS
   ========================================================================== */

.self-check {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}
.self-check > h4 {
  margin: 0 0 .9rem;
  font-size: .78rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--accent-dk);
}

/* Quiz question */
.question {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1rem;
}
.question .q-num {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .35rem;
}
.question .q-text {
  font-weight: 620;
  color: var(--ink);
  margin-bottom: .9rem;
  font-size: 1rem;
}

/* Multiple-choice options */
.options {
  list-style: none;
  margin: 0 0 .5rem;
  padding: 0;
  display: grid;
  gap: .4rem;
}
.options li { margin: 0; }
.options label {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .65rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: .94rem;
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.options label:hover { background: #f7faff; border-color: var(--accent-line); }
.options input[type="radio"],
.options input[type="checkbox"] {
  margin-top: .28rem;
  accent-color: var(--accent);
  flex: none;
}
.options input:checked + span { color: var(--accent-dk); font-weight: 600; }

/* Answer reveal */
.answer {
  border-top: 1px dashed var(--line);
  margin-top: .9rem;
  padding-top: .9rem;
}
.answer summary {
  cursor: pointer;
  font-size: .85rem;
  font-weight: 650;
  color: var(--accent);
  list-style: none;
}
.answer summary::-webkit-details-marker { display: none; }
.answer summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform .18s var(--ease);
}
.answer[open] summary::before { content: "▾ "; }
.answer .answer-body {
  margin-top: .7rem;
  font-size: .92rem;
  color: var(--ink-soft);
  line-height: 1.65;
  padding: .9rem 1.1rem;
  background: var(--accent-soft);
  border-radius: var(--radius-xs);
}

/* Score bar (for quiz result pages) */
.score-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.score-bar .score-value {
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.score-bar .score-label {
  font-size: .86rem;
  color: var(--muted);
}

.progress-track {
  flex: 1;
  height: .5rem;
  background: var(--line-soft);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-lt));
  border-radius: inherit;
}


/* ==========================================================================
   26. TOPIC PAGINATION (PREV / NEXT)
   ========================================================================== */

.pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
.pagination a {
  display: block;
  padding: 1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .16s var(--ease), border-color .16s var(--ease),
              transform .16s var(--ease);
}
.pagination a:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent-line);
  transform: translateY(-2px);
  color: inherit;
}
.pagination .dir {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .3rem;
}
.pagination .title {
  font-size: .95rem;
  font-weight: 620;
  color: var(--accent-dk);
}
.pagination .next { text-align: right; }
.pagination .next .dir::after { content: " →"; }
.pagination .prev .dir::before { content: "← "; }
.pagination .spacer { visibility: hidden; }


/* ==========================================================================
   27. SIDEBAR NAVIGATION
   ========================================================================== */

.sidebar {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-right: .5rem;
}

.sidebar h3 {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .6rem;
  font-weight: 700;
}
.sidebar nav + h3 { margin-top: 1.5rem; }

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .1rem;
}
.sidebar li { margin: 0; }

.sidebar a {
  display: block;
  padding: .45rem .7rem;
  border-radius: var(--radius-xs);
  font-size: .88rem;
  text-decoration: none;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  transition: background .14s var(--ease), color .14s var(--ease),
              border-color .14s var(--ease);
}
.sidebar a:hover {
  background: var(--accent-soft);
  color: var(--accent-dk);
}
.sidebar a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dk);
  border-left-color: var(--accent);
  font-weight: 620;
}

.sidebar .unit-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted-light);
  padding: .9rem .7rem .35rem;
}
.sidebar .unit-label:first-child { padding-top: 0; }


/* ==========================================================================
   28. PROGRESS INDICATORS
   ========================================================================== */

/* Horizontal step tracker (e.g. unit progress) */
.step-tracker {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  counter-reset: tracker;
}
.step-tracker li {
  counter-increment: tracker;
  margin: 0;
}
.step-tracker a,
.step-tracker span {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
  background: var(--card);
  transition: all .15s var(--ease);
}
.step-tracker a:hover { border-color: var(--accent-line); color: var(--accent-dk); }
.step-tracker .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.step-tracker .done {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}


/* ==========================================================================
   29. CTA BAND
   ========================================================================== */

.cta-band {
  background: linear-gradient(140deg, #0d2745 0%, #163a68 55%, #1f4e8c 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: center;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 {
  margin: 0 0 .6rem;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem);
  letter-spacing: -.02em;
  color: #fff;
}
.cta-band p {
  margin: 0;
  color: #cfe0f4;
  font-size: .97rem;
  max-width: 38rem;
}
.cta-band .hero-actions { margin: 0; }


/* ==========================================================================
   30. PRINT STYLES
   ========================================================================== */

@media print {
  body {
    background: #fff;
    font-size: 10.5pt;
    color: #000;
  }

  .topbar,
  .site-footer,
  .cta-band,
  .hero-actions,
  .skip-link,
  .toc,
  .pagination,
  .sidebar { display: none !important; }

  .hero {
    background: none !important;
    color: #000;
    padding: 0 0 1rem;
  }
  .hero h1,
  .hero-lede,
  .hero-meta,
  .hero-eyebrow { color: #000 !important; }
  .hero::after { display: none; }
  .hero-card {
    background: none;
    border: 1px solid #999;
    box-shadow: none;
  }
  .stat-num,
  .stat-label,
  .stat-label b { color: #000 !important; }

  a { color: #000; text-decoration: none; }

  .card,
  .module-card,
  .assess-card,
  .steps li,
  .faq details,
  .outcome,
  .stack-item,
  .topic-card,
  .question,
  .activity,
  .worked-example {
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .band { padding: 1rem 0; }
  .wrap { padding: 0; max-width: none; }

  table { font-size: 9.5pt; }
  thead th { background: #eee !important; color: #000; }

  .faq details[open] .faq-body { display: block; }

  .page-layout { grid-template-columns: 1fr; }
}


/* ==========================================================================
   31. RESPONSIVE BREAKPOINTS
   ========================================================================== */

@media (max-width: 64rem) {
  .hero-inner { grid-template-columns: 1fr; gap: 2.25rem; }
  .hero-card { max-width: 34rem; }

  .about-grid,
  .anatomy { grid-template-columns: 1fr; gap: 1.75rem; }

  .cta-band { grid-template-columns: 1fr; gap: 1.5rem; }

  .page-layout,
  .page-layout.wide {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 48rem) {
  :root { --fs-base: 15.5px; }

  .topnav a { padding: .4rem .55rem; font-size: .83rem; }
  .brand-text span { display: none; }

  .band { padding: 2.5rem 0; }
  .band.tight { padding: 2rem 0; }

  .assign-list li { grid-template-columns: 1fr; gap: .3rem; }
  .assign-list .a-id { font-size: .72rem; }

  .cta-band { padding: 1.75rem 1.35rem; }
  .hero { padding: 2.75rem 0 3rem; }
  .hero-compact { padding: 2rem 0 2.25rem; }

  .pagination { grid-template-columns: 1fr; }
  .pagination .next { text-align: left; }

  .unit-links a { grid-template-columns: 1fr; gap: .1rem; }
  .unit-links .u-id { margin-bottom: .05rem; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 34rem) {
  .wrap { padding: 0 1.1rem; }
  .topbar-inner { padding: .55rem 1.1rem; }

  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }

  .card, .card-lg { padding: 1.25rem 1.1rem; }
  .stat-list li { grid-template-columns: 2.8rem 1fr; gap: .7rem; }
  .stat-num { font-size: 1.3rem; }

  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }

  .btn-group { flex-direction: column; align-items: stretch; }
  .btn { justify-content: center; }
}

/* ==========================================================================
   APPENDIX C — Layout hardening for tutorial and unit pages
   --------------------------------------------------------------------------
   Prevents wide content (code, tables, SVG, long words) from blowing out the
   grid column and overlapping the sticky sidebar. Also establishes explicit
   stacking contexts so that sticky and non-sticky elements paint in the
   correct order.
   ========================================================================== */

/* 1. Grid item sizing — the single most important fix. */
.page-layout {
  align-items: start;
  isolation: isolate;   /* creates a new stacking context for the whole grid */
}

.page-layout > * {
  min-width: 0;         /* allow grid items to shrink below content width */
}

/* 2. Contain the main column and let it wrap long words gracefully. */
.page-main {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: break-word;   /* was: word-break: break-word */
  word-break: normal;
  hyphens: auto;
}

/* 3. Wide media and blocks scroll rather than overflow. */
.page-main pre,
.page-main table,
.page-main figure,
.page-main img,
.page-main svg,
.page-main iframe,
.page-main video {
  max-width: 100%;
}

.page-main pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-main figure,
.page-main .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 4. Explicit stacking so the sidebar never paints over main content. */
.topbar      { z-index: 100; }
.sidebar     { z-index: 1; }
.page-main   { position: relative; z-index: 0; }

/* 5. Make the sticky sidebar robust across browsers. */
.sidebar {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  overscroll-behavior: contain;   /* prevent scroll chaining to the page */
}

/* 6. Fallback for browsers without sticky support. */
@supports not (position: sticky) {
  .sidebar {
    position: relative;
    top: 0;
    max-height: none;
    overflow: visible;
  }
}

/* 7. Long unbreakable strings (URLs, file paths, hashes) inside prose. */
.prose code,
.tutorial-section code,
.card code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 8. Tables inside tutorial sections must respect the column width. */
.tutorial-section .table-scroll {
  max-width: 100%;
}