/* ==========================================================================
   SYNTAXRADAR DESIGN SYSTEM: ACID VOLT & CYBER TERMINAL SYSTEM
   Dark Mode: "Cyber Terminal" (#070708, #111113, #D4FF00, #00E5FF)
   Light Mode: "Swiss Technical Paper" (#F8F7F4, #FFFFFF, #0A0A0B, #0066FF)
   ========================================================================== */

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

:root {
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Dark Theme Tokens (Default) */
  --bg-canvas: #070708;
  --bg-surface: #111113;
  --bg-surface-elevated: #161619;
  --bg-code: #0a0a0c;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent-primary: #D4FF00;
  --accent-primary-hover: #b8e600;
  --accent-secondary: #00E5FF;
  --text-primary: #F4F4F6;
  --text-secondary: #A1A1AA;
  --text-muted: #52525B;
  --card-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.6);
  --dot-color: rgba(255, 255, 255, 0.05);
  --spotlight-glow: rgba(212, 255, 0, 0.28);
}

html.light {
  /* Swiss Technical Paper Tokens */
  --bg-canvas: #F8F7F4;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F4F4F5;
  --bg-code: #F5F4F0;
  --border-subtle: #E4E4E7;
  --border-strong: #D4D4D8;
  --accent-primary: #0A0A0B;
  --accent-primary-hover: #27272A;
  --accent-secondary: #0066FF;
  --text-primary: #09090B;
  --text-secondary: #3F3F46;
  --text-muted: #71717A;
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  --dot-color: rgba(0, 0, 0, 0.05);
  --spotlight-glow: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-canvas);
  color: var(--text-secondary);
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  line-height: 1.75;
  letter-spacing: -0.01em;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.font-mono-code { font-family: var(--font-mono); }
.font-body-editorial { font-family: var(--font-body); }
.font-display-title { font-family: var(--font-display); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
html.dark ::-webkit-scrollbar-thumb { background: #27272a; border-radius: 3px; }
html.light ::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 3px; }

/* Radar Live Pulse */
@keyframes pulse-lime {
  0% { box-shadow: 0 0 0 0 rgba(212, 255, 0, 0.75); }
  70% { box-shadow: 0 0 0 8px rgba(212, 255, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 255, 0, 0); }
}
.radar-pulse-lime {
  animation: pulse-lime 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-cyan {
  0% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.75); }
  70% { box-shadow: 0 0 0 8px rgba(0, 229, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 229, 255, 0); }
}
.radar-pulse-cyan {
  animation: pulse-cyan 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spotlight Border Hover Card */
.spotlight-card {
  position: relative;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.spotlight-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(450px circle at var(--mouse-x, -100px) var(--mouse-y, -100px), var(--spotlight-glow), transparent 45%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

/* Concept Node Dotted Underline & Glassmorphic Popover */
.concept-node {
  position: relative;
  display: inline-block;
  color: var(--text-primary);
  border-bottom: 1.5px dotted var(--accent-primary);
  font-weight: 600;
  cursor: help;
  transition: color 0.15s ease, border-color 0.15s ease;
}

html.light .concept-node {
  border-bottom: 1.5px dotted #0A0A0B;
}

.concept-node:hover {
  color: var(--accent-primary);
}

html.light .concept-node:hover {
  color: #0066FF;
  border-bottom-color: #0066FF;
}

.concept-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 280px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(17, 17, 19, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #F4F4F6;
  font-size: 11px;
  line-height: 1.5;
  font-family: var(--font-mono);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 50;
}

html.light .concept-popover {
  background: rgba(255, 255, 255, 0.98);
  border-color: #E4E4E7;
  color: #09090B;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.12);
}

.concept-node:hover .concept-popover {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Syntax Token Colors (IDE Grade) */
.token-kw { color: #D4FF00; font-weight: 600; }
.token-fn { color: #00E5FF; }
.token-str { color: #a3e635; }
.token-num { color: #f59e0b; }
.token-comment { color: #52525b; font-style: italic; }
.token-type { color: #38bdf8; }
.token-param { color: #e4e4e7; text-decoration: underline dotted #52525b; cursor: help; }

html.light .token-kw { color: #0055cc; font-weight: 700; }
html.light .token-fn { color: #0f766e; font-weight: 600; }
html.light .token-str { color: #15803d; }
html.light .token-num { color: #b45309; }
html.light .token-comment { color: #71717a; }
html.light .token-param { color: #18181b; }

/* Parameter Hover Tooltip in Code */
.code-param-badge {
  position: relative;
  display: inline-block;
  cursor: help;
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(212, 255, 0, 0.1);
  border-bottom: 1px dotted #D4FF00;
}

.code-param-badge:hover .code-param-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.code-param-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 8px 10px;
  background: #000000;
  border: 1px solid #D4FF00;
  border-radius: 6px;
  color: #F4F4F6;
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.15s ease;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
}

/* Dynamic TOC Active Link State */
.toc-link.active {
  color: var(--text-primary) !important;
  background-color: rgba(212, 255, 0, 0.08) !important;
  border-left: 2px solid #D4FF00 !important;
  font-weight: 700 !important;
}

html.light .toc-link.active {
  background-color: #F4F4F5 !important;
  border-left: 2px solid #09090B !important;
}

/* Clean Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

a {
  transition: color 0.15s ease, border-color 0.15s ease;
}

/* Category Filter Transition */
.feed-item {
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.feed-item.hidden-filter {
  display: none !important;
}
