/*
 * components.css — Reusable UI Components
 * Teaching Portfolio — Dr. Christopher Teh Boon Sung
 *
 * Design principles:
 *   - 0px border-radius everywhere (sharp, academic rigour)
 *   - No 1px divider lines — tonal background shifts only
 *   - Glassmorphism for floating nav elements
 *   - "Paper-on-Stone" card layering
 */

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: 0 var(--space-8);
  background: rgba(26, 46, 28, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.site-nav > nav {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav > nav::-webkit-scrollbar {
  display: none;
}

.nav-brand {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  /* Reset button defaults */
  background: none;
  border: none;
  padding: 0;
  height: 100%;
  cursor: pointer;
  line-height: 1;
}

.nav-brand:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.nav-chapters {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
  margin: 0;
  height: 100%;
  min-width: max-content;
}

/* Ensure li items don't add vertical offset */
.nav-chapters li {
  display: flex;
  align-items: center;
  height: 100%;
  margin-top: 0;
}

/* Material Symbols Outlined — ultra-thin weight, no fill */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 1.1em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 100, 'GRAD' 0, 'opsz' 24;
  -webkit-font-smoothing: antialiased;
}

.nav-chapter-link {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  box-shadow: 0 1px 0 transparent;
  transition: color var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  height: 100%;
  /* line-height centering — matches the proven pattern from the reference project.
     -webkit-appearance strips Safari button defaults that defeat height/flex tricks. */
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
}

.nav-chapter-link:hover {
  color: var(--color-on-primary);
  text-decoration: none;
}

.nav-chapter-link.active {
  color: var(--color-accent);
  box-shadow: inset 0 -2px 0 var(--color-accent);
}

.nav-chapter-link .material-symbols-outlined {
  flex: 0 0 1.1em;
  width: 1.1em;
  overflow: hidden;
}

.nav-chapter-id {
  line-height: 1;
}

.nav-chapter-title {
  display: none;
}

/* Jump-to-chapter dropdown */
/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb-container {
  padding-top: calc(var(--nav-height) + var(--space-4));
  padding-bottom: var(--space-3);
  padding-left: var(--space-8);
  padding-right: var(--space-8);
  background: var(--color-bg);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  margin-top: 0;
}

.breadcrumb li + li::before {
  content: '/';
  margin-right: var(--space-2);
  color: var(--color-on-surface-faint);
}

.breadcrumb a {
  color: var(--color-on-surface-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.breadcrumb .current {
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   CHAPTER SIDEBAR
   Always starts collapsed. A persistent tab on the left edge
   lets the user open/close it. When open, it overlays content.
   ============================================================ */
.chapter-sidebar {
  position: fixed;
  left: 0;
  top: var(--nav-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface-low);
  z-index: var(--z-sidebar);
  overflow-y: auto;
  padding: var(--space-8) 0 var(--space-8);
  /* Start translated off-screen (collapsed) */
  transform: translateX(calc(-1 * var(--sidebar-width)));
  transition: transform var(--transition-base);
  box-shadow: none;
}

/* When open, slide in and cast a shadow */
.chapter-sidebar.open {
  transform: translateX(0);
  box-shadow: var(--shadow-float);
}

.sidebar-header {
  padding: 0 var(--space-5) var(--space-5);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-on-surface-muted);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  transition: color var(--transition-fast);
}

.sidebar-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.sidebar-toggle path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sidebar-toggle:hover { color: var(--color-primary); }

.sidebar-sections {
  list-style: none;
  padding: 0;
}

.sidebar-section-item {
  border-left: 3px solid transparent;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.sidebar-section-item.active {
  border-left-color: var(--color-accent);
  background: rgba(233, 193, 118, 0.08);
}

.sidebar-section-link {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  text-decoration: none;
  line-height: var(--leading-snug);
  transition: color var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.sidebar-section-num {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-on-surface-faint);
}

.sidebar-section-item.active .sidebar-section-link {
  color: var(--color-primary);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.3);
}

.sidebar-section-item.active .sidebar-section-num {
  color: var(--color-accent-dark);
}

.sidebar-section-link:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* Hamburger sidebar toggle — lives in the top nav, left of the brand */
.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 100%;
  flex-shrink: 0;
}

.nav-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  margin: 0;
  height: 100%;
  min-width: 44px;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.nav-hamburger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-hamburger-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  line-height: 1;
}

.nav-hamburger[hidden] {
  display: none !important;
}

.nav-chapter-menu-toggle {
  display: none;
}

.breadcrumb-link {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: inherit;
  text-decoration: none;
}

.nav-hamburger svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-hamburger path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.nav-hamburger:hover { color: var(--color-accent); }

/* ============================================================
   LANDING PAGE — HERO
   "The Graph-Paper Atlas" — drifting scientific grid on forest green
   ============================================================ */
.hero-landing {
  min-height: 92vh;
  /* Layered depth: a luminous green pool low-left (under the name),
     a darker fall-off top-right, over the base forest ink.
     Turns the flat slab into lit space without any image asset. */
  background:
    radial-gradient(135% 92% at 20% 86%, rgba(42, 72, 44, 0.60) 0%, rgba(42, 72, 44, 0) 52%),
    radial-gradient(120% 95% at 88% 4%,  rgba(9, 18, 10, 0.55) 0%, rgba(9, 18, 10, 0) 58%),
    var(--color-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding: calc(var(--nav-height) + var(--space-16)) var(--space-8) var(--space-20);
}

/* Drifting graph-paper grid — the agricultural data scientist's signature */
.hero-landing::before {
  content: '';
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(248, 249, 252, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 249, 252, 0.075) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: grid-drift 30s linear infinite;
  pointer-events: none;
  z-index: 2;
}

/* Diagonal amber wash */
.hero-landing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    transparent 25%,
    rgba(200, 134, 10, 0.05) 55%,
    transparent 85%
  );
  pointer-events: none;
  z-index: 2;
}


.hero-landing-inner {
  position: relative;
  z-index: 3;
  flex: 1;
  display: flex;
  align-items: flex-end;
  max-width: var(--container-max);
  width: 100%;
  margin: 0 auto;
}

.hero-content {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-16);
  align-items: end;
  width: 100%;
  padding-bottom: var(--space-12);
}

.hero-left {}

.hero-right {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  text-align: right;
  padding-bottom: var(--space-2);
}

.hero-award-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-accent);
  margin-bottom: var(--space-6);
  display: inline-block;
}

/* Small amber rule above the award label — a printer's registration mark */
.hero-award-label::before {
  content: '';
  display: block;
  width: 36px;
  height: 2px;
  background: var(--color-accent);
  margin-bottom: var(--space-4);
}

/* Geographic coordinates — the agricultural scientist's signature detail */
.hero-coordinates {
  position: absolute;
  bottom: var(--space-10);
  left: var(--space-8);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: rgba(200, 134, 10, 0.45);
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

.hero-name {
  font-family: var(--font-display);
  font-weight: 300;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--color-on-primary);
  margin-bottom: var(--space-8);
}

.hero-name-line1 {
  display: block;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  color: rgba(248, 249, 252, 0.62);  /* lifted from 0.5 — keeps the faded effect, clears AA-large */
  font-style: italic;
}

.hero-name-line2 {
  display: block;
  font-size: clamp(2.5rem, 7.5vw, 6.5rem);
}

.hero-credentials {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.hero-role {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(248, 249, 252, 0.62);  /* ~5.5:1 on forest — passes WCAG AA */
}

.hero-credentials-dot {
  width: 4px;
  height: 4px;
  background: var(--color-accent);
  display: inline-block;
  flex-shrink: 0;
  border-radius: 50%;
}

.hero-institution {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
  font-style: italic;
  font-weight: 300;
  color: rgba(248, 249, 252, 0.65);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-10);
  max-width: 28ch;
}

