/* KiranVision — Premium Visual Design */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Syne:wght@700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-deep: #030014;
  --bg-card: rgba(15, 12, 35, 0.72);
  --bg-elevated: rgba(30, 25, 60, 0.65);
  --glass: rgba(255, 255, 255, 0.04);
  --text: #f4f0ff;
  --text-muted: #a8a3c4;
  --accent: #8b5cf6;
  --accent-light: #c4b5fd;
  --accent-2: #06b6d4;
  --accent-3: #ec4899;
  --accent-glow: rgba(139, 92, 246, 0.45);
  --cyan: #22d3ee;
  --green: #34d399;
  --orange: #fb923c;
  --pink: #f472b6;
  --gradient-hero: linear-gradient(120deg, #c084fc 0%, #22d3ee 35%, #34d399 65%, #f472b6 100%);
  --gradient-hero-animated: linear-gradient(
    120deg,
    #c084fc,
    #818cf8,
    #22d3ee,
    #34d399,
    #f472b6,
    #c084fc
  );
  --gradient-card: linear-gradient(145deg, rgba(139, 92, 246, 0.15), rgba(34, 211, 238, 0.08));
  --gradient-border: linear-gradient(135deg, rgba(192, 132, 252, 0.6), rgba(34, 211, 238, 0.4), rgba(244, 114, 182, 0.5));
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.35);
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --shadow-glow: 0 0 60px rgba(139, 92, 246, 0.25), 0 0 120px rgba(34, 211, 238, 0.12);
  --font: 'Outfit', system-ui, sans-serif;
  --font-display: 'Syne', 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --max-width: 1240px;
  --nav-height: 76px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Ambient background (injected by visual.js or in HTML) */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float-orb 18s ease-in-out infinite;
}
.orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -12%;
  left: -8%;
}
.orb-2 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #0891b2 0%, transparent 70%);
  top: 35%;
  right: -12%;
  animation-delay: -6s;
}
.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #db2777 0%, transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-delay: -12s;
}
.grid-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(139, 92, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 92, 246, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 20%, transparent 75%);
}
@keyframes float-orb {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -25px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.25s, text-shadow 0.25s;
}
a:hover {
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}

img { max-width: 100%; height: auto; display: block; }

.container { width: min(100% - 2.5rem, var(--max-width)); margin-inline: auto; }

/* ═══ HEADER & NAV ═══ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--nav-height);
  background: rgba(3, 0, 20, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-border);
  opacity: 0.7;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: 1rem;
  padding: 0.5rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.03em;
}
.logo:hover { text-shadow: none; }
.logo img {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.6));
}
.logo span {
  background: var(--gradient-hero-animated);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}

.nav-toggle {
  display: none;
  background: var(--glass);
  border: 1px solid var(--border-glow);
  color: var(--text);
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: box-shadow 0.3s, transform 0.2s;
}
.nav-toggle:hover {
  box-shadow: 0 0 24px var(--accent-glow);
  transform: scale(1.05);
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 0.15rem;
  flex-wrap: wrap;
  align-items: center;
}

.main-nav a,
.nav-dropdown-btn {
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}
.main-nav a:hover,
.nav-dropdown-btn:hover {
  color: var(--text);
  background: rgba(139, 92, 246, 0.15);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.25);
}
.main-nav a.active,
.nav-dropdown.active > .nav-dropdown-btn {
  color: #fff;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.35), rgba(34, 211, 238, 0.2));
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.nav-dropdown { position: relative; }
.nav-dropdown::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 12px;
  /* Hover bridge to prevent dropdown closing while moving cursor */
}
.nav-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-dropdown-btn::after {
  content: '▾';
  font-size: 0.6em;
  opacity: 0.8;
  transition: transform 0.2s;
}
.nav-dropdown.open .nav-dropdown-btn::after { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: rgba(12, 8, 32, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 0.6rem;
  box-shadow: var(--shadow), var(--shadow-glow);
  z-index: 1100;
  animation: menu-in 0.25s ease;
  transform: translateY(10px);
}
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.nav-dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  color: var(--text-muted);
}
.dropdown-menu a:hover,
.dropdown-menu a.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.2), transparent);
  color: var(--text);
  box-shadow: none;
  text-shadow: none;
}

