@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=IBM+Plex+Mono:wght@300;400;500&family=Source+Serif+4:ital,wght@0,300;0,400;0,600;1,300&display=swap');

/* ── ROOT VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:        #080c14;
  --bg-card:   #0d1321;
  --bg-glass:  rgba(13,19,33,0.85);
  --border:    rgba(0,212,255,0.15);
  --border-hi: rgba(0,212,255,0.45);
  --cyan:      #00d4ff;
  --cyan-dim:  rgba(0,212,255,0.08);
  --amber:     #f59e0b;
  --amber-dim: rgba(245,158,11,0.1);
  --red:       #ef4444;
  --green:     #22c55e;
  --text:      #c8d6e5;
  --text-dim:  #607080;
  --text-hi:   #eef4fb;
  --mono:      'IBM Plex Mono', monospace;
  --head:      'Rajdhani', sans-serif;
  --body:      'Source Serif 4', serif;
  --glow:      0 0 18px rgba(0,212,255,0.35), 0 0 60px rgba(0,212,255,0.10);
  --glow-amb:  0 0 18px rgba(245,158,11,0.4), 0 0 60px rgba(245,158,11,0.12);
  --radius:    6px;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
}

/* Grid texture overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Subtle top glow */
body::after {
  content: '';
  position: fixed; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.6;
  pointer-events: none;
  z-index: 100;
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--head);
  color: var(--text-hi);
  letter-spacing: 0.04em;
  line-height: 1.15;
}
h1 { font-size: clamp(2.4rem, 5vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; }
h3 { font-size: clamp(1.1rem, 2vw, 1.5rem); font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--cyan); }

p { margin-bottom: 1.1em; max-width: 68ch; }
a { color: var(--cyan); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-hi); }
code, .mono { font-family: var(--mono); font-size: 0.85em; color: var(--cyan); }
strong { color: var(--text-hi); font-weight: 600; }

/* ── LAYOUT CONTAINERS ──────────────────────────────────────── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 2rem; }
.section { padding: 5rem 0; position: relative; z-index: 1; }
.section + .section { border-top: 1px solid var(--border); }

/* ── NAV ────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(8,12,20,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 2rem; max-width: 1160px; margin: 0 auto;
}
.nav-logo {
  font-family: var(--head); font-size: 1.1rem; font-weight: 700;
  color: var(--cyan); letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 0.5rem;
}
.nav-logo .dot { width: 7px; height: 7px; background: var(--cyan); border-radius: 50%; box-shadow: var(--glow); }
.nav-links { display: flex; gap: 2rem; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em;
  color: var(--text-dim); transition: color 0.2s;
  text-transform: uppercase;
}
.nav-links a:hover, .nav-links a.active { color: var(--cyan); }

/* ── HERO ───────────────────────────────────────────────────── */
.hero {
  min-height: 92vh;
  display: flex; align-items: center;
  position: relative; overflow: hidden; z-index: 1;
  padding: 5rem 0;
}

/* Radial glow behind hero */
.hero::before {
  content: '';
  position: absolute; top: -20%; left: -10%;
  width: 70%; height: 120%;
  background: radial-gradient(ellipse at 30% 40%, rgba(0,212,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; bottom: -30%; right: -5%;
  width: 50%; height: 80%;
  background: radial-gradient(ellipse at 70% 60%, rgba(245,158,11,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 2; }
.hero-eyebrow {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--amber);
  display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem;
}
.hero-eyebrow::before {
  content: ''; width: 40px; height: 1px; background: var(--amber); opacity: 0.7;
}
.hero-title { margin-bottom: 1.5rem; }
.hero-title span { color: var(--cyan); display: block; }
.hero-subtitle {
  font-size: 1.1rem; color: var(--text); max-width: 56ch;
  border-left: 3px solid var(--cyan); padding-left: 1.25rem;
  margin-bottom: 2.5rem; font-style: italic;
  font-family: var(--body);
}
.hero-stats {
  display: flex; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 3rem;
}
.stat { }
.stat-val {
  font-family: var(--head); font-size: 2rem; font-weight: 700; color: var(--cyan);
  line-height: 1;
}
.stat-label {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim); margin-top: 0.25rem;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--head); font-weight: 600; letter-spacing: 0.07em;
  font-size: 0.9rem; padding: 0.75rem 1.75rem; border-radius: var(--radius);
  transition: all 0.22s; text-transform: uppercase; cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--cyan); color: #050810;
  box-shadow: var(--glow);
}
.btn-primary:hover {
  background: #20e5ff; color: #050810; transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(0,212,255,0.6);
}
.btn-outline {
  background: transparent; color: var(--cyan);
  border: 1px solid var(--border-hi);
}
.btn-outline:hover {
  background: var(--cyan-dim); border-color: var(--cyan);
}
.btn-group { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.25s, box-shadow 0.25s;
  position: relative;
}
.card:hover {
  border-color: var(--border-hi);
  box-shadow: 0 0 24px rgba(0,212,255,0.08);
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0; border-radius: var(--radius) var(--radius) 0 0;
  transition: opacity 0.25s;
}
.card:hover::before { opacity: 1; }

