/* =========================================================
   CSS custom properties - light mode (default)
   ========================================================= */
:root {
  --bg:         #f9f9f7;
  --bg-subtle:  #f0f0ec;
  --fg:         #111111;
  --fg-muted:   #555555;
  --border:     #d8d8d0;
  --accent:     #1a56c4;
  --accent-fg:  #ffffff;

  --font-sans:  system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono:  "Menlo", "Consolas", "Liberation Mono", monospace;

  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   2rem;
  --space-xl:   4rem;

  --line-height: 1.65;
  --max-width:   680px;
}

/* =========================================================
   Dark mode overrides
   ========================================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #111111;
    --bg-subtle: #1c1c1c;
    --fg:        #e8e8e4;
    --fg-muted:  #888888;
    --border:    #2e2e2e;
    --accent:    #5b9cf6;
    --accent-fg: #111111;
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: var(--line-height);
  min-height: 100dvh;
  padding: var(--space-lg) var(--space-md);
}

/* =========================================================
   Layout
   ========================================================= */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
}

/* =========================================================
   Navigation
   ========================================================= */
nav {
  margin-bottom: var(--space-xl);
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  list-style: none;
}

nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--fg);
}

nav a[aria-current="page"] {
  font-weight: 600;
}

/* =========================================================
   Typography
   ========================================================= */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

p {
  color: var(--fg-muted);
  margin-bottom: var(--space-md);
}

a {
  color: var(--accent);
}

a:hover {
  text-decoration: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--bg-subtle);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

/* =========================================================
   Main / sections
   ========================================================= */
main {
  margin-bottom: var(--space-xl);
}

section {
  margin-bottom: var(--space-lg);
}

/* =========================================================
   details / summary (expandable UI primitive)
   ========================================================= */
details {
  border-top: 1px solid var(--border);
  padding: var(--space-md) 0;
}

details:last-of-type {
  border-bottom: 1px solid var(--border);
}

summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--fg-muted);
}

details[open] summary::after {
  content: "-";
}

details > *:not(summary) {
  margin-top: var(--space-md);
}

/* =========================================================
   Footer
   ========================================================= */
footer {
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
  font-size: 0.8rem;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

footer a {
  color: var(--fg-muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--fg);
}

/* =========================================================
   Dev-mode indicator
   ========================================================= */
.mode-link {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
}

.mode-link:hover {
  border-color: var(--fg-muted);
  color: var(--fg);
}
