/* ============================================================
   TECHTOWN-THEME.css
   MediaVerse Acoustic Study - Shared CSS Theme
   Light Mode, ADHD-Friendly Palette
   Structure inspired by techtown.obaisukar.com
   ============================================================ */

/* ============================================================
   1. CSS CUSTOM PROPERTIES
   ============================================================ */

:root {
  /* Backgrounds */
  --bg-primary: #fafbff;
  --bg-secondary: #f0f4ff;
  --bg-card: #ffffff;
  --bg-hero: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f9ff 100%);

  /* Accents */
  --accent-purple: #7c3aed;
  --accent-lavender: #a78bfa;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --accent-gold: #f59e0b;
  --accent-teal: #14b8a6;
  --accent-pink: #ec4899;
  --accent-indigo: #6366f1;
  --accent-emerald: #059669;
  --accent-amber: #d97706;

  /* Text */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Borders & Shadows */
  --border: #e2e8f0;
  --border-accent: #c4b5fd;
  --shadow-sm: 0 1px 3px rgba(124, 58, 237, 0.06);
  --shadow-md: 0 4px 12px rgba(124, 58, 237, 0.08);
  --shadow-lg: 0 8px 30px rgba(124, 58, 237, 0.12);
  --shadow-card: 0 2px 16px rgba(124, 58, 237, 0.06);

  /* Spacing */
  --section-gap: 120px;
  --card-radius: 16px;
  --nav-height: 64px;
}


/* ============================================================
   2. RESET & BASE
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-purple);
  text-decoration: underline;
}


/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Accent-colored keywords inside headings */
h1 .accent,
h2 .accent,
h3 .accent {
  color: var(--accent-purple);
}

h1 .accent-pink   { color: var(--accent-pink); }
h1 .accent-indigo  { color: var(--accent-indigo); }
h1 .accent-emerald { color: var(--accent-emerald); }
h1 .accent-amber   { color: var(--accent-amber); }
h1 .accent-teal    { color: var(--accent-teal); }

h2 .accent-pink   { color: var(--accent-pink); }
h2 .accent-indigo  { color: var(--accent-indigo); }
h2 .accent-emerald { color: var(--accent-emerald); }
h2 .accent-amber   { color: var(--accent-amber); }
h2 .accent-teal    { color: var(--accent-teal); }

p {
  margin-bottom: 1rem;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

code {
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent-purple);
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: var(--text-primary);
}


/* ============================================================
   4. LAYOUT CONTAINERS
   ============================================================ */

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: var(--section-gap) 0;
}

.section + .section {
  border-top: 1px solid var(--border);
}

/* Full-width wrapper for hero-style backgrounds */
.section--hero {
  background: var(--bg-hero);
  padding: 100px 0 80px;
}

/* Two-column grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* Three-column grid */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Four-column grid */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}


/* ============================================================
   5. STICKY TOP NAVIGATION
   ============================================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--accent-purple);
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.nav__logo:hover {
  text-decoration: none;
  color: var(--accent-purple);
}

.nav__links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.nav__link {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav__link:hover {
  color: var(--accent-purple);
  text-decoration: none;
}

.nav__link.active {
  color: var(--accent-purple);
  border-bottom-color: var(--accent-purple);
}

/* Back link (used in sub-pages) */
.nav__back {
  font-size: 0.875rem;
  color: var(--accent-purple);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav__back:hover {
  color: var(--accent-lavender);
  text-decoration: underline;
}

/* Spacer below fixed nav */
.nav-spacer {
  height: var(--nav-height);
}


/* ============================================================
   6. SECTION LABELS
   ============================================================ */

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-purple);
  margin-bottom: 12px;
  display: block;
}

/* Dash prefix variant */
.section-label::before {
  content: "\2014\00a0";
}


/* ============================================================
   7. CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 32px;
  border: 1px solid var(--border);
  border-left: 4px solid;
  border-image: linear-gradient(to bottom, var(--accent-purple), var(--accent-blue)) 1;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Alternating left/right layout */
.card-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.card-row:nth-child(even) {
  flex-direction: row-reverse;
}