.search-wrap { position: relative; flex-shrink: 0; }
.search-wrap input {
  width: 220px;
  padding: 0.6rem 1.1rem 0.6rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s, width 0.3s;
}
.search-wrap input::placeholder { color: var(--text-muted); opacity: 0.7; }
.search-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 0 30px rgba(139, 92, 246, 0.2);
  width: 260px;
}
.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--accent-light);
  opacity: 0.8;
}

#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-height: 400px;
  overflow-y: auto;
  background: rgba(12, 8, 32, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  z-index: 2000;
}
#search-results.visible { display: block; }
#search-results a {
  display: block;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
#search-results a:hover {
  background: rgba(139, 92, 246, 0.12);
  text-shadow: none;
}
#search-results .result-type {
  font-size: 0.65rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* ═══ HERO ═══ */
.hero {
  padding: 5rem 0 6rem;
  text-align: center;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(900px, 100%);
  height: 400px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.25rem;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.35);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 1.75rem;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
  animation: pulse-badge 3s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 20px rgba(139, 92, 246, 0.2); }
  50% { box-shadow: 0 0 40px rgba(34, 211, 238, 0.25); }
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6.5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  letter-spacing: -0.04em;
}
.hero h1 .gradient {
  background: var(--gradient-hero-animated);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s linear infinite;
}

.hero p {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 2.25rem;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.hero-visual {
  margin-top: 3.5rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  border: 1px solid transparent;
  background: linear-gradient(var(--bg-deep), var(--bg-deep)) padding-box,
    var(--gradient-border) border-box;
  box-shadow: var(--shadow-glow);
}
.hero-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(3, 0, 20, 0.8));
  pointer-events: none;
}
.hero-visual img { width: 100%; opacity: 0.95; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.5s;
}
.btn:hover::before { transform: translateX(100%); }
.btn:hover { transform: translateY(-3px); }

.btn-primary {
  background: var(--gradient-hero);
  background-size: 200% auto;
  color: #0a0618;
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.45), 0 0 0 1px rgba(255,255,255,0.1) inset;
  animation: shimmer 8s linear infinite;
}
.btn-primary:hover {
  box-shadow: 0 12px 48px rgba(139, 92, 246, 0.55), 0 0 40px rgba(34, 211, 238, 0.3);
}

.btn-secondary {
  background: var(--glass);
  color: var(--text);
  border: 1px solid var(--border-glow);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  border-color: var(--accent-light);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.25);
}

.btn-outline {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid rgba(192, 132, 252, 0.5);
}
.btn-outline:hover {
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.3);
}

/* ═══ SECTIONS ═══ */
section { padding: 5rem 0; }
section:nth-child(even) {
  background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.03), transparent);
}

.section-title {
  text-align: center;
  margin-bottom: 3.5rem;
}
.section-title h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg, #fff 30%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-title p {
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  font-size: 1.05rem;
}
.section-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  margin: 1.25rem auto 0;
  border-radius: 4px;
  background: var(--gradient-hero);
}

