/* ═══════════════════════════════════════════════════════════════════════════
   GOTHAM RL — Cinematic Documentation CSS
   "Gotham After Dark" — Christopher Nolan meets Bloomberg terminal
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   DESIGN TOKENS — Dark Theme (default)
   ═══════════════════════════════════════════ */
:root {
  /* Surfaces */
  --bg:           #080A12;
  --bg-elevated:  #0E1018;
  --bg-card:      #0F1219;
  --bg-code:      #141820;

  /* Ink */
  --ink:          #E8E4DC;
  --ink-soft:     #9B97A0;
  --ink-muted:    #55535E;

  /* Accent (warm amber) */
  --accent:       #D4915A;
  --accent-glow:  rgba(212, 145, 90, 0.15);
  --accent-dim:   rgba(212, 145, 90, 0.06);

  /* Semantic colors */
  --teal:         #4ECDC4;
  --rose:         #E07A5F;
  --blue:         #5B8DEF;
  --purple:       #A78BFA;

  /* Borders */
  --border:       #1A1D28;
  --border-accent: rgba(212, 145, 90, 0.3);

  /* Composite backgrounds */
  --nav-bg:       rgba(8, 10, 18, 0.85);
  --sidebar-bg:   rgba(8, 10, 18, 0.6);

  /* Shadows */
  --card-shadow:    0 2px 12px rgba(0, 0, 0, 0.2);
  --card-hover-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);

  /* Typography */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Menlo', 'Consolas', monospace;

  /* Spacing scale (4px base) */
  --s1:  4px;
  --s2:  8px;
  --s3:  12px;
  --s4:  16px;
  --s5:  20px;
  --s6:  24px;
  --s7:  32px;
  --s8:  40px;
  --s9:  48px;
  --s10: 64px;
  --s11: 80px;
  --s12: 120px;

  /* Layout widths */
  --content-width: 760px;
  --wide-width:    980px;
  --full-width:    1200px;
  --sidebar-width: 240px;
}

/* ═══════════════════════════════════════════
   DESIGN TOKENS — Light Theme
   ═══════════════════════════════════════════ */
[data-theme="light"] {
  --bg:           #FAF9F6;
  --bg-elevated:  #FFFFFF;
  --bg-card:      #FFFFFF;
  --bg-code:      #F0EDE6;

  --ink:          #1A1A2E;
  --ink-soft:     #3D3D52;
  --ink-muted:    #7A7A8E;

  --accent:       #A86830;
  --accent-glow:  rgba(168, 104, 48, 0.08);
  --accent-dim:   rgba(168, 104, 48, 0.04);

  --teal:         #2B9E95;
  --rose:         #C0604A;
  --blue:         #3D6FD4;
  --purple:       #7B5FD4;

  --border:       #E5E2DA;
  --border-accent: rgba(168, 104, 48, 0.25);

  --nav-bg:       rgba(250, 249, 246, 0.88);
  --sidebar-bg:   rgba(250, 249, 246, 0.6);

  --card-shadow:    0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --card-hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* ═══════════════════════════════════════════
   FOUC PREVENTION
   ═══════════════════════════════════════════ */
html:not([data-theme]) {
  visibility: hidden;
}

html[data-theme] {
  visibility: visible;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 72px;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  letter-spacing: -0.01em;
  position: relative;
  min-height: 100vh;
}

img, svg {
  display: block;
  max-width: 100%;
}

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

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

ul, ol {
  list-style: none;
}

button {
  font: inherit;
}

/* ═══════════════════════════════════════════
   SCROLL PROGRESS BAR
   ═══════════════════════════════════════════ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #E8A87C);
  z-index: 200;
  pointer-events: none;
  box-shadow: 0 0 10px var(--accent-glow);
}

[data-theme="light"] .scroll-progress {
  box-shadow: none;
}

/* ═══════════════════════════════════════════
   SUBTLE DOT TEXTURE OVERLAY
   ═══════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background-image: radial-gradient(
    circle at 1px 1px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 0
  );
  background-size: 32px 32px;
}

[data-theme="light"] body::before {
  background-image: radial-gradient(
    circle at 1px 1px,
    rgba(0, 0, 0, 0.015) 1px,
    transparent 0
  );
}

/* ═══════════════════════════════════════════
   THEME TOGGLE BUTTON
   ═══════════════════════════════════════════ */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink-soft);
  transition: border-color 0.3s ease, transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.1);
  color: var(--accent);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* ═══════════════════════════════════════════
   NAVIGATION (.nav)
   ═══════════════════════════════════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  height: 60px;
  transition: box-shadow 0.3s ease;
}

