/* The developer guides (/docs/, §BN-ad, §CW): plain static pages, one stylesheet,
   one same-origin script (search.js) that only adds the search box. Colours are tokens on :root with a dark-mode set; everything
   reads at 390 px with 16 px gutters and no sideways page scroll (code blocks
   and tables scroll inside themselves). */

:root {
  /* Graphite & Wax Daylight (§CM, packages/web/src/styles/tokens.css): links in the
     link amber, focus in the highlight amber, no indigo. */
  --bg: #f7f5f0;
  --bg-soft: #efece5;
  --bg-code: #e9e5dc;
  --ink: #1c1b19;
  --muted: #69635a;
  --line: #e2ddd3;
  --accent: #b9751a;
  --accent-ink: #94590d;
  --get: #047857;
  --post: #1d4ed8;
  --patch: #9d174d;
  --put: #0f766e;
  --delete: #b91c1c;
  --ok: #047857;
  --warn: #94590d;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Midnight */
    --bg: #1c1b19;
    --bg-soft: #252320;
    --bg-code: #2a2825;
    --ink: #eeeae3;
    --muted: #a8a299;
    --line: #33302c;
    --accent: #e7a43c;
    --accent-ink: #f0b85e;
    --get: #6ee7b7;
    --post: #93c5fd;
    --patch: #f9a8d4;
    --put: #5eead4;
    --delete: #fca5a5;
    --ok: #6ee7b7;
    --warn: #f0b85e;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--sans);
  overflow-wrap: anywhere;
}
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip-link { position: absolute; left: -9999px; top: 8px; }
.skip-link:focus { left: 16px; background: var(--bg); padding: 6px 10px; z-index: 2; }

.site-header { border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.site-header-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px;
}
.brand { color: var(--ink); font-weight: 700; font-size: 18px; text-decoration: none; }
.brand-sub { color: var(--muted); font-weight: 500; }
.header-link { font-size: 14px; }
.header-links { display: flex; gap: 16px; }
.header-guides { display: none; }

/* The search box (shown by search.js) */
.site-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.site-search input {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.site-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 3;
  list-style: none; margin: 0; padding: 4px; max-height: 70vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.search-results a { display: block; padding: 6px 8px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.search-results a:hover, .search-results a:focus-visible { background: var(--bg-soft); }
.search-title { display: block; font-weight: 600; }
.search-where { display: block; font-size: 13px; color: var(--muted); }
.search-none { padding: 6px 8px; color: var(--muted); font-size: 14px; }

.layout {
  max-width: 1180px; margin: 0 auto; padding: 0 16px;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px;
}
.site-nav { padding: 24px 0; font-size: 14px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav > ul { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.site-nav li { margin: 0; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-group-title {
  display: block; padding: 0 10px 4px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.site-nav a { display: block; padding: 5px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; }
.site-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--bg-code); color: var(--ink); font-weight: 600; }

.content { min-width: 0; padding: 24px 0 48px; }
.content h1 { font-size: 32px; line-height: 1.2; margin: 0 0 12px; }
.content h2 { font-size: 22px; margin: 36px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.content h3 { font-size: 17px; margin: 24px 0 8px; }
.content h2, .content h3 { scroll-margin-top: 16px; }
.lead { font-size: 18px; color: var(--muted); }
.muted { color: var(--muted); }

code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-code); padding: 1px 5px; border-radius: 4px; }
pre {
  background: var(--bg-code); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 13.5px; line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: inherit; overflow-wrap: normal; white-space: pre; }

.table-wrap { overflow-x: auto; margin: 12px 0; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; }
td code, th code { overflow-wrap: normal; }

/* The generated reference */
.toc ul { columns: 2; padding-left: 18px; }
.tag-group { margin-top: 8px; }
.op { border: 1px solid var(--line); border-radius: 10px; padding: 4px 16px 12px; margin: 16px 0; background: var(--bg); }
.op h3 { margin-top: 12px; }
.op-line { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.op-path { overflow-wrap: anywhere; }
.op-scope { margin: 4px 0; font-size: 14px; color: var(--muted); }
.method { font: 700 12px var(--mono); letter-spacing: 0.04em; padding: 2px 7px; border-radius: 4px; border: 1px solid currentColor; }
.method-get { color: var(--get); }
.method-post { color: var(--post); }
.method-patch { color: var(--patch); }
.method-put { color: var(--put); }
.method-delete { color: var(--delete); }
.tag-required { font-size: 12px; font-weight: 600; color: var(--delete); }
.type { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.schema { border-top: 1px solid var(--line); margin-top: 12px; }

/* The Overview's catalogue (from catalogue.json) */
.catalogue-group h2 { margin-bottom: 4px; }
.cards {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
}
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--bg-soft); display: flex; flex-direction: column; gap: 6px;
}
.content .card-title { margin: 0; font-size: 16px; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-line { margin: 0; font-size: 14.5px; }
.card-meta { margin: auto 0 0; font-size: 13px; display: grid; gap: 2px; }
.card-meta div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; }
.card-meta dt { color: var(--muted); font-weight: 600; }
.card-meta dd { margin: 0; }
.status { font-weight: 600; }
.status-live { color: var(--ok); }
.status-setup, .status-preview { color: var(--warn); }
.status-coming { color: var(--muted); }
/* "Tested" (§CX): the same labels as missived.com/status, from docs/FEATURE_STATUS.json + VERIFIED.md. */
.tested { font-weight: 600; text-decoration: none; color: var(--ink); }
.tested:hover { text-decoration: underline; }
.tested-verified { color: var(--ok); }
.tested-preview { color: var(--warn); }
.tested-setup { color: var(--muted); }

/* The plans table (plans.md) */
table.plans td { text-align: center; white-space: nowrap; }
table.plans th[scope="row"] { font-weight: 500; background: none; }
table.plans .group-row th { background: var(--bg-soft); font-weight: 700; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer p { max-width: 1180px; margin: 8px auto; padding: 0 16px; }
.site-footer p:first-child { margin-top: 16px; }
.site-footer p:last-child { margin-bottom: 24px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* On a phone the guides list follows the page; "All guides" jumps to it. */
  .site-nav { order: 2; padding: 16px 0 8px; border-top: 1px solid var(--line); }
  .content { order: 1; }
  .site-nav > ul { position: static; max-height: none; overflow: visible; }
  .nav-group > ul { display: flex; flex-wrap: wrap; gap: 4px; }
  .site-nav a { padding: 4px 8px; background: var(--bg-soft); }
  .nav-group-title { padding-left: 0; }
  .header-guides { display: inline; }
  .site-search { max-width: none; order: 3; flex-basis: 100%; }
  .content h1 { font-size: 26px; }
  .toc ul { columns: 1; }
}
