:root {
  --bg-base: #06080e;
  --bg-surface: #0c101b;
  --bg-elevated: rgba(17, 23, 38, 0.75);
  --bg-glass: rgba(12, 16, 27, 0.82);
  --bg-terminal: #05070c;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --border-subtle: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(56, 189, 248, 0.4);
  --grid-color: rgba(148, 163, 184, 0.04);
  --font-display: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(248, 250, 252, 0.88);
  --bg-terminal: #0b0f19;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-cyan: #0284c7;
  --accent-indigo: #4f46e5;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
  --border-subtle: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(2, 132, 199, 0.4);
  --grid-color: rgba(15, 23, 42, 0.04);
  --shadow-card: 0 16px 32px -12px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  background-image: 
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: 36px 36px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 4.5rem 0; }

.navbar { position: sticky; top: 1rem; z-index: 100; max-width: 1160px; margin: 1rem auto 0; padding: 0 1rem; }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.25rem; background: var(--bg-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle); border-radius: 999px; box-shadow: var(--shadow-card);
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text-primary); font-family: var(--font-mono); font-weight: 700; }
.brand-badge { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo)); color: #06080e; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 800; }
.nav-links { display: flex; gap: 1.5rem; list-style: none; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.88rem; }
.nav-links a:hover { color: var(--accent-cyan); }
.nav-controls { display: flex; gap: 0.5rem; align-items: center; }
.icon-btn { background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-primary); padding: 0.4rem 0.8rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.76rem; cursor: pointer; text-decoration: none; }

.hero { padding: 4rem 0 3.5rem; display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 2.8rem; align-items: center; }
.status-badge { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.32rem 0.85rem; border-radius: 999px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--accent-emerald); font-family: var(--font-mono); font-size: 0.76rem; margin-bottom: 1.2rem; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-emerald); }
.hero-title { font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3.4rem); font-weight: 800; line-height: 1.12; margin-bottom: 1rem; }
.text-gradient { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo), var(--accent-emerald)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero-bio { color: var(--text-secondary); font-size: 1.04rem; max-width: 560px; margin-bottom: 1.8rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2.2rem; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.4rem; border-radius: var(--radius-md); font-weight: 600; font-size: 0.9rem; text-decoration: none; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo)); color: #06080e; font-weight: 700; border: none; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-subtle); }
.metrics-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border-subtle); }
.metric-val { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--accent-cyan); }
.metric-lbl { font-size: 0.76rem; color: var(--text-muted); }