.card-row .card {
  flex: 1;
}

.card-row .card-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   8. ROOM-SPECIFIC CARDS
   ============================================================ */

/* VO Live Room - Pink */
.card--vo-live {
  border-image: none;
  border-left: 4px solid var(--accent-pink);
  box-shadow: 0 2px 16px rgba(236, 72, 153, 0.08);
}

.card--vo-live:hover {
  box-shadow: 0 8px 30px rgba(236, 72, 153, 0.14);
}

/* Control Room - Indigo */
.card--control {
  border-image: none;
  border-left: 4px solid var(--accent-indigo);
  box-shadow: 0 2px 16px rgba(99, 102, 241, 0.08);
}

.card--control:hover {
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.14);
}

/* Studio Room - Emerald */
.card--studio {
  border-image: none;
  border-left: 4px solid var(--accent-emerald);
  box-shadow: 0 2px 16px rgba(5, 150, 105, 0.08);
}

.card--studio:hover {
  box-shadow: 0 8px 30px rgba(5, 150, 105, 0.14);
}

/* Editing Room - Amber */
.card--editing {
  border-image: none;
  border-left: 4px solid var(--accent-amber);
  box-shadow: 0 2px 16px rgba(217, 119, 6, 0.08);
}

.card--editing:hover {
  box-shadow: 0 8px 30px rgba(217, 119, 6, 0.14);
}

/* Buffer Zone - Teal */
.card--buffer {
  border-image: none;
  border-left: 4px solid var(--accent-teal);
  box-shadow: 0 2px 16px rgba(20, 184, 166, 0.08);
}

.card--buffer:hover {
  box-shadow: 0 8px 30px rgba(20, 184, 166, 0.14);
}


/* ============================================================
   9. INTERACTIVE SELECTORS (Room/Zone Picker)
   ============================================================ */

.room-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.room-picker__btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}

/* Room-specific button colors */
.room-picker__btn[data-room="vo-live"] {
  color: var(--accent-pink);
  border-color: var(--accent-pink);
}
.room-picker__btn[data-room="vo-live"].active,
.room-picker__btn[data-room="vo-live"]:hover {
  background: var(--accent-pink);
  color: #fff;
}

.room-picker__btn[data-room="control"] {
  color: var(--accent-indigo);
  border-color: var(--accent-indigo);
}
.room-picker__btn[data-room="control"].active,
.room-picker__btn[data-room="control"]:hover {
  background: var(--accent-indigo);
  color: #fff;
}

.room-picker__btn[data-room="studio"] {
  color: var(--accent-emerald);
  border-color: var(--accent-emerald);
}
.room-picker__btn[data-room="studio"].active,
.room-picker__btn[data-room="studio"]:hover {
  background: var(--accent-emerald);
  color: #fff;
}

.room-picker__btn[data-room="editing"] {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
}
.room-picker__btn[data-room="editing"].active,
.room-picker__btn[data-room="editing"]:hover {
  background: var(--accent-amber);
  color: #fff;
}

.room-picker__btn[data-room="buffer"] {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
}
.room-picker__btn[data-room="buffer"].active,
.room-picker__btn[data-room="buffer"]:hover {
  background: var(--accent-teal);
  color: #fff;
}


/* ============================================================
   10. TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  background: var(--bg-secondary);
  color: var(--accent-purple);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
}

tbody tr:nth-child(odd) {
  background: var(--bg-primary);
}

tbody tr:nth-child(even) {
  background: var(--bg-card);
}

tbody tr:hover {
  background: #ede9fe;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* Compact table variant */
table.compact td,
table.compact th {
  padding: 6px 12px;
  font-size: 0.825rem;
}


/* ============================================================
   11. BADGES / TAGS
   ============================================================ */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}

/* Allow long badges (e.g. coincidence alerts) to wrap inside table cells */
tbody td .badge {
  white-space: normal;
  word-break: break-word;
  border-radius: 8px;
  max-width: 100%;
}

.badge-pass {
  background: var(--accent-green);
  color: #fff;
}

