/* ── Variables ────────────────────────────────────────────────── */
:root {
  --bg: #131315;
  --bg-raised: #1a1a1d;
  --surface: #212125;
  --surface-hover: #28282d;
  --border: #2e2e33;
  --border-subtle: #252529;
  --accent: #d23248;
  --accent-hover: #e03a52;
  --accent-dim: rgba(210, 50, 72, 0.08);
  --accent-glow: rgba(210, 50, 72, 0.12);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.08);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.08);
  --amber: #fbbf24;
  --amber-dim: rgba(251, 191, 36, 0.08);
  --text: #e4e4e8;
  --text-secondary: #9a9aa4;
  --text-muted: #5e5e68;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", monospace;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --nav-height: 49px;
  --logo-filter: brightness(0) invert(0.55);
}

/* ── Light theme ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f5f3f0;
  --bg-raised: #edeae6;
  --surface: #e5e2dd;
  --surface-hover: #dcd9d3;
  --border: #d0cdc6;
  --border-subtle: #dfdcd7;
  --accent: #c42a3e;
  --accent-hover: #a82234;
  --accent-dim: rgba(196, 42, 62, 0.07);
  --accent-glow: rgba(196, 42, 62, 0.1);
  --green: #16a371;
  --green-dim: rgba(22, 163, 113, 0.07);
  --blue: #3b82d6;
  --blue-dim: rgba(59, 130, 214, 0.07);
  --amber: #d49a00;
  --amber-dim: rgba(212, 154, 0, 0.07);
  --text: #1c1b1f;
  --text-secondary: #55535e;
  --text-muted: #908d98;
  --logo-filter: none;
}

/* ── Theme transition ────────────────────────────────────────── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease !important;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 24px);
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Layout ──────────────────────────────────────────────────── */
.container {
  max-width: 740px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── (top-bar removed — color distributed through sections) ── */

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  padding: 32px 0;
  box-shadow: 0 1px 20px rgba(210, 50, 72, 0.04);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
}

.header-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.header-text .subtitle {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

.header-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ── Theme Toggle ───────────────────────────────────────────── */
.theme-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.theme-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Sticky Nav ──────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 14px 18px;
  white-space: nowrap;
  position: relative;
  transition: color 0.15s ease;
}

.nav-link:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

/* ── Main ────────────────────────────────────────────────────── */
main { flex: 1; }

/* ── Page sections ───────────────────────────────────────────── */
.page-section {
  padding: 48px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.page-section:last-child {
  border-bottom: none;
}

.section-header {
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}

.section-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ── Section labels ──────────────────────────────────────────── */
.section-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 12px;
  transition: border-color 0.15s ease;
}

/* ── Latest Release ──────────────────────────────────────────── */
.latest-release { margin-bottom: 36px; }

.latest-release .card {
  position: relative;
  overflow: hidden;
}

.latest-release .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.latest-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.latest-info { flex: 1; min-width: 0; }

.version-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.release-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.release-meta .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 12px rgba(210, 50, 72, 0.2);
  margin-top: 18px;
}

.download-btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(210, 50, 72, 0.3);
}

.download-btn:active { transform: translateY(0); }

.download-btn svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

.download-size { font-size: 0.72rem; font-weight: 400; opacity: 0.7; }

/* ── Release Notes ───────────────────────────────────────────── */
.release-notes {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.release-notes-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.release-notes-content {
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.release-notes-content h1,
.release-notes-content h2,
.release-notes-content h3 {
  color: var(--text);
  margin-top: 16px;
  margin-bottom: 6px;
  font-weight: 600;
}

.release-notes-content h1 { font-size: 1.05rem; }
.release-notes-content h2 { font-size: 0.95rem; }
.release-notes-content h3 { font-size: 0.88rem; }

.release-notes-content ul { padding-left: 20px; margin: 8px 0; }
.release-notes-content li { margin-bottom: 4px; }
.release-notes-content li::marker { color: var(--text-muted); }

.release-notes-content code {
  font-family: var(--mono);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--text);
}

.release-notes-content strong { color: var(--text); font-weight: 600; }
.release-notes-content br { display: block; content: ""; margin-top: 4px; }

/* ── Previous Versions ───────────────────────────────────────── */
.prev-release {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prev-release-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.prev-release .version-badge {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  padding: 3px 10px;
}

.prev-release-date { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

.prev-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.prev-download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
  text-decoration: none;
}

.prev-download-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ── Expandable notes ────────────────────────────────────────── */
.prev-notes-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 6px 0 0;
  transition: color 0.15s ease;
}

.prev-notes-toggle:hover { color: var(--text-secondary); }

.prev-notes-toggle svg {
  width: 12px; height: 12px; fill: none;
  stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.prev-notes-toggle.expanded svg { transform: rotate(180deg); }

.prev-notes-content {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.prev-notes-content.expanded {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* ── View All ────────────────────────────────────────────────── */
.view-all { text-align: center; margin-top: 18px; }

.view-all a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.view-all a:hover { color: var(--text-secondary); }
.view-all svg { width: 14px; height: 14px; stroke: currentColor; transition: transform 0.15s ease; }
.view-all a:hover svg { transform: translateX(2px); }

/* ── Loading ─────────────────────────────────────────────────── */
.loading { text-align: center; padding: 60px 0; color: var(--text-muted); }
.loading p { font-size: 0.82rem; }

.spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── States ──────────────────────────────────────────────────── */
.state-message { text-align: center; padding: 60px 0; }
.state-icon { width: 36px; height: 36px; margin: 0 auto 18px; color: var(--text-muted); }
.state-icon svg { width: 100%; height: 100%; }
.state-message p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 18px; }
.state-actions { display: flex; align-items: center; justify-content: center; gap: 12px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
}

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

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

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text-secondary); text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════ */
/* GETTING STARTED                                                */
/* ═══════════════════════════════════════════════════════════════ */

.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  display: flex;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.step:last-child { border-bottom: none; }

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 50%;
  margin-top: 2px;
}

.step-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.step-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 8px;
}

