/* Sidejar: the same tokens as the Astro site. */
:root {
  --bg: #fbfaf7; --surface: #ffffff; --fg: #1c1d1f; --muted: #5f6368; --line: #e6e2d9;
  --accent: #0f766e; --accent-soft: #e3f3f0; --accent-fg: #ffffff; --code-bg: #f3f1ec; --bad: #b42318;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141517; --surface: #1b1c1f; --fg: #ececec; --muted: #a2a6ad; --line: #2c2e33;
    --accent: #2dd4bf; --accent-soft: #10302c; --accent-fg: #06201d; --code-bg: #1f2125; --bad: #f97066;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
code { font-size: 0.88em; word-break: break-all; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1140px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
header.top { display: flex; align-items: center; gap: 10px; padding: 18px 16px; font-weight: 700; font-size: 19px; flex-wrap: wrap; }
header.top svg { color: var(--accent); }
header.top .brand { color: inherit; text-decoration: none; }
header.top nav { margin-left: auto; display: flex; gap: 18px; font-weight: 500; font-size: 16px; flex-wrap: wrap; }
header.top nav a { color: var(--muted); text-decoration: none; }
header.top nav a[aria-current="page"], header.top nav a:hover { color: var(--fg); }
header.top .addr { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 999px; margin-left: 4px; }

.subbar { border-bottom: 1px solid var(--line); }
nav.sub { display: flex; align-items: center; gap: 18px; padding: 10px 16px; font-size: 15px; flex-wrap: wrap; }
nav.sub a { color: var(--muted); text-decoration: none; }
nav.sub a[aria-current="page"], nav.sub a:hover { color: var(--fg); }
nav.sub form { margin-left: auto; }
nav.sub .tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--bad); }

.hero { padding: 28px 0 40px; }
.jumbotron { margin: 0 0 28px; }
.jumbotron img { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); }
@media (max-width: 600px) { .jumbotron img { aspect-ratio: 16 / 10; border-radius: 12px; } }
.hero h1 { font-size: clamp(32px, 6vw, 52px); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 18px; max-width: 100%; }
.hero p { font-size: 19px; color: var(--muted); margin: 0 0 24px; max-width: 58ch; }
.badge { display: inline-block; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 20px; }
section { padding: 32px 0; border-top: 1px solid var(--line); }
section h2 { font-size: 24px; margin: 0 0 16px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.steps h3 { margin: 0 0 6px; font-size: 17px; }
.steps p { margin: 0; color: var(--muted); font-size: 15.5px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.55; margin: 0; }

.head h1 { margin: 28px 0 8px; font-size: clamp(28px, 5vw, 38px); }
.head p { color: var(--muted); max-width: 64ch; margin: 0 0 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; max-width: 680px; margin-bottom: 18px; }
.panel h2 { font-size: 20px; margin: 0 0 10px; }
label { display: grid; gap: 5px; margin-bottom: 14px; }
label > span { font-size: 14.5px; font-weight: 600; }
label em, .fine { font-style: normal; font-weight: 400; color: var(--muted); font-size: 14px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check span { font-weight: 400; }
input { font: inherit; font-size: 15px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input[type="color"] { width: 44px; height: 32px; padding: 2px; cursor: pointer; }
button, input[type="submit"], .button { display: inline-block; font: inherit; font-size: 15px; font-weight: 600; border: 0; border-radius: 999px; padding: 9px 18px; background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; width: auto; }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: var(--accent-soft); color: var(--accent); }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 500; }
button.link:hover { color: var(--fg); }
.result { color: var(--muted); font-size: 14.5px; margin: 12px 0 0; min-height: 1em; }
.result.ok { color: var(--accent); }
.result.bad { color: var(--bad); }
.flash { margin: 18px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.flash.bad { background: transparent; border: 1px solid var(--bad); color: var(--bad); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: grid; gap: 4px; }
.card .label { color: var(--muted); font-size: 14px; }
.card strong { font-size: 26px; font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.panel table { margin-bottom: 14px; }
footer { padding: 28px 0 48px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); margin-top: 32px; }
footer p { margin: 10px 0 0; }
nav.foot { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 15px; }
nav.foot a { color: var(--muted); text-decoration: none; }
nav.foot a:hover { color: var(--fg); }
header.top nav { align-items: center; }
header.top nav a.pill { background: var(--accent); color: var(--accent-fg); padding: 5px 14px; border-radius: 999px; }
header.top nav a.pill:hover, header.top nav a.pill[aria-current="page"] { color: var(--accent-fg); }

.crumbs { margin: 24px 0 0 !important; font-size: 14px; }
.wallet-title { font-size: clamp(18px, 3.4vw, 26px) !important; margin-top: 6px !important; }
.wallet-title code { font-size: inherit; }
h2.sub-h { font-size: 20px; margin: 8px 0 12px; }
.month-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.month-nav { display: flex; gap: 16px; font-size: 15px; }
table.num td, table.num th { white-space: nowrap; }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; padding-left: 14px; }
section { overflow-x: auto; }

/* Docs (Markdown pages) */
.docs { padding: 24px 0 40px; max-width: 760px; }
.docs h1 { font-size: clamp(30px, 5vw, 40px); margin: 0 0 12px; }
.docs h2 { font-size: 26px; margin: 48px 0 12px; padding-top: 24px; border-top: 1px solid var(--line); }
.docs h3 { font-size: 19px; margin: 28px 0 8px; }
.docs h1 a.anchor, .docs h2 a.anchor, .docs h3 a.anchor { scroll-margin-top: 16px; }
.docs .lead { color: var(--muted); font-size: 19px; }
.docs code { font-size: 0.88em; background: var(--code-bg); padding: 1px 5px; border-radius: 5px; word-break: normal; }
.docs :not(pre) > code { overflow-wrap: anywhere; }
.docs pre { margin: 12px 0 18px; }
.docs pre code { background: none; padding: 0; font-size: 13.5px; }
.docs table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 10px 0 18px; display: block; overflow-x: auto; }
.docs th, .docs td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.docs th { font-weight: 600; white-space: nowrap; }
.docs td code { white-space: nowrap; }
.docs blockquote { margin: 14px 0; padding: 10px 16px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.docs blockquote p { margin: 0; }
.docs nav.toc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin: 20px 0 8px; }
.docs nav.toc ol { margin: 6px 0; padding-left: 20px; }

