/* =====================================================
   AMO Toolkit — Design System
   ===================================================== */

/* 1. Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; color: inherit; }
ul, ol { list-style: none; }

/* 2. Design Tokens */
:root {
  /* Backgrounds */
  --bg-base:        #02080f;
  --bg-surface:     #060e1c;
  --bg-card:        #0c1526;
  --bg-card-hover:  #101d30;
  --bg-glass:       rgba(6, 14, 28, 0.88);

  /* Borders */
  --border:         rgba(56, 189, 248, 0.10);
  --border-med:     rgba(56, 189, 248, 0.18);
  --border-strong:  rgba(56, 189, 248, 0.28);

  /* Text */
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  /* ── Tool Accent Colors ── */
  --c-atom:     #38bdf8;   /* Atom Library             — sky blue  */
  --c-lab:      #34d399;   /* Lab Techniques            — emerald   */
  --c-qc:       #a78bfa;   /* QC Landscape              — violet    */
  --c-cool:     #60a5fa;   /* Cooling Simulator         — blue      */
  --c-rr:       #fb923c;   /* Release-Recapture         — orange    */
  --c-calc:     #fbbf24;   /* Lab Calculators           — amber     */
  --c-cg:       #f472b6;   /* Clebsch-Gordan            — pink      */
  --c-lock:     #f87171;   /* Laser Locking             — rose      */
  --c-zern:     #2dd4bf;   /* Zernike                   — teal      */
  --c-pol:      #e879f9;   /* Polarimetry Explorer      — fuchsia   */
  --c-ryd:      #818cf8;   /* Rydberg Calculator        — indigo    */
  --c-img:      #34d399;   /* Imaging Calculator        — emerald   */
  --c-tof:      #38bdf8;   /* TOF Thermometry           — sky       */
  --c-mot:      #fb923c;   /* MOT Designer              — orange    */
  --c-noise:    #f87171;   /* Noise & Fidelity Budget   — rose      */

  /* Learn-track color */
  --c-learn:    #c084fc;   /* purple-ish, secondary */

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Spacing */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* Radii */
  --r-sm: 0.375rem;
  --r:    0.75rem;
  --r-lg: 1rem;
  --r-xl: 1.375rem;
  --r-2xl: 1.75rem;

  /* Shadows */
  --shadow:    0 4px 20px rgba(0,0,0,0.55);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.65);

  /* Transitions */
  --t: 0.22s ease;
  --t-slow: 0.4s ease;
}

/* 3. Skip link (accessibility — keyboard/screen-reader users skip nav) */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--sp-4);
  z-index: 9999;
  padding: 8px 16px;
  background: var(--c-atom);
  color: #020c18;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

/* 4. Scrollbar */
::-webkit-scrollbar            { width: 5px; }
::-webkit-scrollbar-track      { background: var(--bg-base); }
::-webkit-scrollbar-thumb      { background: rgba(56,189,248,0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: rgba(56,189,248,0.45); }

/* 4. Base */
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 5. Typography */
h1 { font-size: clamp(2.2rem, 5.5vw, 3.75rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.25rem); font-weight: 700; line-height: 1.18; letter-spacing: -0.02em; }
h3 { font-size: 1.2rem;  font-weight: 700; line-height: 1.3; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { color: var(--text-secondary); }

a {
  color: var(--c-atom);
  text-decoration: none;
  transition: color var(--t);
}
a:hover { color: #fff; }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgba(56,189,248,0.07);
  border: 1px solid rgba(56,189,248,0.14);
  border-radius: var(--r-sm);
  padding: 0.1em 0.45em;
  color: #67e8f9;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

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

.section-alt {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* =====================================================
   NAVIGATION
   ===================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--c-atom) 0%, var(--c-qc) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  box-shadow: 0 0 16px rgba(56,189,248,0.35);
}

.nav-logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.nav-logo-text .amo   { color: var(--c-atom); }
.nav-logo-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Links row */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: 1;
}

.nav-item { position: relative; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  background: none;
  border: none;
  transition: all var(--t);
  white-space: nowrap;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text-primary);
  background: rgba(56,189,248,0.08);
}

.nav-btn .chevron {
  width: 13px;
  height: 13px;
  transition: transform var(--t);
  opacity: 0.6;
}

