/* utility-pki: one stylesheet, no framework, no web fonts, no JavaScript.
 * Colours are defined once on :root and once for dark mode; nothing below names a colour. */

:root {
  --bg: #fbfbfa;
  --bg-raised: #ffffff;
  --bg-sunken: #f3f2ee;
  --fg: #18181b;
  --fg-muted: #57534e;
  --fg-faint: #8a857e;
  --line: #e7e5e0;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #fff1e6;
  --hero: radial-gradient(1200px 500px at 85% -10%, #ffedd5 0%, transparent 60%),
          radial-gradient(900px 400px at -10% 10%, #f5f5f4 0%, transparent 60%);
  --shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 4px 16px rgb(0 0 0 / 4%);
  --radius: 12px;
  --measure: 72ch;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --bg-raised: #1a1d23;
    --bg-sunken: #0e1013;
    --fg: #ececea;
    --fg-muted: #b3afa8;
    --fg-faint: #807b74;
    --line: #2a2e36;
    --accent: #fb923c;
    --accent-strong: #fdba74;
    --accent-soft: #2a1d14;
    --hero: radial-gradient(1200px 500px at 85% -10%, #3b1a0b 0%, transparent 60%),
            radial-gradient(900px 400px at -10% 10%, #1b1e24 0%, transparent 60%);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  overflow-wrap: break-word;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.skip { position: absolute; left: -9999px; top: 0; padding: 0.6rem 1rem; background: var(--accent); color: #fff; z-index: 20; }
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); text-decoration-thickness: 2px; }

/* ---- chrome --------------------------------------------------------------------------- */

.site-inner { max-width: 78rem; margin: 0 auto; padding: 0 1.5rem; }

header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
header.site .site-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 3.75rem; }

.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--fg); text-decoration: none; font: 650 1.02rem var(--mono); }
.brand:hover { color: var(--fg); }
.brand-mark { display: block; border-radius: 6px; }

header.site nav { display: flex; align-items: center; gap: 1.4rem; font-size: 0.94rem; }
header.site nav a { color: var(--fg-muted); text-decoration: none; }
header.site nav a:hover, header.site nav a[aria-current] { color: var(--fg); }
header.site nav .nav-gh { padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 999px; }
@media (max-width: 34rem) { header.site nav a:first-child { display: none; } header.site nav { gap: 0.9rem; } }

footer.site { margin-top: 5rem; padding: 3rem 0 3.5rem; border-top: 1px solid var(--line); background: var(--bg-sunken); font-size: 0.9rem; color: var(--fg-muted); }
.footer-grid { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
footer.site h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); margin: 0 0 0.8rem; }
footer.site ul { list-style: none; margin: 0; padding: 0; }
footer.site li { margin: 0 0 0.35rem; }
footer.site a { color: var(--fg-muted); text-decoration: none; }
footer.site a:hover { color: var(--accent); }
.footer-brand { color: var(--fg); margin: 0 0 0.5rem; }
.muted { color: var(--fg-faint); }

/* ---- typography ----------------------------------------------------------------------- */

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.018em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.2rem); margin: 0 0 0.8rem; }
h2 { font-size: 1.5rem; margin: 2.8rem 0 0.8rem; }
h3 { font-size: 1.12rem; margin: 2rem 0 0.5rem; }
p, ul, ol { max-width: var(--measure); }
p { text-wrap: pretty; }
strong { font-weight: 650; }

/* Zola wraps each heading's text in its anchor: keep the text, show a "#" on hover. */
:is(h2, h3, h4) a.zola-anchor { color: inherit; text-decoration: none; }
:is(h2, h3, h4) a.zola-anchor::after { content: "#"; margin-left: 0.4rem; color: var(--fg-faint); opacity: 0; transition: opacity 0.12s; }
:is(h2, h3, h4):hover a.zola-anchor::after, a.zola-anchor:focus-visible::after { opacity: 1; }

code { font-family: var(--mono); font-size: 0.87em; background: var(--bg-sunken); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.36em; }
pre { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; overflow-x: auto; font-size: 0.85rem; line-height: 1.6; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

blockquote { margin: 1.5rem 0; padding: 0.8rem 1.1rem; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--radius) var(--radius) 0; color: var(--fg); }
blockquote p { margin: 0.3rem 0; }

.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { border-collapse: collapse; font-size: 0.92rem; width: 100%; }
.prose table { display: block; overflow-x: auto; max-width: 100%; margin: 1.5rem 0; }
th, td { text-align: left; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-weight: 650; color: var(--fg-faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody th { font-weight: 650; color: var(--fg); white-space: nowrap; }
td:last-child, th:last-child { padding-right: 0; }

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

/* ---- landing -------------------------------------------------------------------------- */

.wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.5rem; }
section { padding: 4.5rem 0; }
section.band { background: var(--bg-sunken); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); margin: 0 0 1.4rem; }