.hero-scroll-cue {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: rgba(248, 249, 252, 0.3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: flex-end;
}

.hero-scroll-cue::before {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent));
}

/* Decorative chapter number strip — floats at bottom of hero */
.hero-chapter-markers {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

.hero-chapter-markers span {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(6rem, 14vw, 12rem);
  font-weight: 300;
  color: rgba(248, 249, 252, 0.05);  /* doubled — a faint numeral frieze along the base */
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  transform: translateY(35%);
}

/* ============================================================
   CHAPTER INDEX — Table-of-contents style list
   Replaces the chapter card grid for a more editorial, unusual feel
   ============================================================ */
.chapters-section {
  padding: var(--space-24) var(--space-8);
  background: var(--color-bg);
}

.chapters-section-inner {
  max-width: var(--container-max);
  margin: 0 auto;
}

.chapters-section-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-faint);
  margin-bottom: var(--space-10);
}

/* The index list */
.chapter-index {
  display: flex;
  flex-direction: column;
}

.chapter-index-entry {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: var(--space-10);
  padding: var(--space-8) var(--space-4);
  border-top: 1px solid var(--color-surface-high);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: padding-left var(--transition-base);
}

.chapter-index-entry:last-child {
  border-bottom: 1px solid var(--color-surface-high);
}

/* Hover fill sweeps in from the left */
.chapter-index-entry::before {
  content: '';
  position: absolute;
  left: -100%;
  top: 0;
  bottom: 0;
  width: 100%;
  background: var(--color-surface-low);
  transition: left var(--transition-base);
  z-index: 0;
}

.chapter-index-entry:hover::before {
  left: 0;
}

.chapter-index-entry:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.chapter-index-number {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 300;
  color: rgba(26, 46, 28, 0.1);
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  position: relative;
  z-index: 1;
  transition: color var(--transition-base), transform var(--transition-base);
  transform: scale(1);
  display: inline-block;
}

.chapter-index-entry:hover .chapter-index-number,
.chapter-index-entry:focus-visible .chapter-index-number {
  color: var(--color-accent);
  transform: scale(1.08);
}

.chapter-index-body {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.chapter-index-label {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent-dark);
  margin-bottom: var(--space-2);
}

.chapter-index-title {
  font-family: var(--font-display);
  font-size: clamp(1.375rem, 2.8vw, 2rem);
  font-weight: 400;
  color: var(--color-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-3);
}

.chapter-index-summary {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  line-height: var(--leading-normal);
  max-width: 60ch;
}

.chapter-index-arrow {
  font-family: var(--font-label);
  font-size: 1.25rem;
  color: var(--color-on-surface-faint);
  position: relative;
  z-index: 1;
  transition: transform var(--transition-base), color var(--transition-base);
  flex-shrink: 0;
}

.chapter-index-entry:hover .chapter-index-arrow,
.chapter-index-entry:focus-visible .chapter-index-arrow {
  transform: translateX(10px);
  color: var(--color-accent-dark);
}

/* ============================================================
   CHAPTER HERO
   ============================================================ */
.chapter-hero {
  min-height: 55vh;
  background: var(--color-primary);
  padding: calc(var(--nav-height) + var(--space-16)) var(--space-8) var(--space-16);
  display: flex;
  align-items: flex-end;
  position: relative;
  overflow: hidden;
}

/* Same drifting graph-paper grid as landing hero */
.chapter-hero::before {
  content: '';
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(248, 249, 252, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 249, 252, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: grid-drift 30s linear infinite;
  pointer-events: none;
}

/* Diagonal accent wash — tints with the chapter's accent */
.chapter-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    145deg,
    transparent 30%,
    color-mix(in srgb, var(--color-accent) 5%, transparent) 60%,
    transparent 90%
  );
  pointer-events: none;
}

.chapter-hero-number {
  position: absolute;
  right: -0.05em;
  bottom: -0.2em;
  font-family: var(--font-display);
  font-size: clamp(14rem, 42vw, 36rem);
  font-weight: 300;
  color: rgba(200, 134, 10, 0.13);                                  /* fallback */
  color: color-mix(in srgb, var(--color-accent) 15%, transparent);  /* per-chapter hue */
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  letter-spacing: var(--tracking-tight);
}

.chapter-hero-inner {
  position: relative;
  z-index: 2;
  max-width: var(--container-max);
  width: 100%;
}

.chapter-hero-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.chapter-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 300;
  color: var(--color-on-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-6);
  max-width: 18ch;
}

.chapter-hero-thesis {
  font-family: var(--font-body);
  font-size: var(--text-heading-md);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.75);
  max-width: 50ch;
  line-height: var(--leading-normal);
}

/* ============================================================
   CHAPTER ACCENT STRIP
   Fixed gold vertical bar on the left edge — present only on chapter pages
   ============================================================ */
body.chapter-page::before {
  content: '';
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--color-accent);
  z-index: 200;
  pointer-events: none;
}

/* ============================================================
   HIGHLIGHTS STRIP
   ============================================================ */
.highlights-strip {
  background: var(--color-primary);
  padding: var(--space-12) var(--space-8);
  position: relative;
}

/* Subtle grid on highlights strip */
.highlights-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(248, 249, 252, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 249, 252, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.highlights-inner {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-8) var(--space-10);
  max-width: var(--container-max);
  position: relative;
  z-index: 1;
}

.highlight-item {
  padding-right: var(--space-6);
  border-right: 1px solid rgba(248, 249, 252, 0.1);
}

.highlight-item:last-child {
  border-right: none;
  padding-right: 0;
}

.highlight-stat {
  font-family: var(--font-display);
  font-size: var(--text-display-md);
  font-weight: 300;
  color: var(--color-on-primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.highlight-unit {
  font-family: var(--font-display);
  font-size: var(--text-heading-md);
  color: rgba(248, 249, 252, 0.55);
  margin-left: var(--space-1);
}

.highlight-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(248, 249, 252, 0.5);
  margin-top: var(--space-2);
  max-width: 20ch;
  line-height: var(--leading-snug);
}

/* ============================================================
   CHAPTER EDITORIAL SECTIONS
   Matches stitch-chapters-4: article spreads with 1/3 image + 2/3 text
   ============================================================ */
.chapter-editorial-sections {
  padding: var(--space-16) var(--space-8);
  max-width: var(--container-max);
  margin: 0 auto;
}

.chapter-editorial-header {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-surface-high);
}

.chapter-article-item {
  display: flex;
  gap: var(--space-10);
  align-items: flex-start;
  padding: var(--space-12) 0;
  padding-left: var(--space-4);
  border-top: 1px solid var(--color-surface-high);
  border-left: 3px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-base), border-left-color var(--transition-base),
              padding-left var(--transition-base);
}

.chapter-article-item:hover {
  border-left-color: var(--color-accent);
  padding-left: var(--space-6);
  background: rgba(26, 46, 28, 0.025);
}

.chapter-article-item:last-child {
  border-bottom: 1px solid var(--color-surface-high);
}

.chapter-article-item:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
  background: rgba(233, 193, 118, 0.06);
}

.chapter-article-item:nth-child(even) {
  flex-direction: row-reverse;
}

.chapter-article-image {
  flex: 0 0 33.333%;
  min-width: 200px;
  aspect-ratio: 4 / 3;
  background: var(--color-surface-highest);
  overflow: hidden;
}

.chapter-article-card {
  width: 100%;
  height: 100%;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-6);
  border-top: 2px solid var(--color-accent);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center center;
}

/* Thin overlay — always subtle, no darkening at rest */
.chapter-article-card-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  opacity: 0.08;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

/* Thumbnail displays at full fidelity at rest */
.chapter-article-card--has-image {
  transition: transform 0.4s ease, filter 0.4s ease;
  will-change: transform;
}