.nav-item.open .nav-btn .chevron,
.nav-item:focus-within .nav-btn .chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.nav-drop {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
  min-width: 270px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--t), visibility var(--t), transform var(--t);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
}

.nav-item.open .nav-drop,
.nav-item:focus-within .nav-drop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-drop-section {
  padding: var(--sp-2) var(--sp-2) var(--sp-1);
  font-size: 0.675rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.nav-drop-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: all var(--t);
}

.nav-drop-item:hover {
  background: rgba(56,189,248,0.07);
  color: var(--text-primary);
}

.nav-drop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-drop-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-2) var(--sp-3);
}

/* Nav right */
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-cta {
  padding: 6px 16px;
  border-radius: var(--r-sm);
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.25);
  color: var(--c-atom);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all var(--t);
}

.nav-cta:hover {
  background: rgba(56,189,248,0.2);
  color: var(--c-atom);
}

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--sp-2);
  margin-left: auto;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--t);
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile overlay */
.nav-mobile-overlay {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0; bottom: 0;
  background: var(--bg-surface);
  z-index: 850;
  overflow-y: auto;
  padding: var(--sp-6);
  border-top: 1px solid var(--border);
}

.nav-mobile-overlay.open { display: block; }

.nav-mobile-section {
  margin-bottom: var(--sp-6);
}

.nav-mobile-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.nav-mobile-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-2);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: all var(--t);
}

.nav-mobile-link:hover {
  background: rgba(56,189,248,0.07);
  color: var(--text-primary);
}

/* =====================================================
   HERO
   ===================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-top: 64px;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.hero-grad {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%,  rgba(56,189,248,0.11)  0%, transparent 62%),
    radial-gradient(ellipse 55% 45% at 85% 55%,  rgba(167,139,250,0.07) 0%, transparent 55%),
    radial-gradient(ellipse 40% 35% at 10% 75%,  rgba(52,211,153,0.05)  0%, transparent 55%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: var(--sp-16) 0 var(--sp-20);
  max-width: 700px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 14px;
  background: rgba(56,189,248,0.09);
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--c-atom);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: var(--sp-6);
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--c-atom);
  border-radius: 50%;
  animation: blink 2.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1);   }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.hero-title { margin-bottom: var(--sp-5); }
.hero-title .word-amo {
  display: block;
  background: linear-gradient(110deg, var(--c-atom) 0%, var(--c-qc) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: var(--sp-8);
  max-width: 540px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-12);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 22px;
  border-radius: var(--r);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all var(--t);
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(130deg, var(--c-atom) 0%, #0ea5e9 100%);
  color: #020c18;
  box-shadow: 0 0 22px rgba(56,189,248,0.28);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 36px rgba(56,189,248,0.42);
  color: #020c18;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-med);
}

.btn-ghost:hover {
  background: rgba(56,189,248,0.07);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Hero stats */
.hero-stats {
  display: flex;
  gap: var(--sp-10);
  padding-top: var(--sp-8);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.hero-stat {}
.hero-stat-val {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.hero-stat-val span { color: var(--c-atom); }

.hero-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* =====================================================
   SECTION HEADERS
   ===================================================== */
.section-header {
  text-align: center;
  margin-bottom: var(--sp-12);
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  background: rgba(56,189,248,0.07);
  border: 1px solid rgba(56,189,248,0.18);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-atom);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: var(--sp-4);
}

.section-title {
  margin-bottom: var(--sp-4);
}

.section-desc {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.75;
}

/* =====================================================
   TOOL CARDS — Primary Pages (3×3 grid)
   ===================================================== */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
}

.tool-card {
  --card-color: var(--c-atom);
  --card-bg:    rgba(56,189,248,0.07);

  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  transition: all 0.28s ease;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  cursor: pointer;
}

/* Top accent line */
.tool-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-color);
  opacity: 0;
  transition: opacity var(--t);
}

.tool-card:hover {
  border-color: color-mix(in srgb, var(--card-color) 40%, transparent);
  background: var(--bg-card-hover);
  transform: translateY(-5px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.45),
              0 0 0 1px color-mix(in srgb, var(--card-color) 25%, transparent);
  text-decoration: none;
}

.tool-card:hover::after { opacity: 1; }

