/* ============================================================
   SKY HSC — Module 7: Safe Handling & Disposal of Organic Substances
   HTML Companion Stylesheet
   Design system reverse-engineered from Module 7 IQ4 (skyhsc-chem-mod7.pages.dev)
   ============================================================ */

:root {
  /* Brand colours */
  --navy: #0a1838;
  --navy-2: #142552;
  --navy-3: #1c3266;
  --yellow: #ffd23f;
  --yellow-2: #fff3b0;
  --green: #2ea66f;
  --green-2: #d6f1e2;
  --red: #d64545;
  --red-2: #fde8e8;
  --blue: #4a90c2;
  --blue-2: #e2eef7;
  --orange: #e89149;
  --orange-2: #fde8d4;

  /* Greys */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-alt: #f1f3f7;
  --border: #e3e6ec;
  --text: #1a2440;
  --text-2: #4a5678;
  --text-3: #8089a0;

  /* Typography */
  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --mono: 'SF Mono', 'Cascadia Mono', 'Consolas', 'Roboto Mono', monospace;

  /* Layout */
  --sidebar-w: 240px;
  --header-h: 56px;
  --max-content: 920px;
  --radius: 10px;
  --radius-sm: 6px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 28px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
  --bg: #0e1729;
  --surface: #142133;
  --surface-alt: #1a2a45;
  --border: #243759;
  --text: #e8edf7;
  --text-2: #a8b2cc;
  --text-3: #6c7896;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   HEADER BAR
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  border-bottom: 3px solid var(--yellow);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: #fff;
}
.header-brand { display: flex; align-items: center; gap: 12px; flex: 1; }
.header-logo {
  width: 36px; height: 36px;
  display: inline-block;
}
.header-title { font-size: 14px; font-weight: 600; letter-spacing: 0.3px; }
.header-title .highlight { color: var(--yellow); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-header {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.btn-header:hover { background: rgba(255,255,255,0.18); }
.btn-header .kbd {
  background: rgba(255,255,255,0.18);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--mono);
}
.theme-toggle {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--yellow);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1480px;
  margin: 0 auto;
}

/* ============================================================
   SIDEBAR TOC
   ============================================================ */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 20px 24px 24px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.toc-group {
  margin-bottom: 18px;
}
.toc-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--text-3);
  margin: 0 0 6px 0;
  padding-left: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toc-group-label .star { color: var(--yellow); }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-item {
  display: block;
  padding: 6px 8px 6px 12px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all 0.15s;
  position: relative;
}
.toc-item:hover { background: var(--surface-alt); color: var(--text); }
.toc-item.active {
  border-left-color: var(--yellow);
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 600;
}
.toc-item .check {
  display: inline-block;
  width: 14px;
  color: var(--green);
  font-weight: 700;
}
.toc-item.read .check::before { content: '✓'; }
.toc-item:not(.read) .check::before { content: '·'; color: var(--text-3); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  padding: 24px 32px 80px 32px;
  max-width: var(--max-content);
}

/* ============================================================
   HERO CARD
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 28px 32px 24px 32px;
  color: #fff;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 4px;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 3px; height: 18px;
  background: var(--yellow);
}
.hero-eyebrow-sub {
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.2px;
}
.hero h1 {
  font-size: 34px;
  margin: 6px 0 6px 0;
  font-weight: 700;
  line-height: 1.18;
}
.hero h1 .highlight { color: var(--yellow); }
.hero-pills {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  margin-bottom: 20px;
}
.nesa-quote {
  background: rgba(0,0,0,0.25);
  border-left: 3px solid var(--yellow);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 18px;
  font-size: 14px;
}
.nesa-quote-label { color: var(--yellow); font-weight: 700; font-size: 12px; letter-spacing: 0.5px; }
.nesa-quote-text { font-style: italic; color: rgba(255,255,255,0.92); margin-top: 4px; }
.hero-intro { font-size: 15px; line-height: 1.6; margin-bottom: 20px; color: rgba(255,255,255,0.92); }
.hero-intro .kw { color: var(--yellow); font-weight: 600; }
.hero-intro .kw-green { color: #6dd99e; font-weight: 600; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  background: rgba(46, 166, 111, 0.18);
  border: 1px solid rgba(46, 166, 111, 0.35);
  color: #b3e6c8;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   QUICK ACTIONS TOOLBAR
   ============================================================ */