/* Hover: gentle zoom-in + slight brightness lift — portable across browsers/OS */
.chapter-article-item:hover .chapter-article-card--has-image {
  transform: scale(1.04);
  filter: brightness(1.06);
}

.chapter-article-item:hover .chapter-article-card-overlay {
  opacity: 0.15;
}

/* Section number — sits above the overlay */
.chapter-article-card-number {
  position: relative;
  z-index: 2;
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
  line-height: 1;
  transition: color 0.5s ease;
}

.chapter-article-item:hover .chapter-article-card-number {
  color: var(--color-accent);
}

.chapter-article-content {
  flex: 1 1 260px;
  min-width: 0;
  padding: 0 var(--space-6);
}

.chapter-article-number {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent-dark);
  margin-bottom: var(--space-3);
}

.chapter-article-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 300;
  color: var(--color-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-5);
}

.chapter-article-summary {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  color: var(--color-on-surface-muted);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-6);
  max-width: 50ch;
}

.chapter-article-cta {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: gap var(--transition-fast), color var(--transition-fast);
}

.chapter-article-cta:hover {
  color: var(--color-accent-dark);
  gap: var(--space-4);
}

/* ============================================================
   SECTION PAGE — HERO
   Large magazine-style section header with section number as watermark
   ============================================================ */
.section-hero {
  background: var(--color-surface-white);
  padding: var(--space-12) var(--space-8) var(--space-12);
  border-bottom: 3px solid var(--color-accent);
  position: relative;
  overflow: hidden;
}

.section-hero-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  /* No position: relative — allows section-hero-label to be positioned
     relative to section-hero instead */
}

/* Section number floats large as a background watermark — slightly rotated
   so it reads as a deliberate design choice, not an afterthought */
.section-hero-label {
  position: absolute;
  top: var(--space-4);
  right: var(--space-8);
  font-family: var(--font-display);
  font-size: clamp(7rem, 18vw, 14rem);
  font-weight: 300;
  color: rgba(26, 46, 28, 0.06);
  line-height: 1;
  letter-spacing: -0.04em;
  /* Reset label overrides */
  text-transform: none;
  margin-bottom: 0;
  display: block;
  pointer-events: none;
  user-select: none;
  transform: rotate(-6deg);
  transform-origin: top right;
}

.section-hero-position {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  margin: 0 0 var(--space-3);
  padding-top: var(--space-10);
  position: relative;
}

.section-hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  color: var(--color-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-8);
  max-width: 22ch;
}

.section-hero-pullquote {
  font-family: var(--font-display);
  font-size: var(--text-heading-lg);
  font-style: italic;
  font-weight: 300;
  color: var(--color-on-surface-muted);
  max-width: 55ch;
  line-height: var(--leading-snug);
  border-left: 3px solid var(--color-accent);
  padding-left: var(--space-6);
}

/* ============================================================
   SECTION CONTENT — MAGAZINE TWO-COLUMN LAYOUT
   Matches stitch-chapters-1: 40% text / 60% media
   ============================================================ */
.section-magazine-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  max-width: var(--container-max);
  margin: 0 auto;
}

.section-text-column {
  flex: 4 0 360px;
  min-width: 0;
  padding: var(--space-16) var(--space-10) var(--space-16) var(--space-8);
  border-right: 1px solid var(--color-surface-high);
}

.section-text-column .block-text {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-on-surface);
  margin-bottom: var(--space-8);
}

.section-text-column .block-text p + p { margin-top: var(--space-4); }

/* ------------------------------------------------------------
   LEAD PARAGRAPH — fine-press section opener
   A rubricated drop-cap initial (display serif, brand amber) sunk
   three lines via initial-letter, plus a small-caps first line.
   Scoped to the first prose block of the text column only.
   Browsers without initial-letter still get an amber display initial
   (graceful: coloured, just not sunk).
   ------------------------------------------------------------ */
.section-text-column .block-text--lead > p:first-child::first-letter {
  -webkit-initial-letter: 3;
  initial-letter: 3;
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  color: var(--color-accent-dark);
  margin-right: 0.09em;
}

.section-text-column .block-text--lead > p:first-child::first-line {
  font-variant-caps: small-caps;
  letter-spacing: 0.015em;
}

.section-text-column .block-stat {
  margin-bottom: var(--space-8);
}

.section-text-column .block-quote {
  margin-bottom: var(--space-8);
}

.section-media-column {
  flex: 6 0 480px;
  padding: var(--space-16) var(--space-8) var(--space-16) var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
}

.section-media-column--sticky {
  position: sticky;
  top: var(--nav-height);
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-accent) transparent;
}

.section-media-column--sticky::-webkit-scrollbar { width: 4px; }
.section-media-column--sticky::-webkit-scrollbar-thumb { background: var(--color-accent); }
.section-media-column--sticky::-webkit-scrollbar-track { background: transparent; }

.section-media-count {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-accent-dark);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-1) var(--space-3);
  margin-bottom: var(--space-1);
}

.fig-caption-num {
  color: var(--color-accent-dark);
  font-weight: 700;
}

.block-table-header .fig-caption-num {
  color: var(--color-accent-vivid);
}

.section-media-column .block-figure {
  border: 2px solid var(--color-surface-high);
  padding: var(--space-2);
}

.section-media-column .block-figure img {
  filter: grayscale(30%);
  transition: filter var(--transition-slow), transform var(--transition-slow);
}

.section-media-column .block-figure:hover img {
  filter: grayscale(0%);
  transform: scale(1.02);
}

.section-empty-text {
  color: var(--color-on-surface-faint);
  font-style: italic;
}

.section-empty-media {
  padding: var(--space-12);
  color: var(--color-on-surface-faint);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  text-align: center;
  border: 2px dashed var(--color-surface-high);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   CONTENT BLOCKS
   ============================================================ */

/* TEXT BLOCK */
.block-text {
  font-family: var(--font-body);
  font-size: var(--text-body-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-on-surface);
}

.block-text p + p { margin-top: var(--space-4); }

/* FIGURE BLOCK */
.block-figure {
  overflow: hidden;
}

.block-figure-link {
  display: block;
  cursor: zoom-in;
}

.block-figure img {
  width: 100%;
  height: auto;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.block-figure:hover img {
  transform: scale(1.02);
}

.block-figure figcaption {
  padding: var(--space-3) 0;
}

.block-figure-download {
  display: inline-block;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-surface-highest);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-on-surface-faint);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.block-figure-download:hover {
  color: var(--color-accent-dark);
}

/* STAT BLOCK */
.block-stat {
  padding: var(--space-8) 0;
  border-top: 2px solid var(--color-accent);
}

.block-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-display-md);
  font-weight: 300;
  color: var(--color-primary);
  letter-spacing: var(--tracking-tight);
  line-height: 1;
}

.block-stat-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  margin-top: var(--space-3);
  max-width: 20ch;
  line-height: var(--leading-snug);
}

.block-stat-note {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-faint);
  margin-top: var(--space-2);
  font-style: italic;
  max-width: 28ch;
}

/* QUOTE BLOCK */
.block-quote {
  padding: var(--space-6) var(--space-6) var(--space-6) var(--space-8);
  background: var(--color-surface-high);
  border-left: 3px solid var(--color-accent);
}

.block-quote-text {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-style: italic;
  font-weight: 300;
  color: var(--color-primary);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
}

.block-quote-attribution {
  margin-top: var(--space-3);
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent-dark);
}

/* PLACEHOLDER — TEXT */
.block-placeholder-text {
  border: 2px dashed var(--color-accent-dim);
  background: rgba(244, 244, 240, 0.5);
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  text-align: center;
}

.placeholder-label {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-accent-dim);
  margin-bottom: var(--space-3);
  display: block;
}

.block-placeholder-text .placeholder-description {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-faint);
  font-style: italic;
  max-width: 30ch;
}