.tool-card-num {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tool-card-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--r);
  background: var(--card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  transition: transform var(--t);
  border: 1px solid color-mix(in srgb, var(--card-color) 20%, transparent);
}

.tool-card:hover .tool-card-icon { transform: scale(1.1) rotate(-3deg); }

.tool-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
}

.tool-card-desc {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}

.tool-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tool-card-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8125rem;
  color: var(--card-color);
  font-weight: 600;
  margin-top: var(--sp-1);
  transition: gap var(--t);
}

.tool-card:hover .tool-card-cta { gap: var(--sp-3); }

/* =====================================================
   LEARN SECTION — Secondary, smaller cards
   ===================================================== */
.learn-section {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.learn-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
}

.learn-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  transition: all var(--t);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.learn-card:hover {
  border-color: rgba(192,132,252,0.3);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

.learn-card-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.learn-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 3px;
}

.learn-card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* =====================================================
   LEARNING PATHS
   ===================================================== */
.paths-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
}

.path-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  transition: all var(--t);
}

.path-card:hover {
  border-color: var(--border-med);
  background: var(--bg-card-hover);
}

.path-icon {
  font-size: 2rem;
  margin-bottom: var(--sp-4);
}

.path-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.path-who {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: var(--sp-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.path-steps {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.path-step {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: 0.8375rem;
  color: var(--text-secondary);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
}

.path-step-n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--c-atom);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.path-step-arrow {
  color: var(--text-muted);
  margin-left: auto;
  font-size: 0.75rem;
}

/* =====================================================
   ABOUT SECTION
   ===================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-16);
  align-items: center;
}

.about-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  background: rgba(52,211,153,0.07);
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-lab);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: var(--sp-4);
}

.about-title { margin-bottom: var(--sp-4); }
.about-title .name { color: var(--c-atom); }

.about-text {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--sp-4);
  font-size: 0.9375rem;
}

.about-links {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.875rem;
  color: var(--c-atom);
  font-weight: 500;
}

.about-link:hover { color: #fff; }

/* Research highlights card */
.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border-med);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
}

.about-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
}

.highlight-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  margin-bottom: var(--sp-3);
  transition: all var(--t);
}

.highlight-item:last-child { margin-bottom: 0; }

.highlight-item:hover {
  border-color: var(--border-med);
  background: rgba(255,255,255,0.04);
}

.highlight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.highlight-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.highlight-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* =====================================================
   FOOTER
   ===================================================== */
.footer {
  padding: var(--sp-16) 0 var(--sp-8);
  border-top: 1px solid var(--border);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-12);
  margin-bottom: var(--sp-10);
}

.footer-brand-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
}

.footer-brand-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 270px;
}

.footer-col-head {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.footer-link {
  font-size: 0.86rem;
  color: var(--text-muted);
  transition: color var(--t);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.footer-link:hover { color: var(--text-primary); }

.footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer-bottom a {
  color: var(--text-muted);
}

.footer-bottom a:hover { color: var(--text-primary); }

/* =====================================================
   PAGE INTERIOR (for sub-pages)
   ===================================================== */
.page-wrap {
  padding-top: 64px;
  min-height: 100vh;
}

.page-hero {
  padding: var(--sp-12) 0 var(--sp-10);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
}

.page-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: var(--sp-4);
  background: var(--page-bg, rgba(56,189,248,0.08));
  border: 1px solid var(--page-border, rgba(56,189,248,0.2));
  color: var(--page-color, var(--c-atom));
}

.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: var(--sp-3);
}

.page-hero-desc {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.75;
}

.page-content {
  padding: var(--sp-12) 0 var(--sp-24);
}

/* Content blocks */
.concept-box {
  background: linear-gradient(135deg, rgba(56,189,248,0.05) 0%, rgba(167,139,250,0.04) 100%);
  border-left: 3px solid rgba(56,189,248,0.5);
  border-radius: 0 var(--r) var(--r) 0;
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.formula-box {
  background: rgba(6,14,28,0.9);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: var(--r);
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-4) 0;
  color: #a0d8ef;
  text-align: center;
  overflow-x: auto;
}
/* KaTeX rendered math inside formula boxes */
.formula-box .katex-display { margin: 0.4em 0; }
.formula-box .katex { font-size: 1.1em; }