.nav.scrolled {
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .nav.scrolled {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.nav-inner {
  max-width: var(--full-width);
  margin: 0 auto;
  padding: 0 var(--s7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: var(--s1) 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-links a:hover::after {
  width: 100%;
  left: 0;
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

/* ═══════════════════════════════════════════
   HAMBURGER BUTTON (.hamburger)
   ═══════════════════════════════════════════ */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: all 0.3s ease;
  transform-origin: center;
}

@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ═══════════════════════════════════════════
   MOBILE MENU (.mobile-menu)
   ═══════════════════════════════════════════ */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(8, 10, 18, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

[data-theme="light"] .mobile-menu {
  background: rgba(250, 249, 246, 0.98);
}

.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

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

/* ═══════════════════════════════════════════
   SIDEBAR (.sidebar)
   ═══════════════════════════════════════════ */
.sidebar {
  position: fixed;
  left: 0;
  top: 60px;
  bottom: 0;
  width: var(--sidebar-width);
  padding: 32px 20px 32px 28px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

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

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s4);
}

.sidebar a {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-muted);
  padding: 6px 0 6px 14px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.sidebar a:hover {
  color: var(--ink-soft);
}

.sidebar a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

@media (max-width: 1200px) {
  .sidebar {
    display: none;
  }
}

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
.page-body {
  margin-left: var(--sidebar-width);
}

@media (max-width: 1200px) {
  .page-body {
    margin-left: 0;
  }
}

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 32px;
}

.container--wide {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 32px;
}

.container--full {
  max-width: var(--full-width);
  margin: 0 auto;
  padding: 0 32px;
}

section {
  padding: 80px 0;
}

/* Glowing section divider */
section + section {
  border-top: 1px solid var(--border);
  position: relative;
}

section + section::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow), 0 0 48px rgba(212, 145, 90, 0.06);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

section + section.in-view::before {
  width: 140px;
}

[data-theme="light"] section + section::before {
  box-shadow: none;
}

/* ═══════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
}

h1 {
  font-size: clamp(3rem, 6vw, 5rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  letter-spacing: -0.015em;
  margin-bottom: 32px;
}

h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
}

h4 {
  font-size: 1.05rem;
  margin-bottom: var(--s3);
}

p {
  margin-bottom: 20px;
  color: var(--ink-soft);
}

p:last-child {
  margin-bottom: 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
  display: inline-block;
  position: relative;
  padding-left: 24px;
}

.section-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--accent);
}

.section-desc {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 620px;
}

/* ═══════════════════════════════════════════
   HERO — Cinematic Full-Viewport
   ═══════════════════════════════════════════ */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 80px 0;
}

/* Animated coordinate grid background */
.hero-grid {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.hero-grid::before {
  content: '';
  position: absolute;
  inset: -80px;
  background-image:
    linear-gradient(rgba(212, 145, 90, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 145, 90, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  animation: grid-drift 25s linear infinite;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 50%, black 20%, transparent 80%);
}

@keyframes grid-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(64px, 64px); }
}

[data-theme="light"] .hero-grid::before {
  background-image:
    linear-gradient(rgba(168, 104, 48, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 104, 48, 0.04) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 50%, black 10%, transparent 70%);
}

/* Ambient glow: warm amber top-right */
.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -100px;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 145, 90, 0.1) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Ambient glow: cool blue bottom-left */
.hero::after {
  content: '';
  position: absolute;
  bottom: -200px;
  left: -100px;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 141, 239, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] .hero::before {
  background: radial-gradient(circle, rgba(168, 104, 48, 0.05) 0%, transparent 70%);
}

[data-theme="light"] .hero::after {
  background: radial-gradient(circle, rgba(61, 111, 212, 0.03) 0%, transparent 70%);
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin-bottom: var(--s6);
  line-height: 1.1;
}

.hero h1 em {
  font-style: italic;
  color: var(--accent);
  text-shadow:
    0 0 60px rgba(212, 145, 90, 0.3),
    0 0 120px rgba(212, 145, 90, 0.1);
}

[data-theme="light"] .hero h1 em {
  text-shadow: none;
}

.hero-subtitle {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 600px;
  margin-bottom: 56px;
}

/* Hero stats with thin dividers */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.hero-stat {
  text-align: left;
  padding: 0 40px;
  border-left: 1px solid var(--border);
}

.hero-stat:first-child {
  border-left: none;
  padding-left: 0;
}

.hero-stat-value {
  font-family: var(--font-display);
  font-size: 2.8rem;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 8px;
}

/* Scroll-down indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink-muted);
  animation: scroll-bounce 2.5s ease-in-out infinite;
  z-index: 1;
}

@keyframes scroll-bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
    opacity: 0.3;
  }
  50% {
    transform: translateX(-50%) translateY(10px);
    opacity: 0.7;
  }
}

/* ═══════════════════════════════════════════
   CARDS (.card-grid, .card)
   ═══════════════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: var(--card-shadow);
}

/* Golden accent line on hover */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.card:hover::before {
  opacity: 1;
}

