/* ═══════════════════════════════════════════════════════════════════
   B&A WEBSITE — SHARED.CSS
   Swiss Modernism 2.0 Design System
   3-Layer Token System: Primitives → Semantic → Components
   ═══════════════════════════════════════════════════════════════════ */

/* ── FONTS ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ═══════════════════════════════════════════════════════════════════
   LAYER 1: PRIMITIVE TOKENS
   ═══════════════════════════════════════════════════════════════════ */
:root {
  /* Brand Colors */
  --c-navy-900:   #0A0A40;
  --c-navy-800:   #12124f;
  --c-navy-700:   #1a1a5e;
  --c-gold-500:   #C1A050;
  --c-gold-400:   #d4b06a;
  --c-gold-300:   #e0c485;
  --c-sand-100:   #EEE9DE;
  --c-sand-200:   #E8E2D5;
  --c-sand-50:    #FFFFFF;
  --c-mute-500:   #6b6b8a;
  --c-mute-400:   #8a8aa8;
  --c-green:      #1a6645;
  --c-red:        #8B1A1A;
  --c-navy-rgb:   10, 10, 64;
  --c-light-rgb:  232, 227, 215;

  /* Dark Mode Primitives */
  --c-dm-bg:      #0F1117;
  --c-dm-bg2:     #161922;
  --c-dm-surface: #161a24;
  --c-dm-text:    #e8e3d7;
  --c-dm-muted:   #8a92a8;
  --c-dm-border:  rgba(232,227,215,0.08);

  /* Spacing (4px base, 8px rhythm) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  48px;
  --space-9:  64px;
  --space-10: 96px;

  /* Typography Scale */
  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;

  --fs-xs:   11px;
  --fs-sm:   13px;
  --fs-base: 16px;
  --fs-lg:   20px;
  --fs-xl:   28px;
  --fs-2xl:  40px;
  --fs-3xl:  56px;
  --fs-hero: clamp(2.5rem, 6vw, 5rem);

  /* Radius */
  --radius-none:  0px;
  --radius-sm:    4px;
  --radius-md:    8px;

  /* Duration */
  --dur-fast:    120ms;
  --dur-normal:  200ms;
  --dur-slow:    400ms;

  /* Z-Index */
  --z-base:    0;
  --z-sticky:  100;
  --z-overlay: 400;
  --z-toast:   999;

  /* Grid */
  --grid-cols: 12;
  --grid-gap:  var(--space-4);
  --grid-max:  1280px;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYER 2: SEMANTIC TOKENS
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --color-primary:    var(--c-navy-900);
  --color-primary2:   var(--c-navy-800);
  --color-accent:     var(--c-gold-500);
  --color-accent2:    var(--c-gold-400);
  --color-bg:         var(--c-sand-100);
  --color-bg2:        var(--c-sand-200);
  --color-surface:    var(--c-sand-50);
  --color-text:       var(--c-navy-900);
  --color-muted:      var(--c-mute-500);
  --color-border:     rgba(var(--c-navy-rgb), 0.08);
  --color-green:      var(--c-green);
  --color-red:        var(--c-red);

  --space-component:  var(--space-3);
  --space-section:    var(--space-8);
  --space-section-lg: var(--space-10);

  --radius-card:      var(--radius-md);
  --radius-btn:       var(--radius-sm);
}

/* ── DARK MODE ─────────────────────────────────────────────────────── */
.dark-mode {
  --color-primary:    var(--c-dm-text) !important;
  --color-primary2:   #efe9dd !important;
  --color-bg:         var(--c-dm-bg) !important;
  --color-bg2:        var(--c-dm-bg2) !important;
  --color-surface:    var(--c-dm-surface) !important;
  --color-text:       var(--c-dm-text) !important;
  --color-muted:      var(--c-dm-muted) !important;
  --color-border:     var(--c-dm-border) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYER 3: BASE STYLES
   ═══════════════════════════════════════════════════════════════════ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--fs-base); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur-normal) ease, color var(--dur-normal) ease;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
p { font-size: var(--fs-base); line-height: 1.7; max-width: 65ch; }
.mono { font-family: var(--font-mono); font-weight: 400; }
.label-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ── LAYOUT ── */
.container { max-width: var(--grid-max); margin: 0 auto; padding: 0 var(--space-6); }
.section { padding: var(--space-section-lg) 0; }
.section-tight { padding: var(--space-section) 0; }
.grid { display: grid; grid-template-columns: repeat(var(--grid-cols), 1fr); gap: var(--grid-gap); }