.theory-box {
  background: rgba(167,139,250,0.04);
  border: 1px solid rgba(167,139,250,0.15);
  border-radius: var(--r);
  padding: var(--sp-5) var(--sp-6);
  margin: var(--sp-6) 0;
}

.result-box {
  background: rgba(52,211,153,0.05);
  border: 1px solid rgba(52,211,153,0.2);
  border-radius: var(--r);
  padding: var(--sp-4) var(--sp-6);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--c-lab);
}

.warn-box {
  background: rgba(251,191,36,0.05);
  border-left: 3px solid rgba(251,191,36,0.4);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: var(--sp-4) var(--sp-5);
  color: #fde68a;
  font-size: 0.9rem;
}

/* Accordion */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-4) var(--sp-6);
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  transition: background var(--t);
  user-select: none;
  text-align: left;
}

.accordion-header:hover { background: var(--bg-card-hover); }

.accordion-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.accordion-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--t);
  flex-shrink: 0;
}

.accordion.open .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  display: none;
  padding: var(--sp-5) var(--sp-6) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.accordion.open .accordion-body { display: block; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-8);
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--t);
  white-space: nowrap;
  cursor: pointer;
}

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

.tab-btn.active {
  color: var(--page-color, var(--c-atom));
  border-bottom-color: var(--page-color, var(--c-atom));
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Data table */
.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-med);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.825rem;
  vertical-align: middle;
}

.data-table td:first-child {
  font-family: var(--font-sans);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-boson  { background: rgba(56,189,248,0.1);  color: var(--c-atom); border: 1px solid rgba(56,189,248,0.2);  }
.badge-fermion{ background: rgba(248,113,113,0.1); color: var(--c-lock); border: 1px solid rgba(248,113,113,0.2); }
.badge-alkali { background: rgba(192,132,252,0.1); color: var(--c-learn); border: 1px solid rgba(192,132,252,0.2); }
.badge-ae     { background: rgba(52,211,153,0.1);  color: var(--c-lab); border: 1px solid rgba(52,211,153,0.2);  }
.badge-mag    { background: rgba(251,191,36,0.1);  color: var(--c-calc); border: 1px solid rgba(251,191,36,0.2);  }

/* Calc inputs */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-5);
}

.calc-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.calc-field input,
.calc-field select {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-mono);
  transition: border-color var(--t);
  outline: none;
}

.calc-field input:focus,
.calc-field select:focus {
  border-color: var(--page-color, var(--c-atom));
}

.calc-field input[type="range"] {
  padding: var(--sp-2) 0;
  background: transparent;
  border: none;
  accent-color: var(--page-color, var(--c-atom));
}

/* =====================================================
   SCROLL REVEAL & ANIMATIONS
   ===================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0);    }
}

.anim-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.anim-in.visible {
  opacity: 1;
  transform: none;
}

/* Staggered delays */
.anim-in.delay-1 { transition-delay: 0.08s; }
.anim-in.delay-2 { transition-delay: 0.16s; }
.anim-in.delay-3 { transition-delay: 0.24s; }
.anim-in.delay-4 { transition-delay: 0.32s; }
.anim-in.delay-5 { transition-delay: 0.40s; }
.anim-in.delay-6 { transition-delay: 0.48s; }
.anim-in.delay-7 { transition-delay: 0.56s; }
.anim-in.delay-8 { transition-delay: 0.64s; }
.anim-in.delay-9 { transition-delay: 0.72s; }

/* =====================================================
   UTILITIES
   ===================================================== */