.workbench { background: var(--bg-terminal); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column; height: 450px; }
.wb-header { background: #0d121f; padding: 0.6rem 0.95rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.wb-dots { display: flex; gap: 0.4rem; }
.wb-dot { width: 10px; height: 10px; border-radius: 50%; }
.wb-dot.r { background: #ff5f56; } .wb-dot.y { background: #ffbd2e; } .wb-dot.g { background: #27c93f; }
.wb-tabs { display: flex; gap: 0.3rem; }
.wb-tab { background: transparent; border: none; color: #94a3b8; font-family: var(--font-mono); font-size: 0.72rem; padding: 0.28rem 0.65rem; border-radius: 5px; cursor: pointer; }
.wb-tab.active { background: rgba(56, 189, 248, 0.16); color: #38bdf8; font-weight: 600; }
.wb-panel { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.wb-panel.active { display: flex; }

.term-output { flex: 1; padding: 0.9rem 1.1rem; overflow-y: auto; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.6; color: #cbd5e1; }
.term-line { margin-bottom: 0.35rem; }
.t-cyan { color: #38bdf8; } .t-green { color: #34d399; } .t-indigo { color: #818cf8; } .t-amber { color: #fbbf24; } .t-muted { color: #64748b; }
.term-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.45rem 0.9rem; background: rgba(255, 255, 255, 0.02); border-top: 1px solid rgba(255, 255, 255, 0.06); }
.term-chip { background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.25); color: #7dd3fc; font-family: var(--font-mono); font-size: 0.7rem; padding: 0.2rem 0.5rem; border-radius: 5px; cursor: pointer; }
.term-input-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem; background: #080b12; border-top: 1px solid rgba(255, 255, 255, 0.08); font-family: var(--font-mono); font-size: 0.78rem; }
.term-prompt { color: #34d399; white-space: nowrap; font-weight: 600; }
.term-input { background: transparent; border: none; color: #f8fafc; font-family: var(--font-mono); font-size: 0.78rem; width: 100%; outline: none; }

.compiler-box { padding: 0.9rem; display: flex; flex-direction: column; gap: 0.7rem; height: 100%; font-family: var(--font-mono); font-size: 0.74rem; overflow-y: auto; }
.snippet-bar { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.snippet-btn { background: rgba(129, 140, 248, 0.12); border: 1px solid rgba(129, 140, 248, 0.3); color: #c7d2fe; font-family: var(--font-mono); font-size: 0.7rem; padding: 0.25rem 0.6rem; border-radius: 5px; cursor: pointer; }
.snippet-btn.active { background: #818cf8; color: #05070c; font-weight: 700; }
.code-stage { background: #090d16; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px; padding: 0.6rem 0.75rem; }
.stage-label { font-size: 0.65rem; color: #64748b; margin-bottom: 0.3rem; display: flex; justify-content: space-between; }

.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 2.2rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; color: var(--accent-cyan); display: block; margin-bottom: 0.35rem; }
.section-title { font-family: var(--font-display); font-size: clamp(1.6rem, 2.8vw, 2.2rem); font-weight: 800; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.filter-pill { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 0.38rem 0.85rem; border-radius: 999px; font-size: 0.78rem; cursor: pointer; }
.filter-pill.active { background: var(--accent-cyan); color: #06080e; font-weight: 700; }

.bento-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1.25rem; }
.bento-card { grid-column: span 4; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.bento-card.featured { grid-column: span 6; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.9rem; }
.card-badge { font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; padding: 0.2rem 0.55rem; border-radius: 5px; background: rgba(56, 189, 248, 0.12); color: var(--accent-cyan); }
.card-status { font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent-emerald); }
.card-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; margin-bottom: 0.5rem; }
.card-desc { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 1rem; }
.card-points { list-style: none; margin-bottom: 1.2rem; }
.card-points li { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.35rem; padding-left: 1.1rem; position: relative; }
.card-points li::before { content: "▹"; position: absolute; left: 0; color: var(--accent-cyan); font-weight: bold; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; padding-top: 0.9rem; border-top: 1px solid var(--border-subtle); }
.tag { font-family: var(--font-mono); font-size: 0.68rem; padding: 0.18rem 0.5rem; border-radius: 4px; background: var(--bg-surface); color: var(--text-muted); }

.lab-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 1.35rem; }
.aes-widget { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; }
.aes-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; }
.aes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin: 0.85rem 0; }
.aes-cell { background: var(--bg-terminal); border: 1px solid var(--border-subtle); border-radius: 6px; padding: 0.55rem 0.3rem; text-align: center; font-family: var(--font-mono); font-size: 0.82rem; font-weight: 600; color: var(--accent-cyan); }
.aes-cell.mutated { border-color: var(--accent-emerald); color: var(--accent-emerald); }
.aes-controls { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.math-cards { display: flex; flex-direction: column; gap: 0.9rem; }
.math-card { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-left: 3px solid var(--accent-indigo); border-radius: var(--radius-md); padding: 1.1rem 1.25rem; }
.formula-box { font-family: var(--font-mono); font-size: 0.76rem; color: var(--accent-amber); background: rgba(245, 158, 11, 0.08); padding: 0.32rem 0.6rem; border-radius: 5px; margin: 0.4rem 0; display: inline-block; }

.stack-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.15rem; }
.stack-col { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 1.25rem; }
.stack-col h3 { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent-cyan); margin-bottom: 0.85rem; text-transform: uppercase; }
.stack-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stack-pill { font-family: var(--font-mono); font-size: 0.74rem; padding: 0.3rem 0.6rem; border-radius: 5px; background: var(--bg-surface); border: 1px solid var(--border-subtle); }

footer { border-top: 1px solid var(--border-subtle); padding: 2.5rem 0; margin-top: 2.5rem; color: var(--text-muted); font-size: 0.84rem; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }

@media (max-width: 980px) {
  .hero, .lab-layout { grid-template-columns: 1fr; }
  .bento-card, .bento-card.featured { grid-column: span 6; }
  .stack-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .nav-links { display: none; }
  .bento-card, .bento-card.featured { grid-column: span 12; }
  .stack-grid, .metrics-bar { grid-template-columns: 1fr; }
}
