:root {
  color-scheme: light dark;
  /* Kept in step with src/ui/app.css by hand. The app and the guide are one product and
     used to be a shade apart on six of these, which reads as two products that nearly
     match. The typeface deliberately still differs: the guide loads no webfont, because
     test/docs.test.mjs requires every guide asset to be local and its CSP allows no font
     origin at all. A document and a tool are allowed to be set differently; being almost
     the same colour is just drift. */
  --ground: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eceff4;
  --ink: #0f141a;
  --ink-dim: #58626f;
  --line: #dfe4ea;
  --accent: #0b6169;
  --accent-ink: #ffffff;
  --ok: #17703f;
  --warn: #8a6a00;
  --fail: #b3261e;
  --sans: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d1014;
    --surface: #151a20;
    --surface-2: #1c222b;
    --ink: #e7ecf2;
    --ink-dim: #939daa;
    --line: #262d37;
    --accent: #5eead4;
    --accent-ink: #052622;
    --ok: #46c07f;
    --warn: #d9a441;
    --fail: #ff6b5e;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 9px 13px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding:
    max(12px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    12px
    max(24px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ground) 94%, transparent);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand img {
  width: 34px;
  height: 34px;
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 7px 13px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.button-link.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(210px, 270px) minmax(0, 820px);
  justify-content: center;
  gap: 42px;
  max-width: 1240px;
  margin: 0 auto;
  padding:
    34px
    max(24px, env(safe-area-inset-right))
    max(72px, calc(env(safe-area-inset-bottom) + 36px))
    max(24px, env(safe-area-inset-left));
}

.docs-nav {
  align-self: start;
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

.docs-nav details { border: 0; }

.docs-nav summary {
  display: none;
  cursor: pointer;
  font-weight: 800;
}

.docs-nav ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink-dim);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.docs-nav a:hover,
.docs-nav a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--ink);
}

main { min-width: 0; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1, h2, h3 {
  line-height: 1.22;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.3rem);
}

h2 {
  margin: 2.6em 0 0.6em;
  padding-top: 0.2em;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

h3 {
  margin: 2em 0 0.45em;
  font-size: 1.25rem;
}

p, li { max-width: 76ch; }

.lede {
  max-width: 62ch;
  margin: 20px 0 0;
  color: var(--ink-dim);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 0;
}

.hero-shot {
  width: 100%;
  margin: 34px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 50px color-mix(in srgb, var(--ink) 12%, transparent);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0;
}

.card {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.card:hover { border-color: var(--accent); }

.card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.05rem;
}

.card span {
  color: var(--ink-dim);
  font-size: 14px;
}

.callout {
  margin: 24px 0;
  padding: 15px 17px;
  border-left: 4px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.callout.warning { border-color: var(--warn); }
.callout.danger { border-color: var(--fail); }
.callout.success { border-color: var(--ok); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.steps {
  counter-reset: guide-step;
  display: grid;
  gap: 13px;
  padding: 0;
  list-style: none;
}

.steps > li {
  position: relative;
  min-height: 42px;
  padding: 8px 0 8px 54px;
  counter-increment: guide-step;
}

.steps > li::before {
  content: counter(guide-step);
  position: absolute;
  top: 4px;
  left: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-weight: 800;
}

code, pre { font-family: var(--mono); }

code {
  padding: 0.12em 0.32em;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.55;
}

pre code { padding: 0; background: transparent; }

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-2);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }

.checklist {
  padding-left: 1.3em;
  list-style: "✓  ";
}

.muted { color: var(--ink-dim); }

.page-footer {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 14px;
}

@media (max-width: 820px) {
  .site-header { position: static; }
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 20px;
  }
  .docs-nav {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .docs-nav details {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }
  .docs-nav summary { display: list-item; }
  .docs-nav details:not([open]) ul { display: none; }
  .docs-nav ul { margin-top: 10px; }
  .card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .site-actions { width: 100%; }
  .site-actions .button-link { flex: 1; }
  h1 { font-size: 2.35rem; }
}

@media print {
  :root {
    --ground: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f1f1;
    --ink: #000000;
    --ink-dim: #333333;
    --line: #bbbbbb;
    --accent: #000000;
  }
  .site-header, .docs-nav, .hero-actions { display: none; }
  .layout { display: block; max-width: none; padding: 0; }
  a { color: inherit; text-decoration: underline; }
  .card { break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
