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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #7c6af7;
  --before: #e05252;
  --after: #52c07a;
  --font: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 3rem 2rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--muted);
  font-size: 1rem;
}

main {
  flex: 1;
  padding: 2rem;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.demo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 2rem;
}

.demo-card {
  background: var(--surface);
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  transition: background 0.15s;
}

.demo-card:hover { background: #222; }

.demo-number {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
  padding-top: 0.25rem;
  min-width: 2rem;
}

.demo-info { flex: 1; }

.demo-info h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.demo-info h2 code {
  font-family: var(--mono);
  font-size: 1rem;
}

.demo-info p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.demo-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.8; }
.btn-before { background: #3a1a1a; color: var(--before); border: 1px solid #5a2a2a; }
.btn-after  { background: #1a3a28; color: var(--after);  border: 1px solid #2a5a3a; }

footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ─── Theme toggle button ────────────────────────────────────── */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

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

/* ─── Light theme ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f8f8;
    --surface: #ffffff;
    --border: #e2e2e2;
    --text: #111111;
    --muted: #777777;
    --accent: #6c5ce7;
    --before: #c94040;
    --after: #389a5e;
  }

  :root:not([data-theme="dark"]) .demo-card:hover { background: #f0f0f0; }
  :root:not([data-theme="dark"]) .btn-before { background: #fde8e8; border-color: #f5b8b8; }
  :root:not([data-theme="dark"]) .btn-after  { background: #e8f5ee; border-color: #b8e5c8; }
}

:root[data-theme="light"] {
  --bg: #f8f8f8;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --muted: #777777;
  --accent: #6c5ce7;
  --before: #c94040;
  --after: #389a5e;
}

html[data-theme="light"] .demo-card:hover { background: #f0f0f0; }
html[data-theme="light"] .btn-before { background: #fde8e8; border-color: #f5b8b8; }
html[data-theme="light"] .btn-after  { background: #e8f5ee; border-color: #b8e5c8; }