/* PLACEHOLDER — FIGURE */
.block-placeholder-figure {
  border: 2px dashed var(--color-accent-dim);
  background: rgba(244, 244, 240, 0.5);
  aspect-ratio: 16 / 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

/* Subtle cross-hatch pattern */
.block-placeholder-figure::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(233, 193, 118, 0.04) 0px,
      rgba(233, 193, 118, 0.04) 1px,
      transparent 1px,
      transparent 16px
    );
  pointer-events: none;
}

.block-placeholder-figure .placeholder-description {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-faint);
  font-style: italic;
  max-width: 28ch;
  position: relative;
  margin-top: var(--space-6);
}

/* HEADING BLOCK */
.block-heading {
  font-family: var(--font-display);
  font-size: var(--text-heading-sm);
  font-weight: 700;
  color: var(--color-accent);
  margin-top: var(--space-8);
  margin-bottom: var(--space-2);
  letter-spacing: 0.01em;
}

/* REFERENCES BLOCK */
.block-references {
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-8);
  padding-top: var(--space-4);
}

.block-references-heading {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-on-surface-faint);
  margin-bottom: var(--space-3);
}

.block-references-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.block-references-list li {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  color: var(--color-on-surface-faint);
  line-height: 1.6;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
}

.block-references-list a {
  overflow-wrap: anywhere;
}

/* ============================================================
   SECTION FOOTER — Previous / Chapter / Next navigation
   ============================================================ */
.section-footer {
  background: var(--color-primary);
  padding: var(--space-8) var(--space-8);
  margin-top: var(--space-16);
  border-top: 3px solid var(--color-accent);
}

.section-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-6);
}

.section-footer-prev,
.section-footer-next {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(248, 249, 252, 0.55);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  transition: color var(--transition-fast), gap var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-footer-prev:hover,
.section-footer-next:hover {
  color: var(--color-accent);
  gap: var(--space-5);
}

.section-footer-prev { justify-content: flex-start; }
.section-footer-next { justify-content: flex-end; }

.section-footer-overview {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(248, 249, 252, 0.45);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--space-3) var(--space-5);
  text-align: center;
  transition: color var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.section-footer-overview:hover { color: var(--color-accent); }

/* ============================================================
   PROFILE BIO — Dark scholarly panel (inverted section)
   ============================================================ */
.profile-bio {
  background: var(--color-primary);
  padding: var(--space-20) var(--space-8);
  position: relative;
  overflow: hidden;
}

/* Drifting grid behind the bio — same atmospheric quality as hero */
.profile-bio::after {
  content: '';
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(248, 249, 252, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 249, 252, 0.035) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: grid-drift 35s linear infinite;
  pointer-events: none;
  z-index: 0;
}

.profile-bio-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-16);
  align-items: start;
  position: relative;
  z-index: 1;
}

.profile-bio-portrait-col {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.profile-bio-text-col {
  flex: 1 1 350px;
  min-width: 0;
}

/* Portrait frame — amber border echoes the accent colour */
.profile-bio-portrait {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
}

/* Thin amber frame inset — a printer's registration mark around the photo */
.profile-bio-portrait::after {
  content: '';
  position: absolute;
  inset: var(--space-3);
  border: 1px solid rgba(200, 134, 10, 0.35);
  pointer-events: none;
  z-index: 2;
}

.profile-bio-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  /* Warm desaturation — pulls the photo into the parchment palette,
     more refined than cold B&W */
  filter: grayscale(85%) sepia(20%) brightness(0.9);
  transition: filter var(--transition-slow);
  display: block;
}

.profile-bio-portrait:hover .profile-bio-portrait-img {
  filter: grayscale(60%) sepia(15%) brightness(0.92);
}

.profile-bio-label {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-accent);
}

.profile-bio-label::after {
  content: '';
  display: block;
  width: 32px;
  height: 2px;
  background: var(--color-accent);
  margin-top: var(--space-4);
  opacity: 0.6;
}

.profile-bio-text {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: rgba(248, 249, 252, 0.75);
  line-height: var(--leading-relaxed);
  max-width: 72ch;
  padding-top: var(--space-2);
}

.profile-bio-text--lead::first-letter {
  -webkit-initial-letter: 3;
  initial-letter: 3;
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  color: var(--color-accent-dark);
  margin-right: 0.09em;
}

.profile-bio-text--lead::first-line {
  font-variant-caps: small-caps;
  letter-spacing: 0.015em;
}

/* ============================================================
   SITE FOOTER — Landing page bookend
   Dark forest green, matches profile-bio for symmetry
   ============================================================ */
.site-footer {
  background: var(--color-primary-container);
  padding: var(--space-16) var(--space-8);
  position: relative;
  overflow: hidden;
}

/* Sparse drifting grid — thinner than hero for quiet presence */
.site-footer::before {
  content: '';
  position: absolute;
  inset: -60px;
  background-image:
    linear-gradient(rgba(248, 249, 252, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 249, 252, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: grid-drift 40s linear infinite;
  pointer-events: none;
}

.site-footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  position: relative;
  z-index: 1;
}

/* Thin amber rule above footer content — the closing registration mark */
.site-footer-inner::before {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: var(--color-accent);
  opacity: 0.5;
  margin-bottom: var(--space-3);
}

.site-footer-author {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 300;
  font-style: italic;
  color: rgba(248, 249, 252, 0.6);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.site-footer-links {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-3) var(--space-6);
}

/* Separator dot between links — hidden on the first item and when items wrap to a new line */
.site-footer-links li {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-footer-links li + li::before {
  content: '';
  position: absolute;
  left: calc(var(--space-6) * -0.5);
  top: 50%;
  width: 3px;
  height: 3px;
  background: rgba(248, 249, 252, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.site-footer-link {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: rgba(248, 249, 252, 0.55);
  text-decoration: none;
  transition: color var(--transition-fast);
  white-space: nowrap;
}

.site-footer-link:hover,
.site-footer-link:focus-visible {
  color: var(--color-accent);
}

/* ============================================================
   SECTION FULL-WIDTH ZONE
   Renders below the magazine columns for table, collection,
   and playlist blocks. Consistent across all chapters.
   ============================================================ */
.section-fullwidth-zone {
  padding: var(--space-12) var(--space-8) var(--space-16);
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  border-top: 1px solid var(--color-surface-high);
}

.section-fullwidth-zone .block-text p {
  margin-left: auto;
  margin-right: auto;
}


/* ============================================================
   TABLE BLOCK
   ============================================================ */
.block-table-wrap {
  border: 1px solid var(--color-surface-highest);
  background: var(--color-surface-white);
}

.block-table-header {
  background: var(--color-primary);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-3) var(--space-6);
}

.block-table-title {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-primary);
}

.block-table-description {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 400;
  color: rgba(248, 249, 252, 0.8); /* fallback for Safari < 16.4 */
  color: color-mix(in srgb, var(--color-on-primary) 80%, transparent);
  margin-top: var(--space-1);
  line-height: 1.45;
}

.block-table-description a {
  color: var(--color-accent-vivid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.block-table-description a:hover {
  color: #fff;
}

.block-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.block-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
}

.block-table thead tr {
  background: var(--color-surface-low);
  border-bottom: 2px solid var(--color-accent);
}

.block-table thead th {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-surface-muted);
  white-space: nowrap;
}

.block-table tbody tr {
  border-bottom: 1px solid var(--color-surface-high);
  transition: background var(--transition-fast);
}

.block-table tbody tr:hover {
  background: rgba(26, 46, 28, 0.025);
}

.block-table tbody td {
  padding: var(--space-3) var(--space-5);
  color: var(--color-on-surface);
  line-height: var(--leading-normal);
  vertical-align: top;
}

.block-table tbody td p,
.block-table tbody td ul,
.block-table tbody td ol {
  margin: 0;
}

.block-table tbody td p + p,
.block-table tbody td p + ul,
.block-table tbody td p + ol,
.block-table tbody td ul + p,
.block-table tbody td ol + p {
  margin-top: var(--space-2);
}

.block-table tbody td ul,
.block-table tbody td ol {
  padding-left: 1.15rem;
}

.block-table tbody td li + li {
  margin-top: 0.2rem;
}

.block-table-cell--lead {
  font-weight: 600;
}


/* ============================================================
   EMBED BLOCK
   Interactive portfolio artifacts rendered in the full-width zone.
   ============================================================ */
.block-embed {
  border: 1px solid var(--color-surface-highest);
  background: var(--color-surface-white);
  box-shadow: var(--shadow-whisper);
}

.block-embed-header {
  background: var(--color-primary);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-3) var(--space-6);
}

.block-embed-title {
  font-family: var(--font-label);
  font-size: var(--text-label-md);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-on-primary);
}