/* Demos */
.demos-head h1 { margin: 24px 0 10px; font-size: clamp(30px, 5vw, 40px); }
.demos-head p { color: var(--muted); max-width: 64ch; margin: 0 0 10px; }
.demos-head .small, .demo .small { font-size: 15px; }
.demo { padding: 34px 0; border-top: 1px solid var(--line); max-width: 760px; overflow-x: visible; }
h2.group { font-size: 28px; margin: 44px 0 8px; padding-top: 30px; border-top: 3px solid var(--accent); max-width: 760px; }
.group-intro { color: var(--muted); max-width: 64ch; margin: 0 0 8px; }
.demo h2 { font-size: 23px; margin: 0 0 6px; }
.demo > p { color: var(--muted); margin: 0 0 14px; }
.demo .live { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin-bottom: 12px; }
.demo .live p { margin: 0 0 10px; }
.jar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.jar-row sidejar-pay { --sidejar-font-size: 14px; --sidejar-padding: 8px 14px; }
button.sim, button.reset { font: inherit; font-size: 14px; font-weight: 400; border-radius: 999px; padding: 7px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
button.sim { border-color: var(--accent); color: var(--accent); }
button.sim:disabled { opacity: 0.6; cursor: default; }
.demo pre { font-size: 13px; white-space: pre; }
.demo .next { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); }
.thanks { background: var(--accent-soft); padding: 10px 14px; border-radius: 10px; }
.paywall { position: relative; }
.paywall.sidejar-locked { padding-bottom: 52px; }
.paywall.sidejar-locked::after { content: "Unlock the full essay for 5¢"; position: absolute; inset: auto 0 0 0; padding: 48px 0 14px; text-align: center; font-weight: 600; background: linear-gradient(transparent, var(--surface) 60%); }