.qa-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}
.qa-bar-label { color: var(--text-3); font-weight: 600; margin-right: 4px; }
.btn-qa {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}
.btn-qa:hover { background: var(--surface); border-color: var(--text-3); }

/* ============================================================
   SECTIONS
   ============================================================ */
section { margin-bottom: 36px; }
section h2 {
  font-size: 24px;
  margin: 8px 0 14px 0;
  color: var(--navy);
  font-weight: 700;
  border-bottom: 2px solid var(--yellow);
  padding-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
[data-theme="dark"] section h2 { color: var(--yellow); }
section h3 { font-size: 19px; margin: 22px 0 8px 0; color: var(--blue); font-weight: 700; }
[data-theme="dark"] section h3 { color: #8ec4e8; }
section h4 { font-size: 16px; margin: 16px 0 6px 0; color: var(--text); font-weight: 700; }
section p { margin: 8px 0 12px 0; }
section ul, section ol { padding-left: 24px; margin: 8px 0 14px 0; }
section li { margin: 4px 0; }
section strong { color: var(--text); font-weight: 700; }
[data-theme="dark"] section strong { color: #fff; }

/* ============================================================
   CALLOUTS
   ============================================================ */
.callout {
  border-left: 4px solid var(--blue);
  background: var(--blue-2);
  padding: 12px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 16px 0;
  font-size: 14.5px;
}
[data-theme="dark"] .callout { background: rgba(74, 144, 194, 0.12); }
.callout-yellow { border-left-color: var(--yellow); background: var(--yellow-2); }
[data-theme="dark"] .callout-yellow { background: rgba(255, 210, 63, 0.12); }
.callout-green { border-left-color: var(--green); background: var(--green-2); }
[data-theme="dark"] .callout-green { background: rgba(46, 166, 111, 0.12); }
.callout-red { border-left-color: var(--red); background: var(--red-2); }
[data-theme="dark"] .callout-red { background: rgba(214, 69, 69, 0.12); }
.callout-orange { border-left-color: var(--orange); background: var(--orange-2); }
[data-theme="dark"] .callout-orange { background: rgba(232, 145, 73, 0.12); }
.callout strong { display: inline; }
.callout-label {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}
.callout-label.red-text { color: var(--red); }
.callout-label.green-text { color: var(--green); }
.callout-label.yellow-text { color: #b58c00; }
.callout-label.blue-text { color: var(--blue); }
.callout-label.orange-text { color: var(--orange); }

/* ============================================================
   TABLES
   ============================================================ */
.t-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 14px 0;
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-weight: 700; color: var(--text-2); background: var(--surface-alt); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-alt); }
[data-theme="dark"] tr:hover td { background: rgba(255,255,255,0.03); }

/* Comparison table colours */
.t-compare th.col-a { color: var(--red); }
.t-compare th.col-b { color: var(--green); }
.kw-red { color: var(--red); font-weight: 600; }
.kw-green { color: var(--green); font-weight: 600; }

/* ============================================================
   DEFINITION CARD
   ============================================================ */
.def-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 14px 0;
  position: relative;
}
.def-card::before {
  content: '✓';
  position: absolute;
  top: -10px; left: 14px;
  background: var(--green);
  color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.def-card h4 { margin: 4px 0 8px 0; color: var(--green); }
[data-theme="dark"] .def-card h4 { color: #6dd99e; }

/* ============================================================
   FLOWCHART DIAGRAMS
   ============================================================ */
.diagram {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  margin: 18px 0;
  text-align: center;
}
.diagram-title { font-weight: 700; color: var(--navy); margin-bottom: 4px; font-size: 15px; }
[data-theme="dark"] .diagram-title { color: var(--yellow); }
.diagram-sub { font-style: italic; color: var(--text-3); font-size: 12.5px; margin-bottom: 16px; }

.chain-row {
  display: grid;
  grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr;
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
  text-align: left;
}
.chain-cell {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  min-height: 56px;
}
.chain-cell.prop { border-left: 3px solid var(--blue); }
.chain-cell.haz { border-left: 3px solid var(--red); }
.chain-cell.prec { border-left: 3px solid var(--green); }
.chain-cell.why { border-left: 3px solid var(--yellow); }
.chain-cell.prop strong { display: block; font-size: 13px; color: var(--blue); margin-bottom: 2px; }
[data-theme="dark"] .chain-cell.prop strong { color: #8ec4e8; }
.chain-arrow { color: var(--text-3); font-weight: 700; text-align: center; }
.chain-header {
  display: grid;
  grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.chain-header div { padding: 0 10px; }

/* Step flow diagram */
.flow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: stretch;
  margin: 16px 0;
}
.flow-step {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 12px;
  position: relative;
  text-align: left;
  font-size: 13px;
}
.flow-step-num {
  font-weight: 700;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.flow-step-label { font-weight: 700; color: var(--text); }

/* Spill response sequence */
.seq {
  text-align: left;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 22px;
  margin: 14px 0;
  font-size: 14px;
}
.seq-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}
.seq-num {
  flex-shrink: 0;
  background: var(--green);
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.seq-arrow {
  border-left: 2px dashed var(--text-3);
  margin-left: 12px;
  height: 14px;
}

/* Acid-water comparison */
.acid-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 16px 0;
}
.acid-side {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.acid-side.wrong { border: 2px solid var(--red); }
.acid-side.right { border: 2px solid var(--green); }
.acid-side h4 { margin: 0 0 12px 0; }
.acid-side.wrong h4 { color: var(--red); }
.acid-side.right h4 { color: var(--green); }
.acid-flask {
  display: inline-block;
  padding: 12px 20px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin: 6px 0;
}
.acid-arrow { font-size: 22px; color: var(--text-3); }
.acid-note { font-size: 12.5px; color: var(--text-2); margin-top: 8px; font-style: italic; }

/* Cross-module connection cards */
.xmod-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 16px 0;
}
.xmod-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.xmod-card.m4 { border-top-color: var(--orange); }
.xmod-card.m5 { border-top-color: var(--blue); }
.xmod-card.m6 { border-top-color: var(--red); }
.xmod-card.m8 { border-top-color: var(--green); }
.xmod-card h4 { margin: 0 0 6px 0; font-size: 14px; }
.xmod-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); }
.xmod-card .sentence {
  background: var(--surface-alt);
  border-left: 3px solid var(--green);
  padding: 8px 12px;
  margin-top: 8px;
  font-style: italic;
  font-size: 13px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.xmod-card .when { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }

/* ============================================================
   Q&A CARDS
   ============================================================ */
.qa-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}
.qa-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}
.qa-meta-marks { display: flex; align-items: center; gap: 10px; }
.mark-bars { color: var(--yellow); letter-spacing: 1px; font-size: 14px; }
.qa-attribution { font-style: italic; text-transform: none; letter-spacing: 0.2px; color: var(--text-3); font-weight: 400; }
.qa-question { font-size: 15px; font-style: italic; margin-bottom: 12px; color: var(--text); padding: 8px 12px; background: var(--surface-alt); border-left: 3px solid var(--blue); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.qa-question strong { font-style: normal; }

/* MCQ */
.mcq-options { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.mcq-option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
}
.mcq-option:hover { background: var(--surface-alt); border-color: var(--text-3); }
.mcq-option.selected { background: var(--blue-2); border-color: var(--blue); }
[data-theme="dark"] .mcq-option.selected { background: rgba(74, 144, 194, 0.2); }
.mcq-option.correct { background: var(--green-2); border-color: var(--green); color: var(--green); font-weight: 600; }
.mcq-option.incorrect { background: var(--red-2); border-color: var(--red); color: var(--red); }
.mcq-option-letter { font-weight: 700; margin-right: 8px; color: var(--text-3); }
.mcq-actions { display: flex; gap: 10px; margin-top: 10px; }
.btn-primary {
  background: var(--navy);
  color: #fff;
  border: 1px solid var(--navy);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--navy-2); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--surface-alt); }