.badge-fail {
  background: var(--accent-red);
  color: #fff;
}

.badge-warn {
  background: var(--accent-gold);
  color: #1e293b;
}

/* NC rating badges */
.badge-nc20 {
  background: #dbeafe;
  color: #1e40af;
}

.badge-nc25 {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-nc30 {
  background: #ede9fe;
  color: #5b21b6;
}

.badge-nc35 {
  background: #fce7f3;
  color: #9d174d;
}

/* Locked / Design Spec badge */
.badge-locked {
  background: #f0fdf4;
  color: var(--accent-green);
  border: 1.5px solid var(--accent-green);
}

.badge-locked::before {
  content: "LOCKED \2022 ";
}

/* Approx badge */
.badge-approx {
  background: #fffbeb;
  color: var(--accent-amber);
  border: 1.5px solid var(--accent-gold);
}

.badge-approx::before {
  content: "APPROX \2022 ";
}

/* Room-color badges (alternative inline use) */
.badge-vo-live  { background: rgba(236, 72, 153, 0.12); color: var(--accent-pink); }
.badge-control  { background: rgba(99, 102, 241, 0.12); color: var(--accent-indigo); }
.badge-studio   { background: rgba(5, 150, 105, 0.12); color: var(--accent-emerald); }
.badge-editing  { background: rgba(217, 119, 6, 0.12); color: var(--accent-amber); }
.badge-buffer   { background: rgba(20, 184, 166, 0.12); color: var(--accent-teal); }


/* ============================================================
   12. CALLOUT BOXES (Locked / Warning / Critical)
   ============================================================ */

.callout {
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 1.5rem;
  font-size: 0.925rem;
  line-height: 1.6;
}

/* Locked / Design Spec */
.callout--locked {
  background: #f0fdf4;
  border-left: 4px solid var(--accent-green);
}

.callout--locked .callout__tag {
  display: inline-block;
  background: var(--accent-green);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Warning / Note */
.callout--warning {
  background: #fffbeb;
  border-left: 4px solid var(--accent-gold);
}

.callout--warning .callout__tag {
  display: inline-block;
  background: var(--accent-gold);
  color: #1e293b;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Critical */
.callout--critical {
  background: #fef2f2;
  border-left: 4px solid var(--accent-red);
}

.callout--critical .callout__tag {
  display: inline-block;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Info callout */
.callout--info {
  background: #eff6ff;
  border-left: 4px solid var(--accent-blue);
}

.callout--info .callout__tag {
  display: inline-block;
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}


/* ============================================================
   13. FORMULA DISPLAY
   ============================================================ */

.formula {
  background: #f5f3ff;
  border-left: 4px solid var(--accent-purple);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 1.5rem;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--accent-purple);
  overflow-x: auto;
}

.formula .result {
  color: var(--accent-green);
  font-weight: 700;
}

.formula .variable {
  color: var(--accent-indigo);
}

.formula .label {
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}


/* ============================================================
   14. STAT CARDS (Hero Section)
   ============================================================ */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin: 40px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card__value {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: var(--accent-purple);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}


/* ============================================================
   15. PROGRESS BARS
   ============================================================ */

.progress {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent-purple);
  transition: width 1s ease-in-out;
}

.progress__fill--green  { background: var(--accent-green); }
.progress__fill--red    { background: var(--accent-red); }
.progress__fill--gold   { background: var(--accent-gold); }
.progress__fill--blue   { background: var(--accent-blue); }
.progress__fill--teal   { background: var(--accent-teal); }

/* Larger variant */
.progress--lg {
  height: 12px;
}


/* ============================================================
   16. SVG CONTAINER
   ============================================================ */

.svg-container {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

.svg-container svg {
  max-width: 100%;
  height: auto;
}


/* ============================================================
   17. TABLE OF CONTENTS (Sidebar)
   ============================================================ */

.toc {
  position: sticky;
  top: calc(var(--nav-height) + 32px);
  max-height: calc(100vh - var(--nav-height) - 64px);
  overflow-y: auto;
  padding-right: 16px;
}

.toc__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.toc__list {
  list-style: none;
  counter-reset: toc-counter;
}

.toc__item {
  counter-increment: toc-counter;
  margin-bottom: 4px;
}

.toc__link {
  display: block;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.toc__link::before {
  content: counter(toc-counter, decimal-leading-zero) ". ";
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  margin-right: 4px;
}

.toc__link:hover {
  background: var(--bg-secondary);
  color: var(--accent-purple);
  text-decoration: none;
}

.toc__link.active {
  background: #ede9fe;
  color: var(--accent-purple);
  font-weight: 600;
}

/* Layout with sidebar TOC */
.layout-with-toc {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}


/* ============================================================
   18. TOOLTIP
   ============================================================ */

.tooltip-wrap {
  position: relative;
  display: inline-block;
  cursor: help;
}

.tooltip-wrap .tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  background: #1e293b;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

/* Arrow */
.tooltip-wrap .tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.tooltip-wrap:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}


/* ============================================================
   19. NAVIGATION BACK LINK
   ============================================================ */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-purple);
  text-decoration: none;
  margin-bottom: 32px;
  transition: color 0.2s ease;
}

.back-link::before {
  content: "\2190";
  font-size: 1.1em;
}

.back-link:hover {
  color: var(--accent-lavender);
  text-decoration: underline;
}


/* ============================================================
   20. SCROLL-DRIVEN ANIMATIONS
   (Add .visible class via IntersectionObserver)
   ============================================================ */

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger children animations */
.stagger > *:nth-child(1) { transition-delay: 0s; }
.stagger > *:nth-child(2) { transition-delay: 0.1s; }
.stagger > *:nth-child(3) { transition-delay: 0.2s; }
.stagger > *:nth-child(4) { transition-delay: 0.3s; }
.stagger > *:nth-child(5) { transition-delay: 0.4s; }
.stagger > *:nth-child(6) { transition-delay: 0.5s; }


/* ============================================================
   21. FLOATING PARTICLES (Canvas Reference)
   ============================================================
   To add the subtle floating particle effect, include this JS
   in your HTML after a <canvas id="particles"></canvas> element:

   <script>
   (function(){
     const c = document.getElementById('particles');
     if (!c) return;
     const ctx = c.getContext('2d');
     let w, h, dots = [];
     function resize() { w = c.width = window.innerWidth; h = c.height = window.innerHeight; }
     window.addEventListener('resize', resize); resize();
     for (let i = 0; i < 40; i++) {
       dots.push({
         x: Math.random() * w, y: Math.random() * h,
         r: Math.random() * 2 + 1,
         dx: (Math.random() - 0.5) * 0.3,
         dy: (Math.random() - 0.5) * 0.3,
         color: Math.random() > 0.5 ? 'rgba(124,58,237,' : 'rgba(59,130,246,',
         opacity: Math.random() * 0.1 + 0.15
       });
     }
     function draw() {
       ctx.clearRect(0, 0, w, h);
       dots.forEach(d => {
         ctx.beginPath();
         ctx.arc(d.x, d.y, d.r, 0, Math.PI * 2);
         ctx.fillStyle = d.color + d.opacity + ')';
         ctx.fill();
         d.x += d.dx; d.y += d.dy;
         if (d.x < 0 || d.x > w) d.dx *= -1;
         if (d.y < 0 || d.y > h) d.dy *= -1;
       });
       requestAnimationFrame(draw);
     }
     draw();
   })();
   </script>

   Style the canvas:
   ============================================================ */

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}