.card-icon {
  font-size: 1.8rem; margin-bottom: 1rem; display: block;
}
.card-title {
  font-family: var(--head); font-size: 1.2rem; font-weight: 600;
  color: var(--text-hi); margin-bottom: 0.6rem;
}
.card-body { font-size: 0.93rem; color: var(--text); line-height: 1.7; }

.card-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card-grid-2 {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* ── SECTION HEADER ─────────────────────────────────────────── */
.section-header { margin-bottom: 3rem; }
.section-tag {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--amber);
  display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem;
}
.section-tag::before { content: '//'; color: var(--text-dim); }
.section-title { margin-bottom: 0.75rem; }
.section-lead {
  font-size: 1.05rem; color: var(--text); max-width: 60ch;
  border-left: 2px solid var(--border-hi); padding-left: 1rem;
  font-style: italic;
}

/* ── FEATURE LIST ───────────────────────────────────────────── */
.feature-list { list-style: none; }
.feature-list li {
  display: flex; align-items: flex-start; gap: 0.85rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.feature-list li:last-child { border-bottom: none; }
.feature-list .icon { color: var(--cyan); flex-shrink: 0; margin-top: 0.15rem; }

/* ── LAYER TABLE ────────────────────────────────────────────── */
.layer-table { width: 100%; border-collapse: collapse; }
.layer-table th {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0.75rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border-hi);
}
.layer-table td {
  padding: 0.9rem 1rem; font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.layer-table tr:hover td { background: var(--cyan-dim); }
.layer-num {
  font-family: var(--mono); font-size: 0.72rem; color: var(--cyan);
  background: var(--cyan-dim); border: 1px solid var(--border);
  padding: 0.2rem 0.5rem; border-radius: 3px;
}
.tech-tag {
  font-family: var(--mono); font-size: 0.75rem; color: var(--amber);
  background: var(--amber-dim); padding: 0.2rem 0.5rem; border-radius: 3px;
}

/* ── BADGES / PILLS ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  padding: 0.3rem 0.75rem; border-radius: 100px;
}
.badge-cyan { background: var(--cyan-dim); border: 1px solid var(--border); color: var(--cyan); }
.badge-amber { background: var(--amber-dim); border: 1px solid rgba(245,158,11,0.25); color: var(--amber); }
.badge-red { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: var(--red); }
.badge-green { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25); color: var(--green); }

/* ── FAULT TABLE ────────────────────────────────────────────── */
.fault-table { width: 100%; border-collapse: collapse; }
.fault-table th {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0.7rem 1rem; text-align: left;
  border-bottom: 1px solid var(--border-hi);
}
.fault-table td {
  padding: 0.85rem 1rem; font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
.fault-table tr:hover td { background: rgba(239,68,68,0.04); }

/* ── CALLOUT ────────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--amber);
  background: var(--amber-dim);
  padding: 1.25rem 1.5rem; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}
.callout.cyan { border-left-color: var(--cyan); background: var(--cyan-dim); }
.callout.red { border-left-color: var(--red); background: rgba(239,68,68,0.06); }
.callout p { margin: 0; }

/* ── STATE MACHINE DIAGRAM ──────────────────────────────────── */
.state-diagram { padding: 2rem 0; }
.state-row {
  display: flex; align-items: center; justify-content: center;
  gap: 0; flex-wrap: wrap;
}
.state-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.85rem 1.25rem;
  font-family: var(--head); font-size: 0.95rem; font-weight: 600;
  color: var(--text-hi); text-align: center; min-width: 110px;
  position: relative;
  transition: all 0.2s;
}
.state-box.init { border-color: var(--text-dim); }
.state-box.standby { border-color: #3b82f6; color: #93c5fd; }
.state-box.precharge { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 12px rgba(245,158,11,0.15); }
.state-box.drive { border-color: var(--green); color: var(--green); box-shadow: 0 0 12px rgba(34,197,94,0.15); }
.state-box.charge { border-color: var(--cyan); color: var(--cyan); box-shadow: var(--glow); }
.state-box.fault { border-color: var(--red); color: var(--red); box-shadow: 0 0 12px rgba(239,68,68,0.2); }
.state-arrow {
  font-family: var(--mono); font-size: 0.65rem; color: var(--text-dim);
  display: flex; flex-direction: column; align-items: center; padding: 0 0.75rem;
  white-space: nowrap;
}
.state-arrow .arr { font-size: 1rem; color: var(--border-hi); }

/* ── SVG DIAGRAM WRAPPER ────────────────────────────────────── */
.diagram-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; overflow: auto;
  margin: 1.5rem 0;
}

/* ── RESULTS GRID ───────────────────────────────────────────── */
.result-item {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.25rem; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: all 0.2s;
}
.result-item:hover { border-color: var(--green); }
.result-icon { color: var(--green); font-size: 1.2rem; flex-shrink: 0; margin-top: 0.1rem; }
.result-title {
  font-family: var(--head); font-size: 1rem; font-weight: 600;
  color: var(--text-hi); margin-bottom: 0.3rem;
}
.result-desc { font-size: 0.9rem; color: var(--text); line-height: 1.6; }

/* ── TIMELINE ───────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--cyan), rgba(0,212,255,0.1));
}
.tl-item { position: relative; padding-bottom: 2rem; }
.tl-dot {
  position: absolute; left: -2rem; top: 0.35rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--cyan);
  box-shadow: var(--glow);
  transform: translateX(-4px);
}
.tl-dot.amber { border-color: var(--amber); box-shadow: var(--glow-amb); }
.tl-time {
  font-family: var(--mono); font-size: 0.72rem; color: var(--cyan);
  margin-bottom: 0.25rem;
}
.tl-title {
  font-family: var(--head); font-size: 1rem; font-weight: 600;
  color: var(--text-hi); margin-bottom: 0.4rem;
}
.tl-body { font-size: 0.9rem; color: var(--text); }

/* ── CODE BLOCK ─────────────────────────────────────────────── */
.code-block {
  background: #050810; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.9;
  overflow-x: auto; position: relative;
}
.code-label {
  position: absolute; top: 0.75rem; right: 1rem;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  color: var(--text-dim); text-transform: uppercase;
}
.code-line-cyan { color: var(--cyan); }
.code-line-amber { color: var(--amber); }
.code-line-green { color: var(--green); }
.code-line-red { color: var(--red); }
.code-line-dim { color: var(--text-dim); }

/* ── FOOTER ─────────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border); padding: 3rem 0;
  position: relative; z-index: 1;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1.5rem;
  max-width: 1160px; margin: 0 auto; padding: 0 2rem;
}
.footer-brand {
  font-family: var(--head); font-size: 1rem; font-weight: 700;
  color: var(--cyan); letter-spacing: 0.1em;
}
.footer-meta {
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim);
}
.footer-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-nav a {
  font-family: var(--mono); font-size: 0.75rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--cyan); }

/* ── UTILS ──────────────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.text-cyan { color: var(--cyan); }
.text-amber { color: var(--amber); }
.text-dim { color: var(--text-dim); }
.text-hi { color: var(--text-hi); }
.flex { display: flex; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.items-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.two-col {
  display: grid; gap: 3rem;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .nav-links { gap: 1rem; }
}

/* ── SCROLL ANIMATIONS ──────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── SCAN LINE EFFECT ───────────────────────────────────────── */
@keyframes scan {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}
.scanline {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(180deg, transparent, rgba(0,212,255,0.04), transparent);
  animation: scan 8s linear infinite;
  pointer-events: none; z-index: 99;
}

/* ── BLINKING CURSOR ────────────────────────────────────────── */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.cursor::after {
  content: '▮'; color: var(--cyan); margin-left: 4px;
  animation: blink 1.1s step-end infinite;
}

/* ── GLOW PULSE ─────────────────────────────────────────────── */
@keyframes glow-pulse {
  0%, 100% { box-shadow: var(--glow); }
  50%       { box-shadow: 0 0 30px rgba(0,212,255,0.6); }
}
.pulse { animation: glow-pulse 2.5s ease-in-out infinite; }

/* ── PAGE HERO (inner pages) ─────────────────────────────────── */
.page-hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,212,255,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.page-tag {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--cyan);
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-bottom: 1rem;
}
.page-tag::before { content: ''; width: 30px; height: 1px; background: var(--cyan); }