/* Home */
.hero .subhead { font-size: clamp(19px, 2.6vw, 23px); font-weight: 700; color: var(--fg); margin: -4px 0 14px; }
.hero .facts { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero .facts li { background: var(--accent-soft); color: var(--fg); border-radius: 999px; padding: 5px 13px; font-size: 15px; }
.hero .facts strong { color: var(--accent); }
.cta, .hero p.cta { margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 12px; }
a.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; text-decoration: none; padding: 12px 22px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease; }
a.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgb(0 0 0 / 12%); }
a.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a.btn.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
a.btn.soft:hover { box-shadow: 0 4px 12px rgb(0 0 0 / 8%); }
@media (prefers-reduced-motion: reduce) { a.btn { transition: none; } a.btn:hover { transform: none; } }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px 28px; }
.points h3 { margin: 0 0 6px; font-size: 17px; }
.points p { margin: 0; color: var(--muted); font-size: 15.5px; }
.status { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-top: 22px; }
.status p { margin: 0; color: var(--muted); }
.support p, .contact p { max-width: 60ch; }
.support .thanks { margin-top: 14px; background: var(--accent-soft); padding: 12px 16px; border-radius: 10px; }
.support .fine, .contact .fine { margin-top: 12px; }
.contact sidejar-content { margin-top: 14px; }
.about { display: flex; gap: 18px; align-items: center; margin: 4px 0 18px; max-width: 640px; }
.about h3 { margin: 0 0 4px; font-size: 19px; }
.about p { margin: 0; color: var(--muted); }
.avatar { flex: none; width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
@media (max-width: 480px) { .about { gap: 14px; } .avatar { width: 64px; height: 64px; } }

/* Copy button */
.copy-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--accent); cursor: pointer; line-height: 0; }
.copy-btn:hover:not(:disabled) { background: var(--accent-soft); }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.copy-btn:disabled { color: var(--muted); opacity: 0.45; cursor: default; }

/* Tools index */
.tools-head h1 { margin: 24px 0 8px; font-size: clamp(30px, 5vw, 40px); }
.tools-head p { color: var(--muted); margin: 0 0 24px; }
.tools { display: grid; gap: 14px; max-width: 760px; padding-bottom: 40px; }
a.tool { display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
a.tool:hover { border-color: var(--accent); }
a.tool strong { display: block; font-size: 18px; color: var(--accent); margin-bottom: 4px; }
a.tool .desc { color: var(--muted); }
.ticon { color: var(--accent); flex: none; line-height: 0; }

/* Docs: sidebar + page */
.docs-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.docs-nav { position: sticky; top: 16px; padding: 28px 0 24px; font-size: 15px; max-height: calc(100vh - 16px); overflow-y: auto; }
.docs-nav summary { display: none; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav > nav > ul > li { margin: 2px 0; }
.docs-nav a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.docs-nav a:hover { color: var(--fg); background: var(--surface); }
.docs-nav li.current > a { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.docs-nav ul.sections { margin: 4px 0 8px 10px; border-left: 1px solid var(--line); }
.docs-nav ul.sections a { padding: 3px 10px; font-size: 14px; border-radius: 0 6px 6px 0; }
.docs-shell .docs { padding-top: 28px; }
.docs h1 + .lead { margin-top: 0; }
.docs h2 { scroll-margin-top: 16px; }
.docs-pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.docs-pager a { display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; background: var(--surface); max-width: 48%; }
.docs-pager a:hover { border-color: var(--accent); }
.docs-pager a span { font-size: 13px; color: var(--muted); }
.docs-pager a.next { text-align: right; margin-left: auto; }
@media (max-width: 820px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .docs-nav { position: static; max-height: none; padding: 16px 0 0; }
  .docs-nav summary { display: block; cursor: pointer; font-weight: 600; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
  .docs-nav[open] summary { margin-bottom: 8px; }
}

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; margin: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; padding: 13px 0 13px 30px; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: ""; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: translateY(-65%) rotate(-45deg); transition: transform 150ms ease; }
.faq details[open] > summary::before { transform: translateY(-75%) rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .faq summary::before { transition: none; } }
.faq details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.faq details > :last-child { margin-bottom: 14px; }
.faq h2 { margin-top: 36px; }

/* About */
.story { max-width: 64ch; padding-bottom: 8px; }
.story .lead { font-size: 19px; color: var(--fg); margin: 0 0 8px; }
.story h2 { font-size: 22px; margin: 28px 0 8px; }
.story p { margin: 0 0 12px; }
