:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --surface-raised: #ffffff;
  --text: #1f2328;
  --muted: #59636e;
  --brand: #0969da;
  --brand-hover: #0550ae;
  --border: #d0d7de;
  --code: #f6f8fa;
  --code-text: #1f2328;
  --success: #1a7f37;
  --callout: #ddf4ff;
  --callout-good: #dafbe1;
  --shadow: 0 8px 24px rgba(140, 149, 159, 0.18);
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-raised: #161b22;
  --text: #e6edf3;
  --muted: #8b949e;
  --brand: #58a6ff;
  --brand-hover: #79c0ff;
  --border: #30363d;
  --code: #161b22;
  --code-text: #e6edf3;
  --success: #3fb950;
  --callout: rgba(56, 139, 253, 0.12);
  --callout-good: rgba(46, 160, 67, 0.12);
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}

a:hover { color: var(--brand-hover); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: .8rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  margin-right: auto;
  color: var(--text);
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 700;
}

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

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
}

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

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .45rem .65rem;
  font: inherit;
  font-weight: 600;
}

.theme-toggle {
  width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

h1, h2, h3 {
  line-height: 1.25;
  color: var(--text);
}

h1 {
  margin-top: 0;
  font-size: clamp(2.25rem, 6vw, 4rem);
  letter-spacing: -.03em;
}

h2 {
  margin-top: 2.5rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.65rem;
}

h3 {
  margin-top: 1.6rem;
  font-size: 1.15rem;
}

p, li {
  max-width: 850px;
}

.lead {
  color: var(--muted);
  font-size: 1.18rem;
  max-width: 760px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

.button {
  display: inline-block;
  margin: .35rem .35rem .35rem 0;
  padding: .62rem .95rem;
  border: 1px solid rgba(27, 31, 36, 0.15);
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--brand-hover);
  color: #ffffff;
}

.button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.button.secondary:hover {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.25rem 0;
}

.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

.card h3 { margin-top: 0; }

blockquote,
.callout {
  margin: 1.25rem 0;
  padding: .9rem 1rem;
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  background: var(--callout);
}

.callout.good {
  background: var(--callout-good);
  border-left-color: var(--success);
}

code {
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: .92em;
}

p code,
li code {
  padding: .15em .35em;
  border-radius: 6px;
  background: var(--surface);
}

pre {
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--code);
  color: var(--code-text);
}

.code-wrap {
  position: relative;
  margin: 1rem 0 1.5rem;
}

.code-wrap pre {
  margin: 0;
  padding-top: 3rem;
}

.copy-button {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 2;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: .38rem .65rem;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
}

.copy-button:hover {
  background: var(--surface-raised);
  border-color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 1.5rem 1.25rem 2rem;
}

.footer-inner {
  max-width: 980px;
  margin: 0 auto;
}

.footer-inner p {
  margin: .25rem 0;
  font-size: .9rem;
}

.footer-maintainer {
  color: var(--muted);
}

@media (max-width: 760px) {
  .nav {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
    padding-top: .4rem;
  }

  .nav-links.open {
    display: flex;
  }

  .theme-toggle {
    margin-left: .2rem;
  }

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

  .site-main {
    padding-top: 2rem;
  }
}