/* Reveal model answer */
.reveal { margin-top: 10px; }
.btn-reveal {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  width: 100%;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-reveal:hover { background: var(--surface); border-color: var(--blue); }
.btn-reveal::before { content: '▶'; font-size: 11px; transition: transform 0.2s; }
.btn-reveal.open::before { transform: rotate(90deg); }
.reveal-body { display: none; padding: 12px 4px 4px 4px; }
.reveal-body.open { display: block; }
.reveal-body .scaffold {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 13px;
  white-space: pre-wrap;
  margin: 8px 0;
  line-height: 1.55;
}
.reveal-body .answer { margin: 8px 0; }
.reveal-body .marks {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  margin: 8px 0;
}
.reveal-body .marks-label {
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-3);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.2px;
  margin-bottom: 6px;
  display: block;
}

/* ============================================================
   FLASHCARDS
   ============================================================ */
.flashcard-deck { perspective: 1400px; max-width: 540px; margin: 18px auto; }
.flashcard {
  position: relative;
  height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.55s;
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 16px;
  box-shadow: var(--shadow);
}
.flashcard-face.back { transform: rotateY(180deg); }
.flashcard-face .label {
  position: absolute;
  top: 12px; left: 16px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.flashcard-face.front { border-top: 3px solid var(--blue); }
.flashcard-face.back { border-top: 3px solid var(--green); }
.flashcard-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}
.flashcard-counter { color: var(--text-3); font-size: 13px; font-weight: 600; min-width: 60px; text-align: center; }