.step-content p:last-child { margin-bottom: 0; }

.step-content code {
  font-family: var(--mono);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--text);
}

/* ── Info Box ────────────────────────────────────────────────── */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--blue-dim);
  border: 1px solid rgba(96, 165, 250, 0.12);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-box svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--blue);
  margin-top: 1px;
}

.info-box strong { color: var(--text); font-weight: 600; }

/* ── Code Block ──────────────────────────────────────────────── */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 10px 0;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
}

/* ── Flow Diagram ────────────────────────────────────────────── */
.how-it-works {
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

.how-it-works::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
}

.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0;
  overflow-x: auto;
}

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  min-width: 90px;
}

.flow-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.flow-icon svg { width: 100%; height: 100%; }

.flow-node span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════ */
/* DOCUMENTATION                                                  */
/* ═══════════════════════════════════════════════════════════════ */

.doc-group {
  margin-bottom: 36px;
}

.doc-group:last-child { margin-bottom: 0; }

.doc-group-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.doc-group-title::before {
  content: "//";
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 8px;
  opacity: 0.6;
}

.doc-group-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 18px;
}

.doc-group-desc code {
  font-family: var(--mono);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--text);
}

.doc-group ul {
  padding-left: 20px;
  margin: 0 0 12px;
}

.doc-group li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}

.doc-group li::marker { color: var(--text-muted); }
.doc-group li strong { color: var(--text); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════ */
/* TROUBLESHOOTING / FAQ                                          */
/* ═══════════════════════════════════════════════════════════════ */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-subtle);
}

.faq-item:last-child { border-bottom: none; }

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; content: ""; }

.faq-q {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: color 0.15s ease;
}

.faq-item:hover .faq-q { color: var(--accent); }

.faq-chevron {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, stroke 0.15s ease;
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  stroke: var(--accent);
}

.faq-answer {
  padding: 0 0 20px;
  animation: fadeIn 0.2s ease;
}

.faq-answer p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}

.faq-answer p:last-child { margin-bottom: 0; }

.faq-answer ul {
  padding-left: 20px;
  margin: 8px 0;
}

.faq-answer li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 4px;
}

.faq-answer li::marker { color: var(--text-muted); }

.faq-answer code {
  font-family: var(--mono);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.82em;
  color: var(--text);
}

.faq-answer strong { color: var(--text); font-weight: 600; }

.faq-answer .code-block { margin: 10px 0; }

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 36px 0 32px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer-wordmark {
  height: 22px;
  width: auto;
  filter: var(--logo-filter);
  opacity: 0.7;
  transition: opacity 0.2s ease, filter 0.25s ease;
}

.footer-wordmark:hover { opacity: 1; }

.footer-legal {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── No installer ────────────────────────────────────────────── */
.no-installer { margin-top: 14px; color: var(--text-muted); font-size: 0.82rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .site-header { padding: 24px 0; }
  .header-inner { gap: 12px; }
  .header-logo { width: 36px; height: 36px; border-radius: 8px; }
  .header-text h1 { font-size: 1.15rem; }
  .header-badge { display: none; }

  .nav-link { padding: 12px 14px; font-size: 0.68rem; }

  .page-section { padding: 36px 0; }
  .section-title { font-size: 1.15rem; }

  .card { padding: 18px; }

  .download-btn {
    width: 100%;
    justify-content: center;
    padding: 15px 26px;
  }

  .prev-release { flex-direction: column; align-items: flex-start; gap: 10px; }
  .prev-download-btn { width: 100%; justify-content: center; }

  .container { padding: 0 16px; }
  .latest-header { flex-direction: column; }
  .state-actions { flex-direction: column; }

  .step { gap: 14px; }
  .step-number { width: 28px; height: 28px; font-size: 0.7rem; }

  .flow-diagram { flex-wrap: wrap; gap: 8px; }
  .flow-arrow { display: none; }
  .flow-diagram { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .flow-node { background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 14px 10px; }
  .flow-icon { border: none; background: none; }

}
