/* ==========================================================================
   FLOODLOCK DOCUMENTATION PORTAL — 1000x LUXURY & MODERN STARTUP EDITION
   Designed for: floodlock.docs.pages.dev
   
   Typography System: Old Money & Mafia UI Typography
     - Hero Display: Cinzel (Roman Serif, ALL CAPS, +0.14em tracking)
     - Editorial Headings: Playfair Display (Sharp classic serif with italic accents)
     - Subheadings & Quotes: Cormorant Garamond (Aristocratic old-style serif)
     - Clean Body Copy: Plus Jakarta Sans (Crisp modern geometric sans)
     - Buttons, Badges & Labels: Montserrat (Wide-tracked uppercase sans)
     - Technical Code: JetBrains Mono (Monospaced engineered precision)
   
   Color Palettes:
     - Dark Mode (Onyx Trench & Antique Gold):
         60% #121212 (Onyx Trench)
         30% #262626 (Slate Wool)
         10% #B45309 (Antique Gold)
     - Light Mode (Camel Coat & Espresso Roast):
         60% #F5EFE6 (Camel Coat)
         30% #E6D8C3 (Sand Suede)
         10% #451A03 (Espresso Roast)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700;800;900&family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Montserrat:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,500;0,600;0,700;0,800;1,400;1,600;1,700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens & Variables --- */