/* ═══ CARDS ═══ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s, border-color 0.35s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity 0.35s;
}
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-hero);
  opacity: 0;
  transition: opacity 0.35s;
}
.card:hover {
  transform: translateY(-8px) scale(1.01);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}
.card:hover::before { opacity: 1; }
.card:hover::after { opacity: 1; }
.card > * { position: relative; z-index: 1; }

.card-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 1.25rem;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.15);
  padding: 10px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2);
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.65rem;
  letter-spacing: -0.02em;
}
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.25rem; }

.card .tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.25);
  margin-right: 0.4rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-light);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.card-link::after {
  content: '→';
  transition: transform 0.25s;
}
.card:hover .card-link::after { transform: translateX(4px); }

/* Tool cards accent */
.card-grid .card:nth-child(1) { --card-accent: #8b5cf6; }
.card-grid .card:nth-child(2) { --card-accent: #06b6d4; }
.card-grid .card:nth-child(3) { --card-accent: #ec4899; }

/* ═══ FEATURES STRIP ═══ */
.features-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 0;
  background: transparent;
  border: none;
}
.feature-item {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.3s, box-shadow 0.3s;
}
.feature-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 40px rgba(139, 92, 246, 0.2);
  border-color: var(--border-glow);
}
.feature-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.feature-item span { font-size: 0.88rem; color: var(--text-muted); }

/* ═══ COURSE PAGES ═══ */
.page-hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  position: relative;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: radial-gradient(ellipse at 30% 0%, rgba(139, 92, 246, 0.15), transparent 55%);
  pointer-events: none;
}
.page-hero > * { position: relative; }

.page-hero .breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
}
.page-hero .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.level-badge {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.level-beginner {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}
.level-intermediate {
  background: rgba(251, 146, 60, 0.15);
  color: var(--orange);
  border: 1px solid rgba(251, 146, 60, 0.35);
}
.level-advanced {
  background: rgba(244, 114, 182, 0.15);
  color: var(--pink);
  border: 1px solid rgba(244, 114, 182, 0.35);
  box-shadow: 0 0 20px rgba(244, 114, 182, 0.15);
}

.content-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
  padding-bottom: 4rem;
}
@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1.25rem);
  align-self: start;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-height: calc(100vh - var(--nav-height) - 2rem);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.toc-sidebar h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-light);
  margin-bottom: 1rem;
  font-weight: 700;
}
.toc-sidebar ul { list-style: none; }
.toc-sidebar a {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  padding-left: 0.85rem;
  margin-left: -0.85rem;
  border-radius: 0 8px 8px 0;
  transition: all 0.2s;
}
.toc-sidebar a:hover,
.toc-sidebar a.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  text-shadow: none;
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 2.75rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  letter-spacing: -0.02em;
}
.article-content h2:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.article-content h3 {
  font-size: 1.15rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--accent-light);
}
.article-content p { margin-bottom: 1rem; color: var(--text-muted); }
.article-content ul, .article-content ol {
  margin: 0 0 1rem 1.5rem;
  color: var(--text-muted);
}
.article-content li { margin-bottom: 0.5rem; }
.article-content strong { color: var(--text); }

.callout {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid var(--border-glow);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.35rem 1.6rem;
  margin: 1.5rem 0;
  backdrop-filter: blur(8px);
}
.callout.tip { border-left-color: var(--green); background: rgba(52, 211, 153, 0.06); }
.callout.warn { border-left-color: var(--orange); background: rgba(251, 146, 60, 0.06); }
.callout h4 { margin-bottom: 0.5rem; font-size: 0.95rem; color: var(--text); }
.callout p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

pre, code { font-family: var(--font-mono); font-size: 0.875rem; }
pre {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 1.35rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  line-height: 1.55;
  box-shadow: inset 0 0 40px rgba(139, 92, 246, 0.05);
}
code {
  background: rgba(139, 92, 246, 0.15);
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.2);
}
pre code { background: none; padding: 0; border: none; color: #e2e8f0; }

.math-block {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 1.25rem 0 1.5rem;
  overflow-x: auto;
  text-align: center;
  box-shadow: inset 0 0 60px rgba(139, 92, 246, 0.06);
}

.figure { margin: 2rem 0; text-align: center; }
.figure img,
.figure svg.regression-chart {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
  margin: 0 auto;
  max-width: 100%;
  box-shadow: var(--shadow-glow);
}
.figure-chart {
  background: var(--bg-card);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
}
.figure figcaption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
}

/* ═══ TOOLS ═══ */
.tool-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-glow);
}
.tool-canvas-wrap {
  position: relative;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glow);
  min-height: 320px;
  width: 100%;
  box-shadow: inset 0 0 80px rgba(139, 92, 246, 0.08);
}
.tool-canvas-wrap canvas {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;
}
.tool-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 1.25rem; }
.tool-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.stat-box {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border-glow);
  padding: 1.15rem;
  border-radius: var(--radius);
  text-align: center;
  transition: transform 0.2s;
}
.stat-box:hover { transform: scale(1.03); }
.stat-box .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-box .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--font-mono);
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.4);
}