.block-embed-description {
  font-family: var(--font-body);
  font-size: var(--text-body-sm);
  font-weight: 400;
  color: rgba(248, 249, 252, 0.8);
  color: color-mix(in srgb, var(--color-on-primary) 80%, transparent);
  margin-top: var(--space-1);
  line-height: 1.45;
}

.block-embed-description p {
  margin: 0;
}

.block-embed-frame-wrap {
  background: var(--color-surface-low);
  border-top: 1px solid var(--color-surface-highest);
}

.block-embed-frame {
  display: block;
  width: 100%;
  height: var(--embed-height, 640px);
  border: 0;
  background: var(--color-surface-white);
}

.block-embed-actions {
  display: flex;
  justify-content: flex-end;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--color-surface-high);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.block-embed-actions a,
.block-embed-actions a:visited {
  color: var(--color-primary);
  text-decoration: none;
}

.block-embed-actions a:hover {
  color: var(--color-accent);
}

/* ============================================================
   TEACHING SNAPSHOTS BLOCK
   Three compact diagnostic callouts for classroom reasoning.
   ============================================================ */
.block-teaching-snapshots {
  border: 1px solid var(--color-surface-highest);
  background: var(--color-surface-white);
  box-shadow: var(--shadow-whisper);
}

.teaching-snapshots-header {
  background: var(--color-primary);
  border-left: 4px solid var(--color-accent);
  padding: var(--space-5) var(--space-6);
}

.teaching-snapshots-label {
  margin: 0 0 var(--space-1);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: color-mix(in srgb, var(--color-on-primary) 72%, transparent);
}

.teaching-snapshots-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-heading-md);
  font-weight: 500;
  line-height: var(--leading-snug);
  color: var(--color-accent-vivid);
}

.teaching-snapshots-description {
  max-width: 820px;
  margin: var(--space-2) 0 0;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  color: color-mix(in srgb, var(--color-on-primary) 72%, transparent);
}

.teaching-snapshots-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--color-surface-highest);
}

.teaching-snapshot-card {
  position: relative;
  min-width: 0;
  background: var(--color-surface-white);
  padding: var(--space-6);
}

.teaching-snapshot-index {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.teaching-snapshot-game {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2vw, 1.9rem);
  line-height: var(--leading-tight);
  font-weight: 500;
  color: var(--color-primary);
}

.teaching-snapshot-flow {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.teaching-snapshot-flow div {
  border-top: 1px solid var(--color-surface-high);
  padding-top: var(--space-3);
}

.teaching-snapshot-flow dt {
  margin-bottom: var(--space-1);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
}

.teaching-snapshot-flow dd {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  color: var(--color-on-surface);
}

.teaching-snapshots-empty {
  grid-column: 1 / -1;
  margin: 0;
  background: var(--color-surface-white);
  padding: var(--space-8);
  font-family: var(--font-label);
  color: var(--color-on-surface-muted);
  text-align: center;
}


/* ============================================================
   COLLECTION BLOCK (grouped downloadable files)
   ============================================================ */
.block-collection {
  --collection-grid-bg: var(--color-surface-highest);
  --collection-thumb-bg: var(--collection-grid-bg);
  border: 1px solid var(--color-surface-highest);
  background: var(--color-surface-white);
  box-shadow: var(--shadow-whisper);
}

.block-collection-header {
  background: var(--color-primary);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-left: 4px solid var(--color-accent);
}

.block-collection-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.block-collection-header-text {
  min-width: 0;
}

.block-collection-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-md);
  font-weight: 500;
  color: var(--color-on-primary);
  letter-spacing: 0;
  line-height: var(--leading-snug);
}

.block-collection-description {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: rgba(248, 249, 252, 0.6);
  margin-top: var(--space-1);
}

.block-collection-description a {
  color: var(--color-accent-vivid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.block-collection-description a:hover {
  color: #fff;
}

.block-collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--collection-grid-bg);
}

.block-collection-empty {
  grid-column: 1 / -1;
  background: var(--color-surface-white);
  padding: var(--space-8);
  text-align: center;
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  color: var(--color-on-surface-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* Each card */
.block-collection-item {
  background: transparent;
  padding: 0;
  display: block;
  text-decoration: none;
  position: relative;
  min-height: 280px;
  overflow: hidden;
}

/* Placeholder cards: flip still works, but click does nothing */
.block-collection-item.is-placeholder {
  cursor: default;
  opacity: 0.6;
}

.collection-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 280px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: -webkit-transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1),
              transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.block-collection-item:hover .collection-card-inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

.collection-card-front,
.collection-card-back {
  position: absolute;
  inset: 0;
  padding: var(--space-5) var(--space-6);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: var(--space-2);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.collection-card-front {
  background: var(--color-surface-white);
  justify-content: space-between;
}

.collection-card-back {
  background: var(--color-primary);
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  text-align: center;
  border-left: 4px solid var(--color-accent);
}

.collection-item-badge {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  color: var(--color-primary);
  background: var(--color-accent);
  padding: 2px var(--space-2);
  display: inline-block;
  width: -webkit-fit-content;
  width: fit-content;
}

.collection-item-title {
  font-family: var(--font-display);
  font-size: var(--text-body-lg);
  font-weight: 500;
  color: var(--color-primary);
  line-height: var(--leading-snug);
  letter-spacing: 0;
}

.collection-item-week {
  font-family: var(--font-label);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-on-surface-faint);
}


.collection-back-topics {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(248, 249, 252, 0.85);
  line-height: var(--leading-normal);
  text-align: center;
}

.collection-back-cta {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-on-primary);
  margin-top: var(--space-4);
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: var(--space-2);
}

.collection-back-cta::after {
  content: '↗';
}

/* ----------------------------------------------------------
   Thumbnail card variant (.has-thumb on .block-collection-item)
   Ideal source image:
     Landscape (slides): 640 × 400 px
     Portrait (document covers): 393 × 560 px
   All cards share the same min-height (280px) so the grid is uniform.
   The image fills the front face; hover crossfades to the back (text).
---------------------------------------------------------- */

/* Front face: image fills the full card */
.block-collection-item.has-thumb .collection-card-front {
  padding: 0;
  gap: 0;
  background: var(--collection-thumb-bg);
}

/* Image is a flex child — NOT position:absolute — so it stays in the same
   compositing layer as its parent and does not break backface-visibility:hidden */
.collection-card-thumb {
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
  display: block;
}

/* All collection thumbnails use contain so the full image remains visible. */
.collection-card-thumb[src$=".svg"] {
  object-fit: contain;
}

/* ============================================================
   PLAYLIST BLOCK (grouped videos linking to YouTube)
   ============================================================ */
.block-playlist {
  background: var(--color-primary);
  border-left: 4px solid var(--color-accent);
  overflow: hidden;
}

.block-playlist-header {
  padding: var(--space-5) var(--space-6) var(--space-4);
  border-bottom: 1px solid rgba(248, 249, 252, 0.08);
}