/* ── ACCESSIBILITY ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* ── HEADER / NAV ── */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--color-primary);
  border-bottom: 1px solid rgba(var(--c-navy-rgb), 0.3);
  transition: background var(--dur-normal) ease;
}
.dark-mode .site-header {
  background: var(--c-dm-bg) !important;
  border-bottom-color: rgba(193,160,80,0.25) !important;
}
.site-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  opacity: 0.4; pointer-events: none;
}
.header-inner {
  max-width: var(--grid-max); margin: 0 auto;
  height: 64px; padding: 0 var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
}
.header-logo {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  color: var(--c-sand-100); letter-spacing: -0.01em;
  display: flex; align-items: center; gap: var(--space-2);
}
.dark-mode .header-logo { color: var(--c-dm-text) !important; }
.header-logo span { color: var(--color-accent); }
.header-nav { display: flex; align-items: center; gap: var(--space-6); }
.header-nav a {
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
  color: rgba(238,233,222,0.7); letter-spacing: 0.04em;
  transition: color var(--dur-fast);
}
.dark-mode .header-nav a { color: rgba(232,227,215,0.6) !important; }
.header-nav a:hover { color: var(--color-accent); }
.header-nav a.active { color: var(--color-accent); }

/* ── THEME TOGGLE ── */
.theme-btn {
  background: none; border: 1px solid rgba(238,233,222,0.2);
  border-radius: var(--radius-sm); padding: 6px 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(238,233,222,0.7); transition: all var(--dur-fast);
}
.dark-mode .theme-btn {
  border-color: rgba(232,227,215,0.2) !important;
  color: rgba(232,227,215,0.6) !important;
}
.theme-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.theme-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── MOBILE NAV ── */
.mobile-toggle { display: none; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-btn);
  transition: all var(--dur-fast);
  cursor: pointer;
}
.btn-primary {
  background: var(--color-accent); color: var(--c-navy-900);
  border: 1px solid var(--color-accent);
}
.btn-primary:hover { background: var(--color-accent2); border-color: var(--color-accent2); }
.btn-outline {
  background: transparent; color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── CARDS ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  position: relative; overflow: hidden;
  transition: transform var(--dur-normal) ease, box-shadow var(--dur-normal) ease, border-color var(--dur-normal) ease;
}
.card::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0;
  width: 3px; background: linear-gradient(180deg, var(--color-accent), var(--color-accent2));
  opacity: 0; transition: opacity var(--dur-normal);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(var(--c-navy-rgb), 0.06);
  border-color: rgba(var(--c-navy-rgb), 0.12);
}
.card:hover::before { opacity: 1; }
.dark-mode .card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important; }
.card-title { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; margin-bottom: var(--space-2); }
.card-text { font-size: var(--fs-sm); color: var(--color-muted); line-height: 1.6; }
.card-link {
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--color-accent); margin-top: var(--space-4);
  display: inline-flex; align-items: center; gap: 4px;
  transition: gap var(--dur-fast);
}
.card-link:hover { gap: 8px; }
.card-link svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ── STATUS STRIP ── */
.status-strip {
  background: var(--color-primary);
  border-top: 1px solid rgba(var(--c-navy-rgb), 0.3);
  padding: var(--space-3) 0;
  overflow: hidden;
}
.dark-mode .status-strip { background: var(--c-dm-bg2) !important; border-top-color: rgba(193,160,80,0.15) !important; }
.status-strip-inner {
  max-width: var(--grid-max); margin: 0 auto; padding: 0 var(--space-6);
  display: flex; align-items: center; gap: var(--space-5);
  flex-wrap: wrap;
}
.status-item {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 500;
  color: rgba(238,233,222,0.7); letter-spacing: 0.04em;
}
.dark-mode .status-item { color: rgba(232,227,215,0.5) !important; }
.status-led {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(74,222,128,0.5);
  animation: led-pulse 2.5s infinite;
}
.status-led.amber { background: var(--color-accent); box-shadow: 0 0 0 0 rgba(193,160,80,0.5); animation: led-pulse-amber 2.5s infinite; }
.status-led.red { background: #f87171; animation: none; box-shadow: none; }
@keyframes led-pulse { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); } 70% { box-shadow: 0 0 0 5px rgba(74,222,128,0); } 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); } }
@keyframes led-pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(193,160,80,0.5); } 70% { box-shadow: 0 0 0 5px rgba(193,160,80,0); } 100% { box-shadow: 0 0 0 0 rgba(193,160,80,0); } }
.status-divider { width: 1px; height: 16px; background: rgba(238,233,222,0.15); }
.dark-mode .status-divider { background: rgba(232,227,215,0.1) !important; }

