:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --text: #1f2933;
  --muted: #52606d;
  --border: #dde3ea;
  --accent: #087ea4;
  --accent-soft: #e6f7fb;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --max: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --bg-alt: #1f2229;
    --text: #e4e7eb;
    --muted: #a0aab4;
    --border: #2f343d;
    --accent: #58c4dc;
    --accent-soft: #1b2b33;
    --code-bg: #0b0d11;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

/* Header & navigation */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.site-header .inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

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

.brand svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--accent);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--border);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.site-nav .sep {
  width: 1px;
  margin: 0.3rem 0.35rem;
  background: var(--border);
}

/* Hamburger menu (enabled by js/nav.js, which adds .has-toggle) */

.nav-toggle {
  display: none;
}

@media (max-width: 60rem) {
  .has-toggle .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }

  .has-toggle .nav-toggle:hover {
    border-color: var(--muted);
  }

  .nav-toggle .bar {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .nav-open .nav-toggle .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-open .nav-toggle .bar:nth-child(2) {
    opacity: 0;
  }

  .nav-open .nav-toggle .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .has-toggle .site-nav {
    display: none;
    flex-basis: 100%;
    padding-bottom: 0.5rem;
  }

  .nav-open .site-nav {
    display: block;
  }

  .has-toggle .site-nav ul {
    flex-direction: column;
    gap: 0.125rem;
  }

  .has-toggle .site-nav a {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
  }

  .has-toggle .site-nav .sep {
    width: auto;
    height: 1px;
    margin: 0.375rem 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle .bar {
    transition: none;
  }
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Main content */

main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

.lead {
  font-size: 1.2rem;
  color: var(--muted);
  margin-top: 0;
}

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.9rem;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.note {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: 1.5rem 0;
}

.note p {
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: var(--bg-alt);
}

.card h3 {
  margin-top: 0;
}

.card p {
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.table-wrap {
  overflow-x: auto;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--bg-alt);
}

.pager {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager a {
  text-decoration: none;
  font-weight: 600;
}

.pager .next {
  margin-left: auto;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 36rem) {
  body {
    font-size: 1rem;
  }

  .site-header:not(.has-toggle) .inner {
    flex-direction: column;
    align-items: flex-start;
  }

  main {
    padding-top: 1.5rem;
  }
}