/* ============================================================
   22. UTILITY CLASSES
   ============================================================ */

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.text-purple  { color: var(--accent-purple); }
.text-green   { color: var(--accent-green); }
.text-red     { color: var(--accent-red); }
.text-blue    { color: var(--accent-blue); }
.text-gold    { color: var(--accent-gold); }
.text-teal    { color: var(--accent-teal); }
.text-pink    { color: var(--accent-pink); }
.text-indigo  { color: var(--accent-indigo); }
.text-emerald { color: var(--accent-emerald); }
.text-amber   { color: var(--accent-amber); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-mono { font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mt-4  { margin-top: 32px; }
.mt-5  { margin-top: 48px; }

.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.mb-3  { margin-bottom: 24px; }
.mb-4  { margin-bottom: 32px; }
.mb-5  { margin-bottom: 48px; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


/* ============================================================
   23. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
  :root {
    --section-gap: 80px;
  }

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

  .toc {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-right: 0;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }

  .toc__list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

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

  .card-row,
  .card-row:nth-child(even) {
    flex-direction: column;
  }

  .nav__links {
    gap: 16px;
  }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  :root {
    --section-gap: 60px;
    --nav-height: 56px;
  }

  body {
    font-size: 0.9375rem;
  }

  .container {
    padding: 0 16px;
  }

  .nav__links {
    display: none; /* Toggle via JS hamburger menu */
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    padding: 20px;
  }

  .stat-card {
    padding: 20px 16px;
  }

  .room-picker {
    gap: 8px;
  }

  .room-picker__btn {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .section--hero {
    padding: 60px 0 48px;
  }

  .toc {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 24px;
  }

  .toc__list {
    flex-direction: column;
  }

  /* Horizontal scroll indicator for tables */
  .table-wrap {
    position: relative;
  }

  .table-wrap::after {
    content: "Scroll \2192";
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
  }
}


/* ============================================================
   24. PRINT STYLES
   ============================================================ */

@media print {
  /* Hide non-essential elements */
  .nav,
  .nav-spacer,
  #particles,
  .room-picker,
  .back-link,
  .toc {
    display: none !important;
  }

  /* Reset animations */
  .fade-in,
  .slide-left,
  .slide-right,
  .scale-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* White background, black text */
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .section {
    padding: 32px 0;
    page-break-before: auto;
  }

  h1, h2, h3 {
    page-break-after: avoid;
    color: #000;
  }

  h1 .accent,
  h2 .accent,
  h3 .accent {
    color: #000;
  }

  /* Show link URLs */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
    word-break: break-all;
  }

  /* Internal links: no URL suffix */
  a[href^="#"]::after {
    content: "";
  }

  .callout {
    border: 1px solid #ccc;
    background: #f8f8f8;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .callout--warning {
    border-left: 4px solid #b45309;
    background: #fffbeb;
  }

  .callout--info {
    border-left: 4px solid #1d4ed8;
    background: #eff6ff;
  }

  .callout__tag {
    color: #000 !important;
    font-weight: 700;
  }

  .progress {
    border: 1px solid #ccc;
  }

  .progress__fill {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table {
    font-size: 9pt;
  }

  thead th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tbody tr:nth-child(odd) {
    background: #f5f5f5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


/* ============================================================
   25. INTERSECTION OBSERVER HELPER (JS Reference)
   ============================================================
   Add this script to each HTML file to activate scroll animations:

   <script>
   document.addEventListener('DOMContentLoaded', () => {
     const observer = new IntersectionObserver((entries) => {
       entries.forEach(entry => {
         if (entry.isIntersecting) {
           entry.target.classList.add('visible');
         }
       });
     }, { threshold: 0.1, rootMargin: '0px 0px -40px 0px' });

     document.querySelectorAll('.fade-in, .slide-left, .slide-right, .scale-in')
       .forEach(el => observer.observe(el));
   });
   </script>
   ============================================================ */


/* ============================================================
   BOTTOM NAVIGATION BAR
   Consistent "Back to Index" footer nav for all pages
   ============================================================ */

.bottom-nav {
  margin-top: 60px;
  padding: 24px 32px;
  background: var(--bg-secondary);
  border-top: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.bottom-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-purple);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.bottom-nav a:hover {
  background: var(--accent-purple);
  color: #fff;
  border-color: var(--accent-purple);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.bottom-nav .nav-sep {
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .bottom-nav {
    flex-direction: column;
    padding: 20px 16px;
    gap: 12px;
  }
  .bottom-nav a {
    width: 100%;
    justify-content: center;
  }
  .bottom-nav .nav-sep {
    display: none;
  }
}