/* Card icons */
.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s4);
  font-size: 1rem;
}

.card-icon--teal {
  background: rgba(78, 205, 196, 0.1);
  color: var(--teal);
}

.card-icon--accent {
  background: var(--accent-dim);
  color: var(--accent);
}

.card-icon--blue {
  background: rgba(91, 141, 239, 0.1);
  color: var(--blue);
}

.card-icon--rose {
  background: rgba(224, 122, 95, 0.1);
  color: var(--rose);
}

.card-icon--purple {
  background: rgba(167, 139, 250, 0.1);
  color: var(--purple);
}

.card h3 {
  font-size: 1rem;
  margin-bottom: var(--s2);
}

.card p {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   PIPELINE (.pipeline)
   ═══════════════════════════════════════════ */
.pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 40px 0;
  position: relative;
}

.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  position: relative;
  padding: var(--s5) 0;
}

.pipeline-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
  flex-shrink: 0;
}

.pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
  position: relative;
  z-index: 2;
  box-shadow:
    0 0 8px var(--accent-glow),
    0 0 24px rgba(212, 145, 90, 0.1);
  animation: pulse-dot 3s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow:
      0 0 8px var(--accent-glow),
      0 0 24px rgba(212, 145, 90, 0.1);
  }
  50% {
    box-shadow:
      0 0 14px var(--accent-glow),
      0 0 36px rgba(212, 145, 90, 0.15);
  }
}

[data-theme="light"] .pipeline-dot {
  box-shadow: 0 0 0 3px var(--accent-glow);
  animation: none;
}

.pipeline-line {
  width: 1px;
  flex-grow: 1;
  background: var(--border);
  min-height: 16px;
}

.pipeline-step:last-child .pipeline-line {
  display: none;
}

.pipeline-content {
  flex: 1;
  padding-bottom: var(--s3);
}

.pipeline-content h3 {
  font-size: 0.95rem;
  margin-bottom: var(--s1);
}

.pipeline-content p {
  font-size: 0.85rem;
  margin-bottom: var(--s2);
}

.pipeline-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-code);
  color: var(--ink-muted);
  border: 1px solid var(--border);
  margin-right: 4px;
}

/* ═══════════════════════════════════════════
   OBSERVATION GRID (.obs-grid)
   ═══════════════════════════════════════════ */
.obs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: var(--s7) 0;
}

@media (max-width: 640px) {
  .obs-grid {
    grid-template-columns: 1fr;
  }
}

.obs-group {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-left: 3px solid var(--border);
  transition: border-color 0.3s ease;
}

.obs-group:hover {
  border-color: var(--border-accent);
}

.obs-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s3);
}

.obs-group-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.obs-group-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-muted);
  background: var(--bg-code);
  padding: 1px 6px;
  border-radius: 4px;
}

.obs-group-features {
  list-style: none;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.9;
}

.obs-group-features code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink);
}

/* ═══════════════════════════════════════════
   ACTION GRID (.action-grid)
   ═══════════════════════════════════════════ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: var(--s7) 0;
}

@media (max-width: 640px) {
  .action-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.action-dim {
  text-align: center;
  padding: 20px var(--s4);
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.action-dim:hover {
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

.action-dim-name {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: var(--s3);
}

.action-dim-options {
  list-style: none;
  font-size: 0.8rem;
  line-height: 2;
}

.action-dim-options li {
  color: var(--ink-soft);
}

.action-dim-options strong {
  color: var(--accent);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ═══════════════════════════════════════════
   CODE BLOCKS
   ═══════════════════════════════════════════ */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 2px solid rgba(212, 145, 90, 0.2);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.7;
  margin: var(--s5) 0;
  position: relative;
}

[data-theme="light"] pre {
  border-left: 2px solid rgba(168, 104, 48, 0.15);
}

pre code {
  font-size: inherit;
  background: none;
  padding: 0;
  border-radius: 0;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s2);
  display: block;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--border-accent);
}

.copy-btn.copied {
  color: var(--teal);
  border-color: var(--teal);
}

/* ═══════════════════════════════════════════
   REWARD BREAKDOWN
   ═══════════════════════════════════════════ */
.reward-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin: var(--s7) 0;
}

@media (max-width: 640px) {
  .reward-breakdown {
    grid-template-columns: 1fr;
  }
}

.reward-item {
  padding: var(--s5);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.reward-item h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  margin-bottom: var(--s3);
  font-weight: 600;
}

.reward-formula {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  line-height: 1.9;
}