/* ── FOOTER ── */
.site-footer {
  background: var(--color-primary);
  border-top: 1px solid rgba(var(--c-navy-rgb), 0.3);
  padding: var(--space-8) 0;
}
.dark-mode .site-footer { background: var(--c-dm-bg) !important; border-top-color: rgba(193,160,80,0.15) !important; }
.footer-inner {
  max-width: var(--grid-max); margin: 0 auto; padding: 0 var(--space-6);
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: var(--space-6);
}
.footer-brand {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--c-sand-100); margin-bottom: var(--space-2);
}
.dark-mode .footer-brand { color: var(--c-dm-text) !important; }
.footer-brand span { color: var(--color-accent); }
.footer-tagline { font-family: var(--font-mono); font-size: var(--fs-xs); color: rgba(238,233,222,0.4); }
.dark-mode .footer-tagline { color: rgba(232,227,215,0.35) !important; }
.footer-links { display: flex; flex-direction: column; gap: var(--space-2); }
.footer-links a {
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
  color: rgba(238,233,222,0.6); letter-spacing: 0.04em;
  transition: color var(--dur-fast);
}
.dark-mode .footer-links a { color: rgba(232,227,215,0.5) !important; }
.footer-links a:hover { color: var(--color-accent); }
.footer-built {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: rgba(238,233,222,0.3); letter-spacing: 0.04em;
}
.dark-mode .footer-built { color: rgba(232,227,215,0.25) !important; }

/* ── SCROLL REVEAL ── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--dur-slow) ease, transform var(--dur-slow) ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── SECTION NUMBER (L.A.B.) ── */
.section-number {
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
  color: var(--color-accent); letter-spacing: 0.1em;
  display: block; margin-bottom: var(--space-2);
}

/* ── HERO ── */
.hero {
  padding: var(--space-10) 0 var(--space-9);
  position: relative; overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--space-8);
  align-items: center;
}
.hero-headline {
  font-size: var(--fs-hero); font-weight: 700; line-height: 1.05;
  letter-spacing: -0.03em;
}
.hero-headline .accent { color: var(--color-accent); }
.hero-sub {
  font-size: var(--fs-lg); color: var(--color-muted);
  line-height: 1.6; margin-top: var(--space-5);
  max-width: 50ch;
}
.hero-cta-row { display: flex; gap: var(--space-3); margin-top: var(--space-6); flex-wrap: wrap; }

/* ── HERO VISUAL (right side) ── */
.hero-visual {
  position: relative; aspect-ratio: 4/5;
  background: var(--color-primary);
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid rgba(var(--c-navy-rgb), 0.3);
}
.dark-mode .hero-visual { background: var(--c-dm-bg2) !important; border-color: rgba(193,160,80,0.1) !important; }
.hero-visual::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  opacity: 0.5;
}
.hero-visual-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: var(--space-6); gap: var(--space-3);
}
.hero-terminal {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: rgba(238,233,222,0.8); text-align: left;
  width: 100%; max-width: 320px; line-height: 1.8;
}
.hero-terminal .prompt { color: var(--color-accent); }
.hero-terminal .dim { color: rgba(238,233,222,0.4); }
.dark-mode .hero-terminal { color: rgba(232,227,215,0.7) !important; }
.dark-mode .hero-terminal .dim { color: rgba(232,227,215,0.3) !important; }

/* ── LAB SECTION ── */
.lab-block {
  display: grid; grid-template-columns: 1fr 2fr;
  gap: var(--space-6); padding: var(--space-7) 0;
  border-top: 1px solid var(--color-border);
}
.lab-block:last-child { border-bottom: 1px solid var(--color-border); }
.lab-block-label { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500; color: var(--color-accent); }
.lab-block-title { font-size: var(--fs-xl); font-weight: 600; margin-bottom: var(--space-2); }
.lab-block-text { font-size: var(--fs-base); color: var(--color-muted); line-height: 1.7; }

/* ── EXPLORATIONS ── */
.explore-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.explore-card { cursor: pointer; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--space-7); }
  .hero-visual { max-width: 400px; margin: 0 auto; aspect-ratio: 4/3; }
  .lab-block { grid-template-columns: 1fr; gap: var(--space-3); }
}

/* Mobile */
@media (max-width: 768px) {
  :root { --space-section-lg: var(--space-8); --space-section: var(--space-7); }
  .header-nav { display: none; }
  .mobile-toggle {
    display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid rgba(238,233,222,0.2);
    border-radius: var(--radius-sm); padding: 8px; color: rgba(238,233,222,0.7);
  }
  .dark-mode .mobile-toggle { border-color: rgba(232,227,215,0.2) !important; color: rgba(232,227,215,0.6) !important; }
  .mobile-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
  .header-nav.mobile-open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--color-primary);
    padding: var(--space-4) var(--space-6); gap: var(--space-4);
    border-bottom: 1px solid rgba(var(--c-navy-rgb), 0.3);
  }
  .dark-mode .header-nav.mobile-open { background: var(--c-dm-bg) !important; }
  .hero { padding: var(--space-8) 0; }
  .explore-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
  .status-strip-inner { gap: var(--space-3); }
}

/* Small mobile */
@media (max-width: 480px) {
  .container { padding: 0 var(--space-4); }
  .header-inner { padding: 0 var(--space-4); }
  h1 { font-size: var(--fs-2xl); }
  h2 { font-size: var(--fs-xl); }
  .hero-headline { font-size: clamp(2rem, 8vw, 3rem); }
}