/* SBS — The Playbook · Vol. 001 Editorial Stylesheet
 * Swiss editorial typography, warm archival paper, strategic SBS color blocking.
 * Mobile-first, accessible, reduced-motion aware, print-ready.
 */

:root {
  --paper: #f6f4ee;
  --paper-alt: #efece3;
  --surface: #ffffff;
  --ink: #141412;
  --ink-muted: #57534a;
  --rule: #d8d3c6;
  --rule-strong: #141412;

  /* Authoritative SBS Story Colors */
  --sbs-green: #1d5e3a;
  --sbs-green-soft: #e3f2e8;
  --sbs-blue: #184b7a;
  --sbs-blue-soft: #e2f0f7;
  --sbs-purple: #5f4687;
  --sbs-purple-soft: #eee8f7;
  --sbs-red: #b92b27;
  --sbs-red-soft: #fbe7e6;
  --sbs-black: #1a1a18;
  --sbs-black-soft: #e8e6e0;
  --sbs-yellow: #d4a017;
  --sbs-yellow-soft: #fdf6dc;

  --font-sans: "Helvetica Neue", "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-mono: "SFMono-Regular", "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --max-w: 1240px;
  --gutter: clamp(1rem, 3vw, 2.5rem);
  --radius: 4px;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: clip;
}

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

a {
  color: inherit;
  text-underline-offset: 3px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--sbs-blue);
  outline-offset: 2px;
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  border-radius: var(--radius);
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Wordmark: strictly sur + rounded + by + style */
.sbs-wordmark {
  display: inline-flex;
  align-items: baseline;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
}

.sbs-wordmark .seg-sur { color: var(--sbs-green); }
.sbs-wordmark .seg-rounded { color: var(--sbs-blue); }
.sbs-wordmark .seg-by { color: var(--sbs-purple); }
.sbs-wordmark .seg-style { color: var(--sbs-red); }

/* Six-color programming motif */
.motif-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  height: 6px;
  width: 100%;
}

.motif-bar span:nth-child(1) { background: var(--sbs-green); }
.motif-bar span:nth-child(2) { background: var(--sbs-blue); }
.motif-bar span:nth-child(3) { background: var(--sbs-purple); }
.motif-bar span:nth-child(4) { background: var(--sbs-red); }
.motif-bar span:nth-child(5) { background: var(--sbs-black); }
.motif-bar span:nth-child(6) { background: var(--sbs-yellow); }

/* Top Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 244, 238, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.8rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.header-wordmark {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.header-vol {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-muted);
  border-left: 1px solid var(--rule);
  padding-left: 0.75rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .header-vol {
    display: none;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.5rem 0.95rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  background: transparent;
  color: var(--ink);
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--paper-alt);
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:hover {
  background: #2c2c28;
}

.btn-sm {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

/* Chapter Navigation Strip */
.chapter-nav {
  border-top: 1px solid var(--rule);
  background: var(--paper-alt);
}

.chapter-nav-list {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  list-style: none;
  margin: 0;
  padding: 0.45rem 0;
  scrollbar-width: thin;
}

.chapter-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-decoration: none;
  color: var(--ink-muted);
  white-space: nowrap;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.chapter-nav-link:hover,
.chapter-nav-link[aria-current="true"] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--rule);
  font-weight: 700;
}

/* Hero Section */
.hero {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule-strong);
}

.hero-top-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.pub-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
  padding: 0.3rem 0.65rem;
  background: var(--surface);
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .btn-sm {
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
  }
}

.hero-wordmark-lg {
  font-size: clamp(1.6rem, 3.6vw, 2.5rem);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.95;
  margin: 0 0 1.25rem;
}

.hero-lead {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.4vw, 1.65rem);
  line-height: 1.4;
  max-width: 44ch;
  margin: 0 0 1.75rem;
  color: var(--ink);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

@media (max-width: 640px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
}

.stat-cell {
  padding: 1.25rem 1.25rem;
  border-right: 1px solid var(--rule);
}

.stat-cell:last-child {
  border-right: 0;
}

@media (max-width: 640px) {
  .stat-cell {
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .stat-cell:last-child {
    border-bottom: 0;
  }
}

.stat-num {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.hero-manifesto {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--sbs-black);
  color: var(--paper);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.hero-manifesto-quote {
  font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0;
}

.hero-manifesto-sub {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #d6d2c6;
  margin: 0;
}

/* Chapter Sections */
.chapter {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 112px;
}

.chapter-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .chapter-header {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }
}

.chapter-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.chapter-title {
  font-size: clamp(1.75rem, 3.8vw, 2.75rem);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0;
}

.copy-link-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-muted);
}

.copy-link-btn:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.editorial-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.5rem;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; }

@media (max-width: 900px) {
  .col-8, .col-6, .col-4 {
    grid-column: span 12;
  }
}

.lead-serif {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  margin-top: 0;
}

.editorial-panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 1.25rem;
}

.editorial-panel h3,
.editorial-panel h4 {
  margin-top: 0;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin: 0 0 0.4rem;
}

/* Ecosystem Trio */
.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule-strong);
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .ecosystem-grid {
    grid-template-columns: 1fr;
  }
}

.ecosystem-card {
  background: var(--surface);
  padding: 1.25rem;
}

.ecosystem-card.is-current {
  background: var(--sbs-yellow-soft);
}

.ecosystem-domain {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.ecosystem-role {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

/* Pillars & Markets */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 680px) {
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

.pillar-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--ink);
  padding: 1.25rem;
}

.pillar-card[data-accent="green"] { border-top-color: var(--sbs-green); }
.pillar-card[data-accent="blue"] { border-top-color: var(--sbs-blue); }
.pillar-card[data-accent="purple"] { border-top-color: var(--sbs-purple); }
.pillar-card[data-accent="red"] { border-top-color: var(--sbs-red); }