.block-playlist-label {
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent);
}

.block-playlist-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-md);
  font-weight: 500;
  color: var(--color-accent-vivid);
  line-height: var(--leading-snug);
  letter-spacing: 0;
  margin-top: var(--space-1);
}

.block-playlist-description {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: rgba(248, 249, 252, 0.55);
  margin-top: var(--space-2);
  max-width: 60ch;
  line-height: var(--leading-normal);
}

/* Featured (first) video — inline YouTube embed */
.playlist-featured {
  display: block;
}

.playlist-featured-embed {
  width: 100%;
  /* Aspect ratio fallback for browsers without native support (Safari < 15) */
  padding-top: 56.25%;
  height: 0;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* Override with modern aspect-ratio where supported */
@supports (aspect-ratio: 16 / 9) {
  .playlist-featured-embed {
    padding-top: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.playlist-featured-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}


/* Filmstrip — remaining videos */
.playlist-filmstrip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px;
  background: rgba(248, 249, 252, 0.06);
  border-top: 1px solid rgba(248, 249, 252, 0.08);
}

.playlist-strip-item {
  background: var(--color-primary-container);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  cursor: pointer;
  border: none;
  text-align: left;
  color: inherit;
  transition: background var(--transition-fast);
  position: relative;
}

.playlist-strip-item:hover,
.playlist-strip-item.is-active {
  background: rgba(200, 134, 10, 0.2);                              /* fallback */
  background: color-mix(in srgb, var(--color-accent) 20%, transparent);
  border-left: 3px solid var(--color-accent);
}

.playlist-strip-thumb {
  /* Aspect ratio fallback */
  padding-top: 56.25%;
  height: 0;
  background: rgba(248, 249, 252, 0.04);
  display: block;
  position: relative;
  overflow: hidden;
}

@supports (aspect-ratio: 16 / 9) {
  .playlist-strip-thumb {
    padding-top: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.playlist-strip-thumb > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.playlist-strip-item:hover .playlist-strip-thumb > img {
  opacity: 0.85;
}

.playlist-strip-play {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: var(--color-accent);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  z-index: 2;
}

.playlist-strip-play svg {
  width: 11px;
  height: 11px;
  fill: var(--color-on-primary);
  margin-left: 2px;
}

.playlist-strip-info {
  padding: var(--space-3) var(--space-4);
  -webkit-flex-grow: 1;
  flex-grow: 1;
}

.playlist-strip-number {
  font-family: var(--font-label);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
}

.playlist-strip-title {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: rgba(248, 249, 252, 0.75);
  line-height: var(--leading-snug);
  margin-top: 2px;
}

/* ============================================================
   PHOTO-COLLECTION BLOCK
   Like collection/playlist: full-width, same header.
   Grid is intentionally open — no outer box, no card borders.
   ============================================================ */

.block-photo-collection {
  /* No border, no background — the header is the only frame */
}

/* Header: identical to .block-collection-header */
.photo-collection-header {
  background: var(--color-primary);
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-left: 4px solid var(--color-accent);
}

.photo-collection-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.photo-collection-header-text {
  min-width: 0;
}

.photo-collection-title {
  font-family: var(--font-display);
  font-size: var(--text-heading-md);
  font-weight: 500;
  color: var(--color-accent-vivid);
  line-height: var(--leading-snug);
}

.photo-collection-description {
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: rgba(248, 249, 252, 0.55);
  margin-top: var(--space-1);
}

/* Any <a> inside the green header (fmtText description links, etc.) */
.photo-collection-header a {
  color: var(--color-accent-vivid);
  text-decoration-color: var(--color-accent-vivid);
}
.photo-collection-header a:visited {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}
.photo-collection-header a:hover {
  color: var(--color-accent-dim);
}

/* Block-level title link */
.photo-collection-title-link {
  color: var(--color-accent-vivid);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.photo-collection-title-link:visited {
  color: var(--color-accent);
}
.photo-collection-title-link:hover {
  color: var(--color-accent-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.photo-collection-title-link-icon {
  width: 0.75em;
  height: 0.75em;
  flex-shrink: 0;
  opacity: 0.7;
}

/* Per-item external link */
.photo-collection-item-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: var(--space-2);
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.photo-collection-item-link:visited {
  color: var(--color-accent-dark);
}
.photo-collection-item-link:hover {
  color: var(--color-accent-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.photo-collection-item-link svg {
  width: 0.7em;
  height: 0.7em;
  flex-shrink: 0;
}

/* Fine rule between header and grid */
.photo-collection-rule {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

/* Open grid: 2 columns, generous gap, top-aligned */
.photo-collection-grid {
  display: grid;
  gap: var(--space-8) var(--space-10);
  padding: var(--space-8) 0;
  align-items: start;
}

.photo-collection-grid--cols-1 { grid-template-columns: 1fr; }
.photo-collection-grid--cols-2 { grid-template-columns: 1fr 1fr; }
.photo-collection-grid--cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.photo-collection-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.photo-collection-grid--cols-5 { grid-template-columns: repeat(5, 1fr); }

.photo-collection-item--span-2 { grid-column: span 2; }

/* Each item: bare figure, no card */
.photo-collection-item figure {
  overflow: hidden;
}

.photo-collection-item figure img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  filter: grayscale(20%);
  transition: transform var(--transition-slow), filter var(--transition-slow);
}

.photo-collection-item figure:hover img {
  transform: scale(1.02);
  filter: grayscale(0%);
}

.photo-collection-item figure figcaption {
  padding: var(--space-3) 0 0;
  font-family: var(--font-body);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  line-height: var(--leading-snug);
}


.photo-collection-empty {
  grid-column: 1 / -1;
  font-family: var(--font-label);
  font-size: var(--text-label-sm);
  color: var(--color-on-surface-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  text-align: center;
  padding: var(--space-8);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .highlights-inner {
    grid-template-columns: repeat(3, 1fr);
  }

  .block-collection-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .playlist-filmstrip {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* When columns wrap (content-driven, not pixel-breakpoint-driven),
   adjust sticky behaviour, borders, and padding for single-column feel */
@media (max-width: 900px) {
  .section-text-column {
    border-right: none;
    border-bottom: 1px solid var(--color-surface-high);
    padding: var(--space-10) var(--space-6);
  }

  .section-media-column {
    position: static;
    max-height: none;
    padding: var(--space-10) var(--space-6);
  }

  .section-fullwidth-zone {
    padding: var(--space-10) var(--space-6) var(--space-12);
    gap: var(--space-10);
  }
}

@media (max-width: 768px) {
  .site-nav {
    gap: var(--space-4);
    padding: 0 var(--space-5);
  }

  .nav-left {
    gap: var(--space-3);
  }

  .nav-chapters {
    gap: var(--space-4);
  }

  .nav-chapter-menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav > .nav-chapter-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: auto;
    padding: var(--space-3) var(--space-5) var(--space-4);
    background: var(--color-primary-container);
    border-top: 1px solid rgba(248, 249, 248, 0.08);
    overflow-x: visible;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
  }

  .site-nav.chapter-menu-open > .nav-chapter-menu {
    display: block;
  }

  .site-nav > .nav-chapter-menu .nav-chapters {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 0;
    height: auto;
  }

  .site-nav > .nav-chapter-menu .nav-chapters li {
    height: auto;
  }

  .site-nav > .nav-chapter-menu .nav-chapter-link {
    width: 100%;
    height: auto;
    min-height: 44px;
    padding: var(--space-3) 0;
    justify-content: flex-start;
    gap: var(--space-3);
  }

  .site-nav > .nav-chapter-menu .nav-chapter-link.active {
    box-shadow: inset 3px 0 0 var(--color-accent);
    padding-left: var(--space-3);
  }

  .site-nav > .nav-chapter-menu .nav-chapter-title {
    display: inline;
    color: rgba(248, 249, 248, 0.7);
    font-size: var(--text-label-sm);
    font-weight: 400;
    letter-spacing: var(--tracking-normal);
    line-height: var(--leading-snug);
    text-transform: none;
    white-space: normal;
  }

  .nav-brand,
  .nav-chapter-link {
    font-size: var(--text-label-sm);
  }

  /* Drop the hamburger label on narrow viewports — the icon alone
     keeps the chapter links from being squeezed. */
  .nav-hamburger-label {
    display: none;
  }

  .chapter-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .section-hero {
    padding-top: var(--space-8);
  }

  .highlights-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }

  .chapter-editorial-sections {
    padding: var(--space-12) var(--space-5);
  }

  .chapter-article-item,
  .chapter-article-item:nth-child(even) {
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-8) 0;
    padding-left: 0;
  }

  .chapter-article-item:hover {
    padding-left: 0;
  }

  .chapter-article-image {
    flex: none;
    width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 9;
  }

  .chapter-article-content {
    flex: none;
    width: 100%;
    padding: 0;
  }

  .chapter-article-title {
    font-size: clamp(1.6rem, 9vw, 2.15rem);
  }

  .chapter-article-summary {
    max-width: 65ch;
  }

  .section-footer-inner {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
  }

  .section-footer-overview {
    grid-column: 1 / -1;
    order: -1;
  }

  .hero-landing {
    min-height: 84vh;
    padding-bottom: var(--space-16);
  }

  /* Center the title block on phones instead of pinning it to the bottom
     of a tall green void — content lands in the optical center. */
  .hero-landing-inner {
    align-items: center;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .hero-right {
    align-items: flex-start;
    text-align: left;
  }

  .hero-scroll-cue {
    justify-content: flex-start;
  }

  .hero-scroll-cue::before {
    background: linear-gradient(90deg, var(--color-accent), transparent);
  }

  .chapter-index-entry {
    grid-template-columns: 64px 1fr auto;
    gap: var(--space-6);
  }

  .chapter-index-number {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .section-fullwidth-zone {
    padding: var(--space-8) var(--space-5) var(--space-10);
    gap: var(--space-8);
  }

  .block-collection-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* On touch devices, suppress the 3D flip — just highlight the card */
  .block-collection-item:hover .collection-card-inner {
    -webkit-transform: none;
    transform: none;
  }

  .block-collection-item:hover .collection-card-front {
    background: var(--color-surface-low);
  }

  .playlist-filmstrip {
    grid-template-columns: repeat(2, 1fr);
  }

  .block-table-title {
    font-size: var(--text-label-sm);
  }

  .block-table-description {
    font-size: var(--text-body-xs, 0.8rem);
  }

  .block-embed-header,
  .block-embed-actions {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  .block-embed-title {
    font-size: var(--text-label-sm);
  }

  .block-embed-frame {
    height: min(var(--embed-height, 640px), 78vh);
  }

  .block-table thead th,
  .block-table tbody td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-body-sm);
  }
}

/* When article items wrap to single column, cancel row-reverse and go cinematic aspect ratio */
@media (max-width: 480px) {
  .chapter-article-item:nth-child(even) {
    flex-direction: column;
  }

  .chapter-article-image {
    aspect-ratio: 16 / 9;
  }
}

/* ============================================================
   VIDEO BLOCK (YouTube embed or local video, right-column or full-width)
   ============================================================ */
.block-video {
  width: 100%;
}

/* YouTube embed wrapper — own classes, decoupled from playlist */
.block-video-embed {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
  /* Fallback for browsers without aspect-ratio support */
  padding-top: 56.25%;
  height: 0;
}

@supports (aspect-ratio: 16 / 9) {
  .block-video-embed {
    padding-top: 0;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.block-video-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.block-video-player {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
}

.block-video--portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.block-video-player--portrait {
  width: min(600px, 100%);
  aspect-ratio: 9 / 16;
}

.block-video--portrait .block-video-caption {
  max-width: min(600px, 100%);
  text-align: center;
}

.block-video-caption {
  padding: var(--space-3) 0;
  font-family: var(--font-label);
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  line-height: var(--leading-snug);
  margin: 0;
  width: 100%;
  max-width: none;
}

/* In the media column — border on the embed only, caption sits outside it */
.section-media-column .block-video-embed {
  border: 2px solid var(--color-surface-high);
  padding: var(--space-2);
}

/* In the full-width zone — clean full-width presentation */
.section-fullwidth-zone .block-video {
  width: 100%;
}

.section-fullwidth-zone .block-video-player {
  max-height: 72vh;
  object-fit: contain;
  background: #000;
}

/* ============================================================
   LIGHTBOX — hide captions (users read captions on the page)
   ============================================================ */
.gslide-description {
  display: none !important;
}

/* ============================================================
   TOUCH DEVICES — disable hover-only decorative effects
   On devices with no hover capability (phones, tablets) these
   animations are inaccessible and skipped cleanly.
   ============================================================ */
@media (hover: none) {
  .section-media-column .block-figure img {
    filter: grayscale(0%);
  }
  .section-media-column .block-figure:hover img {
    filter: grayscale(0%);
    transform: none;
  }
  .block-figure:hover img {
    transform: none;
  }
  .chapter-index-entry:hover::before,
  .chapter-index-entry:hover .chapter-index-number,
  .chapter-index-entry:hover .chapter-index-arrow {
    transform: none;
    color: inherit;
    border-color: inherit;
  }
  .block-collection-item:hover .collection-card-inner {
    transform: none;
  }
}

/* ============================================================
   STUDENT REPORTS WIDGET (.block-student-reports)
   Full-width zone widget for Missing Maize, Plant the Right Day,
   and Ladang Sawit game report panels.
   ============================================================ */

.block-student-reports {
  --mm-bg-ok:       #ecfdf5;
  --mm-text-ok:     #065f46;
  --mm-border-ok:   rgba(16,185,129,0.30);
  --mm-bg-warn:     #fffbeb;
  --mm-text-warn:   #92400e;
  --mm-border-warn: rgba(245,158,11,0.30);
  --mm-bg-info:     #eff6ff;
  --mm-text-info:   #1e40af;
  --mm-border-info: rgba(59,130,246,0.30);

  font-family: var(--font-body, 'Crimson Pro', Georgia, serif);
  font-size: var(--text-body-md);
  line-height: var(--leading-normal);
  color: var(--color-on-surface);
  background: var(--color-surface-low);
  border: 1px solid var(--color-border);
  padding: 28px 32px 32px;
  margin-bottom: 24px;
}

.mm-widget-hdr {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 14px;
}
.mm-widget-label {
  display: inline-block;
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
  margin-bottom: 6px;
}
.mm-widget-title {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-on-surface);
  margin: 0 0 6px;
  line-height: var(--leading-tight);
}
.mm-widget-desc {
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  margin: 0;
  line-height: var(--leading-normal);
}

/* Nav bar */
.mm-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.mm-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--color-surface-white);
  border: 1px solid var(--color-border);
  color: var(--color-on-surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.mm-nav-btn:hover:not(:disabled) { background: var(--color-surface-low); }
.mm-nav-btn:disabled { opacity: 0.35; cursor: default; }
.mm-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.mm-select {
  appearance: none;
  background: var(--color-surface-white);
  border: 1px solid var(--color-border);
  color: var(--color-on-surface);
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 5px 28px 5px 10px;
  height: 32px;
  cursor: pointer;
  min-width: 220px;
}
.mm-select:focus { outline: 2px solid var(--color-border); outline-offset: 2px; }
.mm-select-arrow {
  position: absolute;
  right: 8px;
  pointer-events: none;
  color: var(--color-on-surface-muted);
  line-height: 0;
}
.mm-nav-count {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.75rem;
  color: var(--color-on-surface-muted);
  margin-left: 4px;
}

/* Section labels */
.mm-lbl {
  display: block;
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
  margin-bottom: 8px;
  margin-top: 18px;
}

/* Cards */
.mm-card {
  background: var(--color-surface-white);
  border: 1px solid var(--color-border);
  padding: 14px 16px;
  margin-bottom: 0;
}
.mm-g2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .mm-g2 { grid-template-columns: 1fr; }
}

/* Student identity */
.mm-name {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-on-surface);
  margin-bottom: 4px;
}
.mm-meta {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.9375rem;
  color: var(--color-on-surface-muted);
  line-height: 1.65;
}

/* Outcome badges */
.mm-badge {
  display: inline-block;
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  margin-bottom: 8px;
}
.mm-badge-s { background: var(--mm-bg-ok);   color: var(--mm-text-ok);   border: 1px solid var(--mm-border-ok);   }
.mm-badge-w { background: var(--mm-bg-warn); color: var(--mm-text-warn); border: 1px solid var(--mm-border-warn); }
.mm-badge-i { background: var(--mm-bg-info); color: var(--mm-text-info); border: 1px solid var(--mm-border-info); }
.mm-outq {
  font-size: var(--text-body-md);
  font-style: italic;
  color: var(--color-on-surface-muted);
  line-height: 1.6;
  margin-top: 4px;
}

/* Evidence profile */
.mm-ev-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 0;
}
.mm-ev {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1 1 80px;
  min-width: 70px;
  background: var(--color-surface-white);
  border: 1px solid var(--color-border);
  padding: 10px 6px;
  opacity: 0.4;
}
.mm-ev.ok {
  opacity: 1;
  border-color: var(--mm-border-ok);
  background: var(--mm-bg-ok);
}
.mm-ev-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-on-surface-muted);
}
.mm-ev.ok .mm-ev-dot { background: var(--mm-text-ok); }
.mm-ev-lbl {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--color-on-surface-muted);
  line-height: 1.3;
}
.mm-ev.ok .mm-ev-lbl { color: var(--mm-text-ok); }

/* Sites investigated */
.mm-site {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}
.mm-site:last-of-type { border-bottom: none; }
.mm-site.dim { opacity: 0.45; }
.mm-site.caution .mm-sname { color: var(--mm-text-warn); }
.mm-sn {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.6875rem;
  color: var(--color-on-surface-muted);
  width: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.mm-sname {
  font-weight: 600;
  font-size: var(--text-body-md);
  color: var(--color-on-surface);
  margin-bottom: 2px;
}
.mm-schoice {
  font-size: var(--text-body-md);
  color: var(--color-on-surface-muted);
  line-height: 1.55;
}
.mm-unvisited {
  font-size: 0.875rem;
  font-style: italic;
  font-weight: 400;
  color: var(--color-on-surface-muted);
}
.mm-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}
.mm-tag-w { background: var(--mm-bg-warn); color: var(--mm-text-warn); border: 1px solid var(--mm-border-warn); }

/* Collapsible toggle */
.mm-tog {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 0 0;
  background: none;
  border: none;
  border-top: 1px solid var(--color-border);
  color: var(--color-on-surface-muted);
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: left;
  margin-top: 8px;
}
.mm-tog:hover { color: var(--color-on-surface); }
.mm-tog-icon { margin-left: auto; line-height: 0; transition: transform 0.2s; }
.mm-nb { display: none; padding-top: 12px; }
.mm-nb.open { display: block; }
.mm-nbe {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}
.mm-nbe:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.mm-nbloc {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
  margin-bottom: 3px;
}
.mm-nbtxt {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-on-surface);
  white-space: pre-wrap;
}

/* Reflection Q&A */
.mm-q { padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.mm-q:last-child { border-bottom: none; padding-bottom: 0; }
.mm-qt { font-size: var(--text-body-md); font-weight: 600; color: var(--color-on-surface-muted); margin-bottom: 5px; line-height: 1.45; }
.mm-qa { font-size: var(--text-body-md); color: var(--color-on-surface); line-height: var(--leading-normal); }

/* AI feedback panels */
.mm-ai { border: 1px solid var(--color-border); margin-bottom: 0; }
.mm-ai-ok   { background: var(--mm-bg-ok);   border-color: var(--mm-border-ok);   }
.mm-ai-none { background: var(--color-surface-low); }
.mm-ai-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
}
.mm-ai-hdr-ok   { color: var(--mm-text-ok);   border-color: var(--mm-border-ok);   }
.mm-ai-hdr-none { color: var(--color-on-surface-muted); }
.mm-ai-txt {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: var(--text-body-md);
  line-height: 1.7;
  color: var(--color-on-surface);
  padding: 12px 14px;
  white-space: pre-wrap;
}
.mm-ai-muted { color: var(--color-on-surface-muted); }

/* Screen-reader-only */
.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;
}

/* PTD stage water deficit grid */
.mm-ptd-stage-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0;
}
@media (max-width: 500px) {
  .mm-ptd-stage-row { grid-template-columns: 1fr; }
}
.mm-ptd-stage {
  background: var(--color-surface-white);
  border: 1px solid var(--color-border);
  padding: 12px;
  text-align: center;
}
.mm-ptd-stage.ok   { background: var(--mm-bg-ok);   border-color: var(--mm-border-ok);   }
.mm-ptd-stage.warn { background: var(--mm-bg-warn);  border-color: var(--mm-border-warn); }
.mm-ptd-stage-name {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
  margin-bottom: 4px;
}
.mm-ptd-stage.ok   .mm-ptd-stage-name  { color: var(--mm-text-ok);   }
.mm-ptd-stage.warn .mm-ptd-stage-name  { color: var(--mm-text-warn); }
.mm-ptd-stage-deficit {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--color-on-surface);
  margin-bottom: 2px;
}
.mm-ptd-stage.ok   .mm-ptd-stage-deficit { color: var(--mm-text-ok);   }
.mm-ptd-stage.warn .mm-ptd-stage-deficit { color: var(--mm-text-warn); }
.mm-ptd-stage-ky {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.625rem;
  color: var(--color-on-surface-muted);
}
.mm-ptd-stats {
  font-size: 0.75rem;
  color: var(--color-on-surface-muted);
  line-height: 1.6;
  margin-top: 6px;
}
.mm-ptd-concepts {
  display: flex;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.75rem;
  color: var(--color-on-surface-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* Ladang Sawit outcomes and achievements */
.mm-ls-outcomes {
  font-size: 0.75rem;
  color: var(--color-on-surface-muted);
  line-height: 1.6;
  margin-top: 6px;
}
.mm-ls-threshold { font-size: 0.7rem; color: var(--color-on-surface-muted); }
.mm-ls-achieve-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 0; }
.mm-ls-achieve {
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--mm-bg-info);
  color: var(--mm-text-info);
  border: 1px solid var(--mm-border-info);
  padding: 2px 8px;
}

/* Year-by-year history table */
.mm-yr-scroll { overflow-x: auto; }
.mm-yr-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.6875rem;
  color: var(--color-on-surface);
}
.mm-yr-table th {
  background: var(--color-surface-low);
  border: 1px solid var(--color-border);
  padding: 5px 8px;
  text-align: left;
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-on-surface-muted);
  white-space: nowrap;
}
.mm-yr-table td {
  border: 1px solid var(--color-border);
  padding: 5px 8px;
  vertical-align: top;
  line-height: 1.5;
}
.mm-yr-table tr:hover td { background: var(--color-surface-low); }
.yr-cal   { font-size: 0.625rem; color: var(--color-on-surface-muted); }
.yr-event {
  display: inline-block;
  background: var(--mm-bg-info);
  color: var(--mm-text-info);
  border: 1px solid var(--mm-border-info);
  font-family: var(--font-label, 'Barlow Condensed', sans-serif);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 4px;
  margin-top: 2px;
}
