:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --text: #111827;
  --muted: #5b6472;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1e4fd1;
  --on-accent: #ffffff;
  --code-bg: #0f1420;
  --code-text: #e5e9f0;
  --code-dim: #7c879b;
  --radius: 12px;
  color-scheme: light;
}

/* Dark theme, used only when the visitor picks it with the toggle. Light is
   the default regardless of the system setting. */
:root[data-theme="dark"] {
  --bg: #0b0e13;
  --bg-soft: #11151c;
  --text: #e8ebf0;
  --muted: #98a2b1;
  --line: #222936;
  --accent: #6ea2ff;
  --accent-hover: #93b9ff;
  --on-accent: #0b0e13;
  --code-bg: #080b10;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* Theme toggle */
.theme-toggle {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0; cursor: pointer;
  color: var(--muted); background: none;
  border: 1px solid var(--line); border-radius: 9px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
:root[data-effective-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-effective-theme="dark"] .theme-toggle .moon { display: block; }

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

/* Smooth scrolling for the nav links, unless the visitor prefers reduced
   motion. Sections stop below the sticky header instead of under it. */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
section[id] { scroll-margin-top: 56px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 760px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; color: var(--text); }
.brand:hover { text-decoration: none; }
nav { display: flex; align-items: center; gap: 24px; font-size: 0.925rem; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); text-decoration: none; }
nav .gh { color: var(--text); font-weight: 600; }

/* Hero */
.hero { padding: 88px 0 72px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero-grid > * { min-width: 0; }
.tag { margin: 0 0 16px; font-size: 0.85rem; color: var(--muted); }
h1 {
  margin: 0 0 20px;
  font-size: clamp(2.2rem, 4.6vw, 3.25rem);
  line-height: 1.08; letter-spacing: -0.025em; font-weight: 750;
}
h1 span { color: var(--muted); }
.lead { margin: 0 0 28px; font-size: 1.125rem; color: var(--muted); max-width: 34em; }

.cmd {
  display: flex; align-items: center; gap: 12px;
  width: fit-content; max-width: 100%;
  padding: 10px 10px 10px 16px; margin-bottom: 20px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
}
.cmd code { min-width: 0; white-space: nowrap; overflow-x: auto; }
.cmd button {
  flex: none; cursor: pointer; font: inherit; font-size: 0.8rem;
  color: var(--muted); background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; padding: 4px 10px;
}
.cmd button:hover { color: var(--text); }
.dim { color: var(--code-dim); user-select: none; }

.buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px;
  font-weight: 600; font-size: 0.95rem; color: var(--text);
  border: 1px solid var(--line);
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Terminal */
.term {
  margin: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg); color: var(--code-text);
  box-shadow: 0 20px 50px -20px rgb(15 20 32 / 0.45);
}
.term-bar { display: flex; gap: 7px; padding: 12px 14px; border-bottom: 1px solid rgb(255 255 255 / 0.06); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #2c3442; }
.term pre { margin: 0; padding: 18px 20px 20px; overflow-x: auto; line-height: 1.6; }

/* Sections */
.section { padding: 72px 0; }
.shaded { background: var(--bg-soft); border-block: 1px solid var(--line); }
h2 { margin: 0 0 24px; font-size: 1.6rem; letter-spacing: -0.015em; }
h3 { margin: 0 0 4px; font-size: 1rem; }

.features {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px;
}
.features p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.formats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line);
}
.label { font-size: 0.85rem; color: var(--muted); margin-right: 2px; }
.label:not(:first-child) { margin-left: 18px; }
.chip {
  font-size: 0.8rem; font-weight: 600; padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 999px;
}

/* Install tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  cursor: pointer; font: inherit; font-size: 0.925rem; font-weight: 600;
  color: var(--muted); background: none; border: none;
  padding: 8px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }
.panel p { margin: 0 0 14px; color: var(--muted); }
.panel pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  background: var(--code-bg); color: var(--code-text); border-radius: 10px;
}

/* Usage */
.usage { margin: 0; display: grid; grid-template-columns: 1fr 1.5fr; }
.usage dt, .usage dd { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); }
.usage dt { color: var(--muted); padding-right: 24px; }
.usage dd code { white-space: nowrap; }
.more { margin: 20px 0 0; color: var(--muted); font-size: 0.95rem; }

/* Footer */
.footer { padding: 28px 0; border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-inner a { color: var(--muted); margin-left: 18px; }
.footer-inner a:first-child { margin-left: 0; }
.footer-inner a:hover { color: var(--text); }

/* Smaller screens */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hero { padding: 56px 0 48px; }
  .section { padding: 56px 0; }
  nav a:not(.gh):not(.blog) { display: none; }
  .features { grid-template-columns: 1fr; gap: 20px; }
  .usage { grid-template-columns: 1fr; }
  .usage dt { border-bottom: none; padding-bottom: 2px; }
  .usage dd { padding-top: 0; overflow-x: auto; }
}