.markets-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .markets-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.market-box {
  background: var(--paper-alt);
  border: 1px solid var(--rule);
  padding: 1rem;
}

/* Formula & Color Chips */
.formula-banner {
  background: var(--surface);
  border: 2px solid var(--ink);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.formula-math {
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.color-legend {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .color-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .color-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.color-swatch-card {
  border: 1px solid var(--rule);
  background: var(--surface);
  padding: 0.75rem;
}

.color-swatch-bar {
  height: 10px;
  margin-bottom: 0.5rem;
}

/* Interactive Tabs (modern-web-guidance compliant) */
.tabs-bar {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1rem;
  padding-bottom: 0.25rem;
}

.tabs-bar [role="tab"] {
  position: relative;
  flex: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  min-height: 38px;
}

.tabs-bar [role="tab"][aria-selected="true"] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--rule);
}

.tabs-bar [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid var(--ink);
}

/* Interactive Programming Board */
.module-box {
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  padding: clamp(1rem, 2.5vw, 1.5rem);
  margin-top: 1.5rem;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  background: var(--paper-alt);
}

.badge-auth {
  background: var(--sbs-green-soft);
  border-color: var(--sbs-green);
  color: var(--sbs-green);
}

.badge-demo {
  background: var(--sbs-yellow-soft);
  border-color: var(--sbs-yellow);
  color: #705200;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.35rem 0.65rem;
  min-height: 32px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
}

.filter-pill[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  gap: 1rem;
  align-items: start;
}

@media (max-width: 920px) {
  .board-layout {
    grid-template-columns: 1fr;
  }
  .slot-inspector {
    position: static;
    order: -1;
  }
  .slots-grid {
    max-height: 440px;
    overflow-y: auto;
    padding-right: 0.25rem;
  }
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}

@media (max-width: 720px) {
  .slots-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 440px) {
  .slots-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.slot-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  padding: 0.55rem;
  min-height: 68px;
  border: 1px solid var(--rule);
  border-left-width: 5px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.slot-btn:hover {
  background: var(--paper-alt);
}

.slot-btn[aria-pressed="true"] {
  outline: 2px solid var(--ink);
  background: var(--surface);
}

.slot-btn.is-yellow {
  background: var(--sbs-yellow-soft);
}

.slot-inspector {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 1.15rem;
  position: sticky;
  top: 120px;
}

/* Day Progression Simulator */
.sim-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sim-slider {
  flex: 1 1 240px;
  accent-color: var(--ink);
  min-height: 36px;
}

.sim-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .sim-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.sim-metric-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 0.85rem;
}

.progress-track {
  height: 8px;
  background: var(--rule);
  margin-top: 0.5rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--ink);
  transition: width 0.2s ease;
}

/* Story Development 10-beat explorer */
.beats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 680px) {
  .beats-grid {
    grid-template-columns: 1fr;
  }
}

.beat-card {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 0.85rem;
}

/* Frames Gallery & Anatomy */
.frames-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .frames-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .frames-grid {
    grid-template-columns: 1fr;
  }
}

.frame-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
}

.frame-media {
  aspect-ratio: 4 / 5;
  background: var(--paper-alt);
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.frame-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-body {
  padding: 1rem;
}

/* Yellow Paper Examples */
.paper-examples-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 720px) {
  .paper-examples-grid {
    grid-template-columns: 1fr;
  }
}

.paper-note {
  background: #fcfbf7;
  border: 1px solid var(--rule);
  border-left: 5px solid var(--sbs-yellow);
  padding: 1.25rem;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 27px,
    #d8e5f2 27px,
    #d8e5f2 28px
  );
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.paper-note p {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 28px;
  margin: 0 0 0.75rem;
}

/* Instagram 3x3 Grid Simulator */
.ig-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  max-width: 720px;
  margin-inline: auto;
}

.ig-cell {
  position: relative;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--rule);
  overflow: hidden;
  background: var(--paper-alt);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.ig-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
}

.ig-cell-overlay {
  position: relative;
  z-index: 2;
  background: rgba(20, 20, 18, 0.84);
  color: #ffffff;
  padding: 0.45rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.3;
}

/* Workflow Chain */
.workflow-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-block: 1rem;
}

.workflow-step {
  background: var(--surface);
  border: 1px solid var(--ink);
  padding: 0.55rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

/* Reference Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.ref-card-wrap {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ref-card-preview svg {
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
}

.ref-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Checklist & Onboarding Exercise */
.checklist-group {
  margin-bottom: 1rem;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  margin-bottom: 0.4rem;
  cursor: pointer;
}

.checklist-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--sbs-green);
  flex-shrink: 0;
}

.exercise-form {
  display: grid;
  gap: 0.75rem;
}

.exercise-form label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.exercise-form input,
.exercise-form select,
.exercise-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  border-radius: 2px;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--surface);
}

.data-table th,
.data-table td {
  border: 1px solid var(--rule);
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--paper-alt);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Footer */
.site-footer {
  background: var(--sbs-black);
  color: var(--paper);
  padding-block: 3rem 2.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-link {
  color: #e2dfd5;
  text-decoration: underline;
}

/* Subtle motion only when user has no reduced-motion preference */
@media (prefers-reduced-motion: no-preference) {
  .chapter {
    transition: opacity 0.25s ease;
  }
}

/* Print Stylesheet */
@media print {
  .site-header,
  .chapter-nav,
  .hero-actions,
  .copy-link-btn,
  .filter-row,
  .sim-controls,
  .ref-card-actions {
    display: none !important;
  }
  body {
    background: #ffffff;
    color: #000000;
  }
  .chapter {
    break-inside: avoid-page;
    border-bottom: 1px solid #cccccc;
  }
}