.hero { background: var(--hero); padding: 5.5rem 0 4.5rem; }
.hero h1 { max-width: 20ch; }
.hero .accent { color: var(--accent); }
.hero .lede { font-size: clamp(1.06rem, 0.98rem + 0.4vw, 1.25rem); color: var(--fg-muted); max-width: 62ch; }
.eyebrow { font: 600 0.76rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 1.1rem; }
.install { display: inline-block; max-width: 100%; overflow-x: auto; margin: 1.8rem 0 0; padding: 0.7rem 1.1rem; box-shadow: var(--shadow); background: var(--bg-raised); }
.install .prompt { color: var(--fg-faint); user-select: none; margin-right: 0.5rem; }

.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 0; }
.btn { display: inline-flex; text-align: center; align-items: center; padding: 0.68rem 1.2rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-raised); color: var(--fg); font-weight: 600; font-size: 0.95rem; text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.12s, transform 0.12s; }
.btn:hover { border-color: var(--accent); color: var(--fg); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; box-shadow: none; }

.tools { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.tool { display: block; padding: 1.3rem 1.35rem; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color 0.12s, transform 0.12s; }
.tool:hover { border-color: var(--accent); color: inherit; transform: translateY(-2px); }
.tool code { display: inline-block; font-size: 0.8rem; color: var(--accent); }
.tool h3 { margin: 0.9rem 0 0.35rem; }
.tool p { margin: 0; color: var(--fg-muted); font-size: 0.93rem; }

.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
@media (min-width: 62rem) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.split .section-title { font-size: 1.35rem; }
.split p { color: var(--fg-muted); }

table.compare { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.compare th, table.compare td { padding: 0.75rem 1rem; }
table.compare tr:last-child th, table.compare tr:last-child td { border-bottom: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1.6rem 0; max-width: none; }
.card { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.card h3 { margin: 0 0 0.4rem; font-size: 1.02rem; }
.card p { margin: 0; color: var(--fg-muted); font-size: 0.93rem; max-width: none; }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color 0.12s; }
.card-link:hover { border-color: var(--accent); color: inherit; }
.card-link h3 { color: var(--accent); }

.faq details { border-bottom: 1px solid var(--line); padding: 1rem 0; max-width: 52rem; }
.faq summary { cursor: pointer; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--fg-muted); margin: 0.7rem 0 0; }

.closing { text-align: center; }
.closing p { margin: 0 auto; color: var(--fg-muted); }
.closing .cta { justify-content: center; }

/* ---- docs ----------------------------------------------------------------------------- */

.docs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding: 2.5rem 0 0; }
@media (min-width: 62rem) {
  .docs { grid-template-columns: 15.5rem minmax(0, 1fr); gap: 4rem; }
  .docs nav.toc { position: sticky; top: 5rem; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; }
}

nav.toc h2 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-faint); margin: 0 0 0.6rem; }
nav.toc h2 + ol { margin-bottom: 1.8rem; }
nav.toc ol { list-style: none; margin: 0; padding: 0; }
nav.toc a { display: block; padding: 0.28rem 0.65rem; border-radius: 7px; color: var(--fg-muted); text-decoration: none; font-size: 0.92rem; }
nav.toc a:hover { background: var(--bg-sunken); color: var(--fg); }
nav.toc a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav.toc .on-page a { font-size: 0.86rem; padding-top: 0.2rem; padding-bottom: 0.2rem; border-left: 2px solid var(--line); border-radius: 0; }
nav.toc .on-page a:hover { border-left-color: var(--accent); background: none; }

.prose { min-width: 0; }
.prose > header .lede { color: var(--fg-muted); font-size: 1.1rem; margin-top: 0.2rem; }
.prose h2 { padding-top: 0.6rem; border-top: 1px solid var(--line); }
.prose li { margin: 0.25rem 0; }
.crumbs { font-size: 0.85rem; color: var(--fg-faint); margin-bottom: 0.8rem; }
.crumbs a { color: var(--fg-faint); text-decoration: none; }
.crumbs span { margin: 0 0.4rem; }
.crumbs a:hover { color: var(--accent); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.5rem; }
.pager a { display: block; padding: 0.9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--fg); font-weight: 600; }
.pager a:hover { border-color: var(--accent); }
.pager span:last-child { text-align: right; }
.pager small { display: block; font-weight: 400; color: var(--fg-faint); font-size: 0.8rem; }
.edit { margin-top: 1.5rem; font-size: 0.85rem; }
.edit a { color: var(--fg-faint); }