.text-gradient {
  background: linear-gradient(110deg, var(--c-atom) 0%, var(--c-qc) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.mt-4  { margin-top: var(--sp-4);  }
.mt-8  { margin-top: var(--sp-8);  }
.mt-12 { margin-top: var(--sp-12); }
.mb-4  { margin-bottom: var(--sp-4);  }
.mb-6  { margin-bottom: var(--sp-6);  }
.mb-8  { margin-bottom: var(--sp-8);  }
.gap-row { display: flex; flex-direction: column; gap: var(--sp-4); }

/* =====================================================
   KNOWLEDGE UX: SEARCH, RECENTS, SOURCE CONFIDENCE
   ===================================================== */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-3);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,.72);
  color: var(--text-secondary);
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.nav-search-btn:hover { border-color: rgba(56,189,248,.45); color: var(--text-primary); background: rgba(15,23,42,.95); }
.nav-search-btn kbd {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  background: rgba(255,255,255,.04);
}
.nav-mobile-search {
  width: 100%;
  border: 1px solid var(--border);
  background: rgba(15,23,42,.8);
  color: var(--text-primary);
  cursor: pointer;
}
body.search-open { overflow: hidden; }
.global-search[hidden] { display: none; }
.global-search {
  position: fixed;
  inset: 0;
  z-index: 3000;
}
.global-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2,6,23,.76);
  backdrop-filter: blur(10px);
}
.global-search-panel {
  position: relative;
  width: min(760px, calc(100vw - 2rem));
  margin: 9vh auto 0;
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(8,13,24,.98));
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 24px;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  padding: var(--sp-5);
}
.global-search-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.global-search-kicker {
  color: var(--c-atom);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.global-search-head h2 { margin: .2rem 0 0; font-size: 1.35rem; }
.global-search-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
}
.global-search-input {
  width: 100%;
  border: 1px solid rgba(56,189,248,.35);
  border-radius: 16px;
  background: rgba(2,6,23,.82);
  color: var(--text-primary);
  padding: 1rem 1.1rem;
  font: 600 1rem var(--font-sans);
  outline: none;
}
.global-search-input:focus { box-shadow: 0 0 0 4px rgba(56,189,248,.12); }
.global-search-results {
  display: grid;
  gap: .65rem;
  margin-top: var(--sp-4);
  max-height: 55vh;
  overflow: auto;
  padding-right: .25rem;
}
.search-result {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: .8rem;
  align-items: center;
  padding: .75rem;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,.12);
  background: rgba(255,255,255,.035);
  color: var(--text-secondary);
  text-decoration: none;
}
.search-result:hover { border-color: rgba(56,189,248,.35); color: var(--text-primary); background: rgba(56,189,248,.06); }
.search-result-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: color-mix(in srgb, var(--sr) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--sr) 38%, transparent);
}
.search-result strong { display: block; color: var(--text-primary); }
.search-result small { color: var(--text-muted); }
.search-no-results, .recent-empty {
  border: 1px dashed rgba(148,163,184,.25);
  border-radius: 16px;
  padding: var(--sp-4);
  color: var(--text-muted);
  background: rgba(255,255,255,.025);
}
.recent-tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}
.recent-tool {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem .9rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.16);
  background: rgba(15,23,42,.72);
  color: var(--text-secondary);
  text-decoration: none;
}
.recent-tool:hover { color: var(--text-primary); border-color: rgba(56,189,248,.35); }
.recent-tool-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 16px currentColor; }
.intent-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-4);
}
.intent-card {
  min-height: 170px;
  padding: var(--sp-5);
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,.15);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--intent-color, #38bdf8) 20%, transparent), transparent 52%),
    rgba(15,23,42,.68);
  color: var(--text-secondary);
  text-decoration: none;
  transition: transform .18s, border-color .18s;
}
.intent-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--intent-color, #38bdf8) 45%, transparent); color: var(--text-primary); }
.intent-card h3 { margin: .65rem 0 .45rem; font-size: 1rem; color: var(--text-primary); }
.intent-card p { margin: 0; font-size: .86rem; line-height: 1.55; }
.intent-icon { font-size: 1.7rem; }
.source-confidence {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  margin-left: .35rem;
  vertical-align: middle;
}
.source-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.25);
  padding: .12rem .45rem;
  font: 700 .64rem var(--mono);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.source-tag.textbook { color: #93c5fd; background: rgba(59,130,246,.11); border-color: rgba(59,130,246,.25); }
.source-tag.peer-reviewed { color: #86efac; background: rgba(34,197,94,.11); border-color: rgba(34,197,94,.25); }
.source-tag.company-roadmap { color: #f0abfc; background: rgba(217,70,239,.11); border-color: rgba(217,70,239,.25); }
.source-tag.rough-estimate { color: #fcd34d; background: rgba(245,158,11,.11); border-color: rgba(245,158,11,.25); }

/* =====================================================
   EDUCATIONAL DEPTH AND EXPORT CONTROLS
   ===================================================== */
.derivation-mode {
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 18px;
  background: rgba(15,23,42,.66);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
}
.derivation-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: var(--sp-3);
}
.derivation-tabs button, .mini-action {
  border: 1px solid rgba(148,163,184,.22);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--text-secondary);
  padding: .45rem .75rem;
  font-weight: 800;
  font-size: .76rem;
  cursor: pointer;
}
.derivation-tabs button.active,
.derivation-tabs button:hover,
.mini-action:hover {
  color: var(--text-primary);
  border-color: rgba(56,189,248,.4);
  background: rgba(56,189,248,.1);
}
.derivation-panel {
  color: var(--text-secondary);
  font-size: .9rem;
  line-height: 1.7;
}
.common-mistake {
  border: 1px solid rgba(251,191,36,.28);
  border-left: 4px solid #fbbf24;
  background: linear-gradient(90deg, rgba(251,191,36,.10), rgba(15,23,42,.72));
  border-radius: 14px;
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  color: var(--text-secondary);
}
.common-mistake strong { color: #fde68a; }
.intuition-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin: var(--sp-4) 0;
}
.intuition-card {
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,.16);
  background: rgba(15,23,42,.66);
  padding: var(--sp-4);
}
.intuition-card h4 { margin: 0 0 .5rem; color: var(--text-primary); }
.intuition-card p { margin: .25rem 0; color: var(--text-secondary); font-size: .86rem; line-height: 1.55; }
.intuition-card .eq-mini { color: var(--c-atom); font-family: var(--mono); }
.share-url-card {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  margin-top: var(--sp-4);
  padding: .65rem .8rem;
  border: 1px solid rgba(56,189,248,.22);
  border-radius: 999px;
  background: rgba(56,189,248,.07);
  color: var(--text-secondary);
  font-size: .82rem;
}
.share-url-card.copied::after {
  content: "Copied";
  color: #86efac;
  font-weight: 800;
}
.export-float {
  float: right;
  margin: 0 0 .5rem .5rem;
}

/* ── Shared calculator learning/workflow modules ─────────────────── */
.workflow-panel {
  background:
    radial-gradient(circle at 8% 0%, rgba(56,189,248,.12), transparent 34%),
    linear-gradient(135deg, rgba(15,23,42,.96), rgba(15,23,42,.82));
  border: 1px solid rgba(148,163,184,.18);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin: 0 0 var(--sp-5);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.calculator-presets-panel,
.lab-notebook-panel,
.worked-examples-panel,
.assumption-panel,
.source-confidence-panel,
.expert-mode-panel { scroll-margin-top: 96px; }
.workflow-panel h2 {
  font-size: 1.08rem;
  margin: .1rem 0 .25rem;
}
.workflow-panel p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}
.workflow-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.workflow-panel-head.compact { align-items: center; }
.preset-status,
.notebook-count {
  color: #86efac;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}
.preset-grid,
.worked-grid,
.source-confidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}
.preset-card,
.worked-card,
.source-confidence-card {
  background: rgba(2,6,23,.42);
  border: 1px solid rgba(148,163,184,.16);
  border-radius: var(--r);
  padding: var(--sp-4);
}
.preset-card {
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  transition: transform var(--t), border-color var(--t), background var(--t);
}
.preset-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56,189,248,.38);
  background: rgba(56,189,248,.07);
}
.preset-card strong,
.worked-card h3 {
  display: block;
  margin: .35rem 0 .3rem;
  color: var(--text-primary);
  font-size: .95rem;
}
.preset-card small,
.worked-card p,
.source-confidence-card p {
  color: var(--text-muted);
  line-height: 1.55;
  font-size: .82rem;
}
.preset-tag,
.source-tag {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(56,189,248,.26);
  border-radius: 999px;
  background: rgba(56,189,248,.08);
  color: #7dd3fc;
  padding: .18rem .55rem;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.worked-card .mini-action { margin-top: var(--sp-3); }
.assumption-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.assumption-badge {
  border: 1px solid rgba(251,191,36,.24);
  background: rgba(251,191,36,.08);
  color: #fde68a;
  border-radius: 999px;
  padding: .45rem .7rem;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.assumption-badge.active,
.assumption-badge:hover {
  border-color: rgba(251,191,36,.56);
  background: rgba(251,191,36,.16);
  color: #fff7ed;
}
.assumption-explain {
  max-width: 620px;
  font-size: .84rem;
}
.source-confidence-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  cursor: pointer;
  list-style: none;
}
.source-confidence-panel summary::-webkit-details-marker { display: none; }
.source-confidence-panel[open] summary { margin-bottom: var(--sp-4); }
.source-summary-hint {
  color: var(--text-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.lab-notebook-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 80px;
  color: var(--text-primary);
  background: rgba(2,6,23,.55);
  border: 1px solid rgba(148,163,184,.2);
  border-radius: var(--r);
  padding: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.notebook-actions,
.mode-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.mini-action.muted {
  border-color: rgba(248,113,113,.22);
  color: #fecaca;
  background: rgba(248,113,113,.06);
}
.mode-toggle button {
  border: 1px solid rgba(129,140,248,.24);
  background: rgba(129,140,248,.08);
  color: #c4b5fd;
  border-radius: 999px;
  padding: .45rem .75rem;
  font-size: .78rem;
  font-weight: 900;
  cursor: pointer;
}
.mode-toggle button.active,
.mode-toggle button:hover {
  background: rgba(129,140,248,.2);
  border-color: rgba(129,140,248,.52);
  color: #fff;
}
.mode-copy {
  border-left: 3px solid rgba(129,140,248,.55);
  padding-left: var(--sp-3);
  font-size: .9rem;
}
body[data-depth-mode="beginner"] .expert-only { display: none !important; }
body[data-depth-mode="expert"] .beginner-only { display: none !important; }
body[data-depth-mode="beginner"] .formula-box,
body[data-depth-mode="beginner"] .derivation-mode {
  display: none !important;
}
body[data-depth-mode="beginner"] .common-mistake,
body[data-depth-mode="beginner"] .intuition-card,
body[data-depth-mode="beginner"] canvas {
  outline: 1px solid rgba(56,189,248,.18);
}
body[data-depth-mode="expert"] .assumption-panel,
body[data-depth-mode="expert"] .source-confidence-panel {
  border-color: rgba(251,191,36,.3);
}
.paper-tool-bridge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-top: .7rem;
  color: var(--text-muted);
  font-size: .78rem;
}
.paper-tool-bridge span {
  color: #a7f3d0;
  font-weight: 800;
}
.paper-tool-bridge a {
  border: 1px solid rgba(52,211,153,.22);
  background: rgba(52,211,153,.08);
  color: #86efac !important;
  border-radius: 999px;
  padding: .2rem .55rem;
  text-decoration: none;
}
.paper-tool-bridge a:hover {
  border-color: rgba(52,211,153,.5);
  background: rgba(52,211,153,.14);
}

@media (max-width: 1024px) {
  .intent-grid { grid-template-columns: repeat(2, 1fr); }
  .intuition-grid { grid-template-columns: 1fr; }
  .preset-grid,
  .worked-grid,
  .source-confidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =====================================================
   CHART.JS HEIGHT CAP
   Chart.js responsive:true ignores the canvas height attribute and
   scales to container width while maintaining aspect ratio — on wide
   screens this makes charts extremely tall. Cap them globally.
   Excludes custom animation canvases (#heroCanvas, #blockadeCanvas,
   #lockCanvas, #motCanvas, #mbCanvas, #rabiBlochCanvas etc.)
   ===================================================== */
canvas:not(#hero-canvas):not(#blockadeCanvas):not(#lockCanvas):not(#motCanvas):not(#mbCanvas):not(#rabiBlochCanvas):not(#rabiTraceCanvas):not(#gbCanvas):not(#trajCanvas):not(#waterfallCanvas):not(#qubitRaceCanvas):not(#fiberCouplingCanvas):not(#aomCanvas):not(#phononLadderCanvas):not(#fluorHistCanvas) {
  max-height: 280px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* ── Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  .tools-grid  { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
  .about-grid  { grid-template-columns: 1fr; }
  .paths-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  /* Nav */
  .nav-links, .nav-right { display: none; }
  .nav-hamburger { display: flex; }

  /* Home grids */
  .tools-grid  { grid-template-columns: 1fr; }
  .learn-grid  { grid-template-columns: repeat(2, 1fr); }
  .paths-grid  { grid-template-columns: 1fr; }

  /* Home hero */
  .hero-stats  { gap: var(--sp-6); }
  .hero-content { padding: var(--sp-10) 0 var(--sp-12); }
  .hero-subtitle { font-size: 1rem; }

  /* Footer */
  .footer-grid   { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; text-align: center; }

  /* Typography */
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }

  /* Section spacing — reduce tall vertical gaps */
  .section      { padding: var(--sp-16) 0; }
  .page-hero    { padding: var(--sp-8) 0 var(--sp-6); }
  .page-content { padding: var(--sp-8) 0 var(--sp-16); }

  /* Content boxes */
  .concept-box  { padding: var(--sp-4); }
  .formula-box  { padding: var(--sp-4); overflow-x: auto; }
  .theory-box   { padding: var(--sp-4); }
  .result-box   { padding: var(--sp-3) var(--sp-4); }
  .warn-box     { padding: var(--sp-3) var(--sp-4); }

  /* Accordion */
  .accordion-header { padding: var(--sp-3) var(--sp-4); }
  .accordion-body   { padding: var(--sp-4); }

  /* Calc inputs — force single column on mobile */
  .calc-grid { grid-template-columns: 1fr; }
  .workflow-panel-head,
  .workflow-panel-head.compact {
    flex-direction: column;
    align-items: stretch;
  }
  .preset-grid,
  .worked-grid,
  .source-confidence-grid { grid-template-columns: 1fr; }
  .preset-status,
  .notebook-count { white-space: normal; }

  /* Page hero description */
  .page-hero-desc { font-size: 0.9375rem; }
}

/* ── iOS input zoom fix: font-size must be ≥ 16px or Safari auto-zooms the page ── */
@media (max-width: 768px) {
  .calc-field input,
  .calc-field select,
  input, select, textarea {
    font-size: 1rem;
  }
}

/* ── Physics symbol tooltips ───────────────────────────────── */
.tip {
  position: relative;
  cursor: help;
  border-bottom: 1px dashed rgba(255,255,255,0.3);
  display: inline;
}
.tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 135%;
  left: 50%;
  transform: translateX(-50%);
  background: #0a1628;
  border: 1px solid rgba(56,189,248,0.35);
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 300;
}
.tip:hover::after { opacity: 1; }

/* ── Hood Lab personal callouts ─────────────────────────────── */
.hood-callout {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  background: rgba(52,211,153,0.05);
  border: 1px solid rgba(52,211,153,0.18);
  border-left: 3px solid var(--c-lab);
  border-radius: 0 var(--r) var(--r) 0;
  padding: var(--sp-3) var(--sp-5);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: var(--sp-4) 0;
}
.hood-callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.hood-callout strong { color: var(--c-lab); }

/* ── Paper reference block ───────────────────────────────────── */
.paper-refs {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  margin-top: var(--sp-8);
}
.paper-refs-head {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
}
.paper-refs-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.paper-ref {
  display: flex;
  gap: var(--sp-2);
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.5;
  transition: color var(--t);
}
.paper-ref:hover { color: var(--text-primary); }
.paper-ref a { color: inherit; }
.paper-ref a:hover { color: var(--c-atom); }

/* ── Small phones (≤ 480px) ── */
@media (max-width: 480px) {
  /* Home */
  .learn-grid  { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; align-items: flex-start; }
  .about-links  { flex-direction: column; gap: var(--sp-3); }

  /* Container side-padding */
  .container { padding: 0 var(--sp-4); }

  /* Slightly tighter hero stats */
  .hero-stat-val { font-size: 1.6rem; }

  /* Tab bar buttons — smaller tap targets are still large enough */
  .tab-btn { padding: var(--sp-2) var(--sp-3); font-size: 0.8125rem; }

  /* Buttons */
  .btn { padding: 9px 18px; font-size: 0.875rem; }

  /* KaTeX / formula boxes — reduce font so long equations don't overflow */
  .formula-box .katex { font-size: 0.95em; }
}

/* Workflow IA refinements */
a.path-step { text-decoration: none; }
a.path-step:hover {
  color: var(--text-primary);
  border-color: rgba(56,189,248,.28);
  background: rgba(56,189,248,.055);
}
.nav-drop-item small { line-height: 1.2; }

@media (max-width: 1180px) {
  .nav-links, .nav-right { display: none; }
  .nav-hamburger { display: flex; }
}