/* ═══ QUIZ ═══ */
.quiz-container { max-width: 720px; }
.quiz-question {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s;
}
.quiz-question:hover { border-color: var(--border-glow); }
.quiz-question h3 { margin-bottom: 1rem; font-size: 1.1rem; font-family: var(--font-display); }
.quiz-options label {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  margin-bottom: 0.55rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
}
.quiz-options label:hover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  transform: translateX(4px);
}
.quiz-options input { margin-top: 0.3rem; accent-color: var(--accent); }
.quiz-options label.correct {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.15);
}
.quiz-options label.incorrect {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.1);
}
.quiz-score {
  text-align: center;
  padding: 2.5rem;
  background: var(--gradient-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-glow);
  margin-top: 2rem;
  box-shadow: var(--shadow-glow);
}
.quiz-score .score-num {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nn-canvas-container {
  min-height: 400px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
  box-shadow: inset 0 0 60px rgba(139, 92, 246, 0.08);
}
.nn-controls { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0; align-items: flex-end; }
.nn-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nn-controls input, .nn-controls select {
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-glow);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
}

/* ═══ LEGAL / CONTACT ═══ */
.legal-content, .simple-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}
.legal-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 2rem 0 0.75rem;
}
.legal-content p, .legal-content li { color: var(--text-muted); margin-bottom: 0.75rem; }
.legal-content ul { margin-left: 1.5rem; }

.contact-form {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glow) !important;
  border-radius: var(--radius-xl) !important;
  padding: 2rem !important;
  box-shadow: var(--shadow-glow);
}
.contact-form label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.contact-form input, .contact-form textarea, .contact-form select {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.contact-form textarea { min-height: 140px; resize: vertical; }

/* ═══ FOOTER ═══ */
.site-footer {
  background: linear-gradient(180deg, transparent, rgba(10, 5, 30, 0.95));
  border-top: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--accent), var(--cyan), var(--pink), transparent) 1;
  padding: 4rem 0 2.5rem;
  margin-top: 5rem;
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: var(--gradient-border);
  opacity: 0.8;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}
.footer-grid h4 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin-bottom: 1.15rem;
}
.footer-grid ul { list-style: none; }
.footer-grid a {
  display: block;
  padding: 0.35rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.2s, padding-left 0.2s;
}
.footer-grid a:hover {
  color: var(--text);
  padding-left: 6px;
  text-shadow: none;
}

.footer-bottom {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ad-slot {
  background: rgba(139, 92, 246, 0.06);
  border: 1px dashed var(--border-glow);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 2rem 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .nav-toggle { display: block; margin-left: auto; }
  .header-inner { flex-wrap: wrap; position: relative; align-items: center; }
  .search-wrap { order: 3; width: 100%; margin-top: 0.35rem; }
  .search-wrap input, .search-wrap input:focus { width: 100%; }
  .main-nav {
    display: none;
    order: 4;
    width: 100%;
    position: static;
    background: rgba(12, 8, 32, 0.98);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-top: 0.5rem;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    box-shadow: var(--shadow-glow);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; }
  .main-nav > ul > li > a,
  .nav-dropdown-btn { width: 100%; text-align: left; justify-content: space-between; }
  .nav-dropdown .dropdown-menu {
    position: static;
    display: none;
    border: none;
    box-shadow: none;
    padding: 0 0 0.5rem 0.85rem;
    margin-top: 0.25rem;
    min-width: 0;
    background: transparent;
  }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .hero { padding: 3rem 0 4rem; }
  .toc-sidebar { position: static; max-height: none; }
}

.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  top: 0;
  left: 0;
  transition: transform 0.15s ease-out;
  mix-blend-mode: screen;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .cursor-glow { display: none !important; }
}
