/* ── Reset ────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Custom Properties ────────────────────────────────────────────── */
:root {
  /* Dark theme (default) */
  --bg: #0a0b0f;
  --bg-card: #12131a;
  --bg-code: #0e0f15;
  --bg-nav: rgba(10, 11, 15, 0.85);
  --border: #1e2030;
  --border-hover: #e86830;
  --text: #e0e0e6;
  --text-muted: #8b8fa3;
  --text-heading: #f0f0f4;
  --accent: #e86830;
  --accent-dim: rgba(232, 104, 48, 0.15);
  --badge-green: #2ea043;
  --badge-yellow: #d29922;
  --badge-gray: #6e7681;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  --max-w: 72rem;
  --section-gap: 6rem;
  --radius: 8px;
}

[data-theme="light"] {
  --bg: #f8f8fa;
  --bg-card: #ffffff;
  --bg-code: #f0f1f5;
  --bg-nav: rgba(248, 248, 250, 0.85);
  --border: #d8dae0;
  --border-hover: #e86830;
  --text: #2a2a30;
  --text-muted: #6b6f80;
  --text-heading: #111118;
  --accent: #d45a25;
  --accent-dim: rgba(212, 90, 37, 0.1);
}

/* ── Base ──────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  opacity: 0.8;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Typography ────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  color: var(--text-heading);
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 3.5rem; letter-spacing: -0.03em; }
h2 { font-size: 2rem; letter-spacing: -0.02em; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; font-weight: 600; }

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-muted);
  max-width: 40rem;
  margin: 0 auto 3rem;
  text-align: center;
  font-size: 1.05rem;
}

/* ── Layout ────────────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: var(--section-gap) 0;
}

section:nth-child(even) {
  /* subtle alternation — no bg change needed on dark */
}

.text-center { text-align: center; }

/* ── Nav ───────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}

.nav.scrolled {
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-heading);
  text-decoration: none;
}

.nav-brand img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text-heading);
  opacity: 1;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  color: var(--text-heading);
  border-color: var(--text-muted);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.hero {
  padding: 10rem 0 var(--section-gap);
  text-align: center;
}

.hero-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 2rem;
  border-radius: 16px;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero-tagline {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1rem;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 42rem;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-install {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}

.hero-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.1s, box-shadow 0.15s;
  text-decoration: none;
}

.btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(232, 104, 48, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.hero-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--border-hover);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--accent);
}

.card-icon svg {
  width: 20px;
  height: 20px;
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Problem section ──────────────────────────────────────────────── */
.problem-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.problem-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
  transition: border-color 0.2s;
}

.problem-card:hover {
  border-color: var(--border-hover);
}

.problem-card .card-icon {
  margin: 0 auto 1rem;
}

.problem-converge {
  text-align: center;
  padding: 1.5rem;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.problem-converge strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Guide cards ───────────────────────────────────────────────────── */
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover {
  opacity: 1;
}

.guide-cmd {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ── Code blocks ───────────────────────────────────────────────────── */
.code-block {
  position: relative;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  color: var(--text);
}

.code-block code {
  font-family: inherit;
}

.code-block .comment {
  color: var(--text-muted);
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  color: var(--text-heading);
  border-color: var(--text-muted);
}

.copy-btn svg {
  width: 14px;
  height: 14px;
}

/* ── ASCII diagram ────────────────────────────────────────────────── */
.ascii-diagram {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ── Steps ─────────────────────────────────────────────────────────── */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.step {
  position: relative;
  padding-left: 0;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.step h3 {
  margin-bottom: 0.4rem;
}

.step p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Isolation comparison ──────────────────────────────────────────── */
.isolation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.isolation-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.2s;
}

.isolation-card:hover {
  border-color: var(--border-hover);
}

.isolation-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.25rem;
}

.isolation-card .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.isolation-card .badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.badge-default {
  background: var(--accent-dim);
  color: var(--accent);
}

.badge-kvm {
  background: rgba(46, 160, 67, 0.15);
  color: var(--badge-green);
}

.spec-list {
  list-style: none;
}

.spec-list li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.spec-list li:last-child {
  border-bottom: 1px solid var(--border);
}

.spec-label {
  color: var(--text-muted);
}

.spec-value {
  font-weight: 500;
  color: var(--text);
}

/* ── Threat table ──────────────────────────────────────────────────── */
.threat-table-wrapper {
  overflow-x: auto;
}

.threat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.threat-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-heading);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.threat-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
}

.status-defended {
  background: rgba(46, 160, 67, 0.12);
  color: var(--badge-green);
}

.status-partial {
  background: rgba(210, 153, 34, 0.12);
  color: var(--badge-yellow);
}

.status-out {
  background: rgba(110, 118, 129, 0.12);
  color: var(--badge-gray);
}

/* ── Quick Start timeline ──────────────────────────────────────────── */
.timeline {
  max-width: 40rem;
  margin: 0 auto;
}

.timeline-step {
  display: flex;
  gap: 1.5rem;
  padding-bottom: 2rem;
  position: relative;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.timeline-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin-top: 0.5rem;
}

.timeline-content {
  flex: 1;
  padding-top: 0.25rem;
}

.timeline-content h3 {
  margin-bottom: 0.5rem;
}

.timeline-content .code-block {
  margin-top: 0.5rem;
}

/* ── Built On ──────────────────────────────────────────────────────── */
.built-on {
  padding: 3rem 0;
}

.built-on-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.built-on-logos a {
  opacity: 0.55;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
}

.built-on-logos a:hover {
  opacity: 0.9;
}

.built-on-logos img {
  max-height: 36px;
  width: auto;
  object-fit: contain;
}

[data-theme="light"] .built-on-logos a {
  filter: brightness(0) saturate(100%);
}

/* ── Footer ────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  margin-top: var(--section-gap);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.footer-brand img {
  width: 22px;
  height: 22px;
  border-radius: 3px;
}

.footer-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.footer h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.4rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text-heading);
  opacity: 1;
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Warning banner ────────────────────────────────────────────────── */
.warning-banner {
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid rgba(210, 153, 34, 0.25);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--badge-yellow);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --section-gap: 4rem;
  }

  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.6rem; }

  .hero {
    padding: 7rem 0 var(--section-gap);
  }

  .nav-links a.nav-text {
    display: none;
  }

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

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

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

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .ascii-diagram {
    font-size: 0.6rem;
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.4rem; }

  .container {
    padding: 0 1.25rem;
  }

  .hero-install {
    font-size: 0.8rem;
    padding: 0.6rem 0.8rem;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .hero-meta {
    flex-direction: column;
    gap: 0.4rem;
  }

  .threat-table {
    font-size: 0.8rem;
  }

  .threat-table th,
  .threat-table td {
    padding: 0.5rem 0.6rem;
  }
}