.reward-formula .positive {
  color: var(--teal);
}

.reward-formula .negative {
  color: var(--rose);
}

.reward-formula .neutral {
  color: var(--blue);
}

/* ═══════════════════════════════════════════
   METRICS ROW
   ═══════════════════════════════════════════ */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: var(--s7) 0;
}

.metric-card {
  text-align: center;
  padding: var(--s5);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-card-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: var(--s1);
}

.metric-card-label {
  font-size: 0.72rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.metric-card--pass {
  border-color: var(--teal);
  background: rgba(78, 205, 196, 0.04);
}

/* ═══════════════════════════════════════════
   COLLAPSIBLE DETAILS
   ═══════════════════════════════════════════ */
details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: var(--s5) 0;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

details[open] {
  border-color: var(--border-accent);
}

details summary {
  padding: var(--s4) var(--s5);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s3);
  transition: color 0.2s ease;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::marker {
  display: none;
  content: '';
}

details summary:hover {
  color: var(--accent);
}

details summary::before {
  content: '+';
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  width: 1em;
  flex-shrink: 0;
}

details[open] summary::before {
  content: '\2212';
}

.detail-body {
  padding: 0 var(--s5) var(--s5);
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.detail-body pre {
  margin: var(--s3) 0;
}

/* ═══════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s6) 0;
}

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

.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink-soft);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-elevated);
}

.data-table code {
  font-size: 0.75rem;
  color: var(--accent);
}

/* Subtle zebra striping */
.data-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.01);
}

[data-theme="light"] .data-table tbody tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.015);
}

/* ═══════════════════════════════════════════
   DIAGRAM CONTAINER
   ═══════════════════════════════════════════ */
.diagram-container {
  margin: 40px 0;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
}

.diagram-container svg {
  margin: 0 auto;
}

/* ═══════════════════════════════════════════
   FOOTER (.footer)
   ═══════════════════════════════════════════ */
.footer {
  padding: 56px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  position: relative;
}

.footer p {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: var(--s2);
}

.footer-logo span {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   SCROLL ANIMATIONS
   ═══════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.stagger > * {
  transition-delay: calc(var(--i, 0) * 80ms);
}

/* ═══════════════════════════════════════════
   ARCHITECTURE SVG STYLES
   ═══════════════════════════════════════════ */
.arch-svg text {
  font-family: 'Source Sans 3', -apple-system, sans-serif;
}

.arch-svg .pkg-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.arch-svg .pkg-desc {
  font-size: 9px;
  fill: var(--ink-muted);
}

.arch-svg .arrow {
  stroke: var(--border);
  stroke-width: 1.5;
  fill: none;
  marker-end: url(#arch-arrowhead);
}

.arch-svg .arch-node {
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.arch-svg .arch-node rect {
  transition: stroke 0.25s ease, filter 0.25s ease;
}

/* ═══════════════════════════════════════════
   CARD GRID VARIANTS
   ═══════════════════════════════════════════ */
.card-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.card-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.card-grid--stack {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.card--compact {
  text-align: center;
  padding: var(--s5);
}

.stack-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.stack-desc {
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* ═══════════════════════════════════════════
   FEATURE LIST
   ═══════════════════════════════════════════ */
.feature-list {
  list-style: none;
  font-size: 0.82rem;
  line-height: 2;
  margin-top: var(--s3);
}

.feature-list li {
  color: var(--ink-soft);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Tablet
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .card-grid--2,
  .card-grid--3 {
    grid-template-columns: 1fr;
  }

  .card-grid--stack {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .reward-breakdown {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════════ */
@media (max-width: 640px) {
  section {
    padding: 56px 0;
  }

  .container,
  .container--wide,
  .container--full {
    padding: 0 20px;
  }

  .hero {
    padding: 60px 0;
    min-height: 100svh;
  }

  .hero-subtitle {
    margin-bottom: 40px;
  }

  .hero-stats {
    flex-direction: column;
    gap: 24px;
  }

  .hero-stat {
    padding: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }

  .hero-stat:first-child {
    border-top: none;
    padding-top: 0;
  }

  .hero-stat-value {
    font-size: 2rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .scroll-indicator {
    bottom: 24px;
  }
}

/* ═══════════════════════════════════════════
   THEME TRANSITION
   ═══════════════════════════════════════════ */
body.theme-transitioning,
body.theme-transitioning * {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease !important;
}

/* ═══════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  html {
    scroll-behavior: auto;
  }

  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }

  .pipeline-dot {
    animation: none;
  }

  .hero-grid::before {
    animation: none;
  }

  .scroll-indicator {
    animation: none;
    opacity: 0.5;
  }
}

/* ═══════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════ */
.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;
}

body.menu-open {
  overflow: hidden;
}