:root {
  --font-hero: 'Cinzel', Georgia, serif;
  --font-editorial: 'Playfair Display', Georgia, serif;
  --font-subheading: 'Cormorant Garamond', Garamond, serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-btn: 'Montserrat', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --topbar-height: 72px;
  --sidebar-width: 295px;
  --toc-width: 260px;
  --content-max-width: 960px;
  
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --transition-fast: 0.16s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Dark Theme (Default): Onyx Trench & Antique Gold
   ========================================================================== */
[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* 60% Canvas & Backgrounds */
  --bg-canvas: #0A0A0A;
  --bg-primary: #121212;
  --bg-topbar: rgba(18, 18, 18, 0.88);
  --bg-mesh-1: radial-gradient(circle at 18% 12%, rgba(180, 83, 9, 0.16) 0%, transparent 45%);
  --bg-mesh-2: radial-gradient(circle at 85% 65%, rgba(217, 119, 6, 0.08) 0%, transparent 40%);
  --grid-pattern: rgba(255, 255, 255, 0.025);

  /* 30% Secondary & Structure: Slate Wool */
  --bg-secondary: #171717;
  --bg-surface: #262626;
  --bg-surface-hover: #2E2E2E;
  --bg-card: #1C1C1C;
  --bg-card-inner: #161616;
  
  --border-subtle: #262626;
  --border-strong: #363636;
  --border-card: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(180, 83, 9, 0.4);

  /* 10% Accent: Antique Gold */
  --accent: #B45309;
  --accent-hover: #D97706;
  --accent-light: #F59E0B;
  --accent-surface: rgba(180, 83, 9, 0.12);
  --accent-glow: rgba(180, 83, 9, 0.32);
  --accent-border: rgba(180, 83, 9, 0.45);
  --accent-gradient: linear-gradient(135deg, #B45309 0%, #D97706 50%, #F59E0B 100%);
  --gold-text-gradient: linear-gradient(135deg, #FFFFFF 20%, #F59E0B 85%, #B45309 100%);

  /* Typography Colors */
  --text-primary: #F8F8F8;
  --text-secondary: #C8C8C8;
  --text-muted: #8E8E8E;
  --text-dim: #626262;
  --text-accent: #E08514;

  /* Code Syntax */
  --code-bg: #141414;
  --code-header-bg: #1D1D1D;
  --code-border: #2A2A2A;
  --code-text: #EDEDED;
  --code-inline-bg: #222222;
  --code-inline-text: #FBBF24;
  --code-inline-border: #333333;
  --syntax-keyword: #F59E0B;
  --syntax-string: #34D399;
  --syntax-func: #60A5FA;
  --syntax-comment: #71717A;

  /* Callouts & Badges */
  --callout-bg: rgba(180, 83, 9, 0.07);
  --callout-border: #B45309;
  --badge-bg: #242424;
  --badge-text: #F59E0B;
  --badge-border: rgba(180, 83, 9, 0.35);

  /* Table */
  --table-header-bg: #1A1A1A;
  --table-row-even: #151515;
  --table-border: #282828;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
  --shadow-gold: 0 0 24px rgba(180, 83, 9, 0.28);
}

/* ==========================================================================
   Light Theme: Camel Coat & Espresso Roast
   ========================================================================== */
[data-theme="light"] {
  /* 60% Canvas & Backgrounds */
  --bg-canvas: #EAE1D3;
  --bg-primary: #F5EFE6;
  --bg-topbar: rgba(245, 239, 230, 0.90);
  --bg-mesh-1: radial-gradient(circle at 18% 12%, rgba(69, 26, 3, 0.08) 0%, transparent 45%);
  --bg-mesh-2: radial-gradient(circle at 85% 65%, rgba(180, 83, 9, 0.06) 0%, transparent 40%);
  --grid-pattern: rgba(69, 26, 3, 0.035);

  /* 30% Secondary & Structure: Sand Suede */
  --bg-secondary: #EEE4D6;
  --bg-surface: #E6D8C3;
  --bg-surface-hover: #DCCEBA;
  --bg-card: #ECE0CE;
  --bg-card-inner: #F1E7DA;
  
  --border-subtle: #D8C7B0;
  --border-strong: #C4B097;
  --border-card: rgba(69, 26, 3, 0.12);
  --border-highlight: rgba(69, 26, 3, 0.4);

  /* 10% Accent: Espresso Roast */
  --accent: #451A03;
  --accent-hover: #291002;
  --accent-light: #6E2F09;
  --accent-surface: rgba(69, 26, 3, 0.08);
  --accent-glow: rgba(69, 26, 3, 0.2);
  --accent-border: rgba(69, 26, 3, 0.35);
  --accent-gradient: linear-gradient(135deg, #451A03 0%, #6E2F09 60%, #B45309 100%);
  --gold-text-gradient: linear-gradient(135deg, #2B1202 20%, #451A03 60%, #B45309 100%);

  /* Typography Colors */
  --text-primary: #271002;
  --text-secondary: #4A3426;
  --text-muted: #785C49;
  --text-dim: #997E6C;
  --text-accent: #7A2E05;

  /* Code Syntax */
  --code-bg: #E7DDCE;
  --code-header-bg: #DECDB8;
  --code-border: #CFBEA7;
  --code-text: #271002;
  --code-inline-bg: #DFD1BF;
  --code-inline-text: #451A03;
  --code-inline-border: #CCBAA2;
  --syntax-keyword: #9A3412;
  --syntax-string: #047857;
  --syntax-func: #1D4ED8;
  --syntax-comment: #7C6856;

  /* Callouts & Badges */
  --callout-bg: rgba(69, 26, 3, 0.06);
  --callout-border: #451A03;
  --badge-bg: #E3D4BE;
  --badge-text: #451A03;
  --badge-border: rgba(69, 26, 3, 0.35);

  /* Table */
  --table-header-bg: #DFD0BA;
  --table-row-even: #EBE0D0;
  --table-border: #D1BFA6;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(69, 26, 3, 0.07);
  --shadow-md: 0 8px 22px rgba(69, 26, 3, 0.11);
  --shadow-lg: 0 16px 36px rgba(69, 26, 3, 0.15);
  --shadow-gold: 0 0 22px rgba(180, 83, 9, 0.22);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 32px);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  background-image: var(--bg-mesh-1), var(--bg-mesh-2);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.72;
  min-height: 100vh;
  position: relative;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* Background Subtle Blueprint Grid */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, var(--grid-pattern) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-pattern) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* Scroll Progress Bar at very top */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent-gradient);
  z-index: 999;
  transition: width 0.08s ease-out;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ==========================================================================
   Typography Classes (Mafia & Old Money System)
   ========================================================================== */
.font-hero,
.brand-title,
.section-tag,
.hero-tagline,
.card-hero-title,
.monogram {
  font-family: var(--font-hero);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1, h2,
.font-editorial,
.doc-h1,
.doc-h2 {
  font-family: var(--font-editorial);
  font-weight: 600;
  line-height: 1.24;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

h1, .doc-h1 {
  font-size: 2.85rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
}

h2, .doc-h2 {
  font-size: 1.85rem;
  margin-top: 3.25rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h2::before {
  content: '§';
  font-family: var(--font-hero);
  font-size: 1.1rem;
  color: var(--accent);
  opacity: 0.8;
}

h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 56px;
  height: 2px;
  background: var(--accent-gradient);
}

h3, h4,
.font-subheading,
.lead-quote,
.section-lead,
.doc-quote {
  font-family: var(--font-subheading);
  letter-spacing: 0.01em;
}

h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
}

h4 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.35rem;
  margin-bottom: 0.45rem;
}

.lead-quote {
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
  padding: 1.1rem 1.6rem;
  margin: 1.75rem 0;
  background-color: var(--callout-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  position: relative;
}

.lead-quote::before {
  content: '“';
  font-family: var(--font-editorial);
  font-size: 3rem;
  position: absolute;
  left: 0.4rem;
  top: -0.5rem;
  color: var(--accent);
  opacity: 0.25;
}

p, li, td, th, input, textarea {
  font-family: var(--font-body);
}

p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.75;
}

button,
.btn,
.nav-link,
.badge,
.tab-btn,
.chip,
.font-label,
.kbd-shortcut {
  font-family: var(--font-btn);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  font-size: 0.74rem;
}

code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* ==========================================================================
   Header / Top Navigation Bar (Glassmorphic)
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background-color: var(--bg-topbar);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.4rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.brand-crest {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-family: var(--font-hero);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm), var(--shadow-gold);
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.brand-crest::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(60deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
  animation: shine 6s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  20%, 100% { transform: translateX(100%); }
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.16em;
  line-height: 1.1;
}

.brand-subtitle {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* Topbar Center: Raycast / Linear style Search Bar with Cmd+K pill */
.topbar-center {
  flex: 1;
  max-width: 480px;
  margin: 0 2rem;
}

.search-bar-trigger {
  width: 100%;
  height: 40px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0 1rem 0 2.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.search-bar-trigger:hover {
  border-color: var(--accent);
  background-color: var(--bg-surface-hover);
  box-shadow: 0 0 0 3px var(--accent-surface);
}

.search-icon-fixed {
  position: absolute;
  left: 0.95rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.kbd-badge {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Topbar Right Controls */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.badge-version {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.status-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10B981;
  display: inline-block;
  box-shadow: 0 0 10px #10B981;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.25); }
}

.theme-toggle-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  height: 38px;
  padding: 0 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  background-color: var(--bg-surface-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-luxury {
  background: var(--accent-gradient);
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.62rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-luxury:hover {
  box-shadow: var(--shadow-gold), var(--shadow-md);
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ==========================================================================
   Documentation Layout (Sidebar, Content, TOC)
   ========================================================================== */
.docs-layout {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  position: relative;
  z-index: 1;
}

/* --- Left Sidebar Navigation --- */
.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  position: sticky;
  top: var(--topbar-height);
  background-color: var(--bg-canvas);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 1.75rem 1.25rem 3.5rem 1.75rem;
  flex-shrink: 0;
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.sidebar-section {
  margin-bottom: 2.25rem;
}

.sidebar-heading {
  font-family: var(--font-hero);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-list {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.48rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
  transform: translateX(2px);
}

.sidebar-link.active {
  color: var(--text-accent);
  background-color: var(--accent-surface);
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.pill-sm {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  padding: 0.14rem 0.45rem;
  border-radius: 3px;
  background-color: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  max-width: var(--content-max-width);
  padding: 3rem 3.5rem 6rem 3.5rem;
  margin: 0 auto;
}

/* --- Right Table of Contents (Desktop) --- */
.toc-sidebar {
  width: var(--toc-width);
  height: calc(100vh - var(--topbar-height));
  position: sticky;
  top: var(--topbar-height);
  padding: 3rem 1.5rem 2rem 1rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.toc-title {
  font-family: var(--font-hero);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toc-list {
  list-style: none;
  border-left: 1px solid var(--border-subtle);
  padding-left: 0.85rem;
}

.toc-item {
  margin-bottom: 0.55rem;
}

.toc-link {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: block;
  transition: color var(--transition-fast), transform var(--transition-fast);
  line-height: 1.45;
}

.toc-link:hover {
  color: var(--text-primary);
  transform: translateX(2px);
}

.toc-link.active {
  color: var(--text-accent);
  font-weight: 600;
  border-left: 2px solid var(--accent);
  margin-left: -0.92rem;
  padding-left: 0.8rem;
}

/* ==========================================================================
   Hero Section & Live Telemetry Strip
   ========================================================================== */
.doc-hero {
  margin-bottom: 3.5rem;
  padding-bottom: 2.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.hero-badge {
  font-family: var(--font-hero);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  background-color: var(--accent-surface);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 0.35rem 0.95rem;
  border-radius: var(--radius-xs);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.doc-hero-title {
  font-family: var(--font-editorial);
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1.12;
  margin-bottom: 1.15rem;
  background: var(--gold-text-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.doc-hero-subtitle {
  font-family: var(--font-subheading);
  font-size: 1.55rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 2rem;
}

/* Live Telemetry Metric Strip */
.telemetry-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 2rem 0;
}

.telemetry-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.telemetry-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.telemetry-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
}

.telemetry-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.telemetry-lbl {
  font-family: var(--font-btn);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.35rem;
  display: block;
}

/* 4 Quick-Nav Bento Cards */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 2rem 0;
}

.bento-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md), var(--shadow-gold);
  transform: translateY(-2px);
}

.bento-icon {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.bento-title {
  font-family: var(--font-editorial);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.bento-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.bento-arrow {
  font-family: var(--font-btn);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--text-accent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
}

/* ==========================================================================
   Speed Benchmark Visual Comparison (HEC-RAS vs. FloodLock)
   ========================================================================== */
.benchmark-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.85rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
}

.benchmark-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.benchmark-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.benchmark-label {
  width: 220px;
}

.benchmark-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.benchmark-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.benchmark-bar-track {
  flex: 1;
  height: 12px;
  background-color: var(--bg-surface);
  border-radius: 6px;
  margin: 0 1.5rem;
  overflow: hidden;
  position: relative;
}

.benchmark-bar-fill-slow {
  width: 95%;
  height: 100%;
  background-color: #EF4444;
  border-radius: 6px;
}

.benchmark-bar-fill-fast {
  width: 2%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 6px;
  box-shadow: 0 0 10px #F59E0B;
}

.benchmark-time {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  width: 110px;
  text-align: right;
}

.benchmark-time.slow { color: #EF4444; }
.benchmark-time.fast { color: #10B981; }

/* ==========================================================================
   Interactive SVG Architecture Diagram
   ========================================================================== */
.arch-diagram-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.diagram-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
}

/* ==========================================================================
   Code Blocks & Windows
   ========================================================================== */
.code-window {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  margin: 1.75rem 0;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.code-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.25rem;
  background-color: var(--code-header-bg);
  border-bottom: 1px solid var(--code-border);
}

.code-window-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background-color: #EF4444; }
.dot-yellow { background-color: #F59E0B; }
.dot-green { background-color: #10B981; }

.code-tabs {
  display: flex;
  gap: 0.4rem;
  margin-left: 1rem;
}

.code-tab-btn {
  background: none;
  border: none;
  font-family: var(--font-btn);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.code-tab-btn:hover {
  color: var(--text-primary);
}

.code-tab-btn.active {
  background-color: var(--accent-surface);
  color: var(--text-accent);
  font-weight: 700;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  font-size: 0.68rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background-color: var(--bg-surface);
}

pre {
  padding: 1.35rem 1.5rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.68;
  color: var(--code-text);
}

p code, li code, td code {
  background-color: var(--code-inline-bg);
  color: var(--code-inline-text);
  padding: 0.16rem 0.4rem;
  border-radius: 3px;
  font-size: 0.85em;
  border: 1px solid var(--code-inline-border);
}

/* ==========================================================================
   Math Formulas & Governing Equations
   ========================================================================== */
.math-block {
  background-color: var(--bg-card);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.4rem 1.75rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow-sm);
  border-top: 1px solid var(--border-card);
  border-right: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
}

.math-title {
  font-family: var(--font-editorial);
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.math-expression {
  font-family: 'Times New Roman', Times, serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  padding: 0.6rem 0;
  display: block;
  overflow-x: auto;
}

.math-annotation {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0;
  line-height: 1.6;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrapper {
  overflow-x: auto;
  margin: 1.75rem 0;
  border: 1px solid var(--table-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

th {
  background-color: var(--table-header-bg);
  font-family: var(--font-btn);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--table-border);
}

td {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-secondary);
}

tr:nth-child(even) td {
  background-color: var(--table-row-even);
}

tr:hover td {
  background-color: var(--bg-surface);
}

/* ==========================================================================
   Callouts & Alerts
   ========================================================================== */
.callout {
  border-radius: var(--radius-sm);
  padding: 1.35rem 1.65rem;
  margin: 1.85rem 0;
  border-left: 4px solid var(--callout-border);
  background-color: var(--callout-bg);
  border-top: 1px solid var(--border-card);
  border-right: 1px solid var(--border-card);
  border-bottom: 1px solid var(--border-card);
}

.callout-header {
  font-family: var(--font-btn);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-accent);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.callout p {
  color: var(--text-secondary);
  margin-bottom: 0;
  font-size: 0.93rem;
}

/* ==========================================================================
   Interactive API Sandbox / Tester (Stripe / Linear Style)
   ========================================================================== */
.api-tester {
  background-color: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1.85rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md), var(--shadow-gold);
}

.tester-row {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
  flex-wrap: wrap;
}

.tester-method {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
  background-color: var(--bg-surface);
  color: var(--accent);
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tester-input {
  flex: 1;
  min-width: 140px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
}

.tester-btn {
  background: var(--accent-gradient);
  color: #FFFFFF;
  border: none;
  font-family: var(--font-btn);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0 1.4rem;
  height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.tester-btn:hover {
  filter: brightness(1.1);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.tester-response {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--code-text);
  max-height: 320px;
  overflow-y: auto;
}

/* ==========================================================================
   Raycast / Linear Command Palette Modal (Ctrl+K)
   ========================================================================== */
.cmd-palette-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.cmd-palette-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.cmd-palette {
  width: 90%;
  max-width: 580px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
  overflow: hidden;
  transform: scale(0.96) translateY(-10px);
  transition: transform var(--transition-fast);
}

.cmd-palette-backdrop.open .cmd-palette {
  transform: scale(1) translateY(0);
}

.cmd-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.cmd-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-family: var(--font-body);
  outline: none;
}

.cmd-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 0.5rem;
  list-style: none;
}

.cmd-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.cmd-item:hover, .cmd-item.selected {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.cmd-shortcut {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Documentation Feedback Widget & Footer
   ========================================================================== */
.feedback-widget {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 4rem 0 2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.feedback-buttons {
  display: flex;
  gap: 0.75rem;
}

.feedback-btn {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-btn);
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.feedback-btn:hover {
  border-color: var(--accent);
  background-color: var(--bg-surface-hover);
}

.docs-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1240px) {
  .toc-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: block;
  }
  .sidebar {
    position: fixed;
    left: -100%;
    z-index: 90;
    width: 290px;
    transition: left var(--transition-smooth);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    left: 0;
  }
  .main-content {
    padding: 2rem 1.5rem;
  }
  .topbar-center {
    display: none;
  }
  .telemetry-strip, .bento-grid {
    grid-template-columns: 1fr;
  }
  .doc-hero-title {
    font-size: 2.35rem;
  }
}