/* ============================================================
   FLOATING BUTTONS
   ============================================================ */
.float-btn {
  position: fixed;
  right: 22px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 90;
  transition: all 0.18s;
}
.float-btn:hover { background: var(--navy-2); transform: translateY(-2px); }
.float-back-top { bottom: 22px; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.float-back-top.show { opacity: 1; pointer-events: auto; }
.float-eqs { bottom: 80px; }

/* Equations panel */
.eqs-panel {
  position: fixed;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 18px 22px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s;
  z-index: 95;
}
.eqs-panel.open { transform: translateX(0); }
.eqs-panel h3 { margin-top: 0; }
.eqs-panel .eq {
  background: var(--surface-alt);
  border-left: 3px solid var(--yellow);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--mono);
  font-size: 13px;
  margin: 8px 0;
}
.eqs-panel .eq-label {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 4px;
  font-weight: 700;
}
.eqs-close {
  position: absolute;
  top: 10px; right: 14px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--text-3);
  cursor: pointer;
}

/* ============================================================
   SEARCH MODAL
   ============================================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 56, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 96px;
  z-index: 200;
}
.search-overlay.open { display: flex; }
.search-modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 600px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 16px 20px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-family: inherit;
}
.search-results { max-height: 50vh; overflow-y: auto; }
.search-result {
  display: block;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.search-result:hover { background: var(--surface-alt); }
.search-result-title { font-weight: 600; font-size: 14px; }
.search-result-section { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.search-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }

/* ============================================================
   CHEAT SHEET (print-optimised)
   ============================================================ */
.cheat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

/* ============================================================
   CTA
   ============================================================ */
.cta-section {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff;
  padding: 32px;
  border-radius: var(--radius);
  margin-top: 28px;
}
.cta-section h2 { color: var(--yellow); border-bottom-color: rgba(255,210,63,0.3); display: inline-flex; }
.cta-bullets { list-style: none; padding: 0; margin: 16px 0; }
.cta-bullets li { padding: 6px 0; color: rgba(255,255,255,0.92); font-size: 14.5px; }
.cta-bullets li strong { color: #fff; }
.cta-button {
  display: inline-block;
  background: var(--yellow);
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: var(--radius);
  font-size: 16px;
  margin: 14px 0 8px 0;
  transition: transform 0.15s;
}
.cta-button:hover { transform: translateY(-2px); }
.cta-section .reassurance { font-size: 13px; color: rgba(255,255,255,0.75); font-style: italic; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px; }
  .hero h1 { font-size: 26px; }
  .chain-row, .chain-header { grid-template-columns: 1fr; gap: 4px; }
  .chain-arrow { display: none; }
  .flow-steps { grid-template-columns: 1fr 1fr; }
  .acid-compare, .xmod-grid, .cheat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .header, .qa-bar, .float-btn, .eqs-panel, .search-overlay, .cta-section { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .layout { display: block; }
  .main { padding: 0; max-width: 100%; }
  .hero { background: none; color: #000; border: 2px solid #000; padding: 12px; }
  .hero h1 { color: #000; font-size: 18pt; }
  .hero h1 .highlight, .hero-eyebrow { color: #000; }
  .nesa-quote { background: #f0f0f0; color: #000; }
  .badge { color: #000; border-color: #000; }
  section { page-break-inside: avoid; }
  .qa-card, .diagram, .callout, .def-card { page-break-inside: avoid; borde