/* Blog list */
.page-title { margin: 0 0 12px; font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -0.02em; }
.post-list { list-style: none; margin: 40px 0 0; padding: 0; }
.post-list li { padding: 24px 0; border-top: 1px solid var(--line); }
.post-list time { font-size: 0.875rem; color: var(--muted); }
.post-list h2 { margin: 4px 0 6px; font-size: 1.3rem; }
.post-list h2 a { color: var(--text); }
.post-list p { margin: 0; color: var(--muted); }
nav a[aria-current="page"] { color: var(--text); }

/* Blog post */
.post-col { max-width: 728px; }
.post-hero {
  padding: 48px 0 44px; margin-bottom: 48px;
  background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
.back {
  display: flex; width: fit-content; align-items: center; gap: 6px;
  margin-bottom: 36px; font-size: 0.9rem; font-weight: 500; color: var(--muted);
}
.back:hover { color: var(--text); text-decoration: none; }
.eyebrow {
  display: inline-block; margin: 0 0 14px; padding: 3px 10px;
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 999px;
}
.post-hero h1 { margin: 0 0 14px; font-size: clamp(2rem, 5vw, 2.9rem); }
.post-lead { margin: 0 0 28px; font-size: 1.15rem; color: var(--muted); }
.byline { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  font-weight: 700; color: var(--on-accent); background: var(--accent);
}
.byline .who { display: block; font-weight: 600; }
.byline .when { display: block; color: var(--muted); }

.prose { font-size: 1.075rem; line-height: 1.75; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 48px 0 14px; font-size: 1.45rem; letter-spacing: -0.015em; line-height: 1.3; }
.prose h3 { margin: 32px 0 10px; font-size: 1.15rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 20px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 8px; padding-left: 4px; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 650; }
.prose a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.prose hr { margin: 40px 0; border: 0; border-top: 1px solid var(--line); }
.prose blockquote {
  margin: 0 0 20px; padding: 14px 18px; color: var(--muted);
  background: var(--bg-soft); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
}
.prose blockquote p:last-child { margin: 0; }
.prose :not(pre) > code {
  padding: 2px 6px; font-size: 0.85em; border-radius: 6px; white-space: nowrap;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.prose .codeblock { position: relative; margin: 0 0 24px; }
.prose pre {
  margin: 0 0 24px; padding: 18px 20px; overflow-x: auto; line-height: 1.6;
  background: var(--code-bg); color: var(--code-text); border-radius: 12px;
}
.prose .codeblock pre { margin: 0; padding-right: 84px; }
.prose pre code { font-size: 0.875rem; }
.codeblock .copy {
  position: absolute; top: 10px; right: 10px; cursor: pointer;
  font: inherit; font-size: 0.75rem; padding: 3px 9px; border-radius: 6px;
  color: var(--code-dim); background: rgb(255 255 255 / 0.06); border: 1px solid rgb(255 255 255 / 0.1);
  opacity: 0; transition: opacity 0.15s;
}
.codeblock:hover .copy, .codeblock .copy:focus-visible { opacity: 1; }
.codeblock .copy:hover { color: var(--code-text); }
@media (hover: none) { .codeblock .copy { opacity: 1; } }
/* Syntax colours (Rouge) */
.highlight .c, .highlight .c1, .highlight .cm { color: var(--code-dim); }
.highlight .nb, .highlight .k, .highlight .kd { color: #7fb4ff; }
.highlight .nt, .highlight .o { color: #c4a7ff; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #9fdc9f; }
.highlight .m, .highlight .mi, .highlight .nv { color: #f2c27b; }

.cta {
  display: grid; gap: 18px; margin: 56px 0 0; padding: 28px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--bg-soft);
}
.cta h2 { margin: 0 0 4px; font-size: 1.25rem; }
.cta p { margin: 0; color: var(--muted); }
.cta > * { min-width: 0; }
.cta .cmd { margin: 0; background: var(--bg); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 32px 0 80px; }
.post-nav a {
  display: block; padding: 16px 18px; font-weight: 600; color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
}
.post-nav a:hover { text-decoration: none; border-color: var(--muted); }
.post-nav a span { display: block; margin-bottom: 2px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.post-nav .next { grid-column: 2; text-align: right; }
.post-nav:not(:has(a)) { display: none; }
.post > .wrap:last-child { padding-bottom: 80px; }
.post > .wrap:last-child:has(.post-nav) { padding-bottom: 0; }

@media (max-width: 600px) {
  .post-hero { padding: 32px 0; margin-bottom: 36px; }
  .back { margin-bottom: 24px; }
  .prose { font-size: 1.025rem; }
  .cta { padding: 22px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: auto; }
}

/* In dark mode, code blocks need an edge to stand apart from the page. */
:root[data-theme="dark"] .prose pre,
:root[data-theme="dark"] .panel pre,
:root[data-theme="dark"] .term { box-shadow: inset 0 0 0 1px var(--line); }

/* Install tabs inside a post */
.prose .install-tabs { margin: 0 0 24px; }
.prose .tabs button { font-size: 0.925rem; }
.prose .panel p { margin: 0 0 18px; font-size: inherit; color: inherit; }
.prose .panel .codeblock { margin: 0; }
