/* ============================================================
   SQUAT User Manual — shared stylesheet

   No frameworks and no CDNs — with ONE stated exception, added 2026-08-22 at
   the owner's direction: body copy is IBM Plex Sans, the SQUAT reading face,
   pulled from Google Fonts below.

   That is a real trade and is recorded rather than quietly made. This file
   previously claimed "no external fonts", and the offline guarantee in
   docs/guides/platform-doc-library.md still holds for THAT library. Here, the
   manual is served over HTTP from www, the font request is `display=swap`, and
   the stack below falls back to system sans — so a reader offline or behind a
   blocked font host loses the typeface and loses nothing else. To restore full
   self-containment, self-host the woff2 files (IBM Plex Sans is OFL, so
   redistribution is permitted) and replace the @import with @font-face.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap");

:root {
  --accent: #0f766e;
  --accent-soft: #e6f2f0;
  --accent-ink: #0b5c56;
  --ink: #1c2530;
  --muted: #5b6675;
  --faint: #8b94a3;
  --line: #e4e7ec;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --code-bg: #f3f5f7;
  --code-ink: #24313f;
  --note-bg: #eef4fd;
  --note-edge: #3b6fc4;
  --tip-bg: #e9f4f1;
  --tip-edge: #0f766e;
  --warn-bg: #fdf3e4;
  --warn-edge: #b06712;
  --sidebar-w: 272px;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

main {
  padding: 0 4rem 5rem;
  min-width: 0;
}

article {
  max-width: 46rem;
}

/* ---------- Sidebar ---------- */

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 1.75rem 1.25rem 2.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  padding: 0 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}

.brand .logo {
  display: block;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  color: var(--accent-ink);
}

/* The www fork swaps the text wordmark for the brand SVG. Its width/height
   attributes (390x110) are the ASSET's intrinsic size, not a layout instruction,
   and `.brand .logo` above is a TEXT rule — font-size and letter-spacing do
   nothing to an image. Without this the SVG renders at 390px inside a 272px
   sidebar and spills across the page. Sized against the sidebar, not the asset. */
.brand img.logo {
  width: auto;
  max-width: 148px;
  height: auto;
  margin-bottom: 0.4rem;
}

.brand .sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-top: 0.1rem;
}

.sidebar nav a {
  display: block;
  padding: 0.36rem 0.75rem;
  margin: 1px 0;
  border-radius: 7px;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}

.sidebar nav a:hover {
  color: var(--ink);
  background: #eef0f3;
}

.sidebar nav a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-group {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin: 1.4rem 0 0.35rem;
  padding: 0 0.75rem;
}

.nav-group:first-child { margin-top: 0.25rem; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 0;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--faint);
  letter-spacing: 0.03em;
}

.topbar .crumb-here { color: var(--muted); font-weight: 600; }

/* ---------- Typography ---------- */

.kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -0.022em;
  margin: 0 0 0.75rem;
}

.lede {
  font-size: 1.13rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 2.25rem;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 2.75rem 0 0.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

h2:first-of-type { border-top: none; padding-top: 0; }

h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 2rem 0 0.5rem;
}

h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
}

p, ul, ol { margin: 0 0 1.05rem; }

li { margin-bottom: 0.35rem; }

li > ul, li > ol { margin-top: 0.35rem; margin-bottom: 0.35rem; }

a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: #9fc6c0; text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent-ink); }

strong { font-weight: 650; }

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

/* ---------- Code ---------- */

code, kbd {
  font-family: var(--mono);
  font-size: 0.855em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.13em 0.38em;
  border-radius: 5px;
}

kbd { border: 1px solid var(--line); border-bottom-width: 2px; background: var(--bg); }

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.95rem 1.15rem;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.83rem;
  color: var(--code-ink);
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.92rem;
}

th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--bg-soft);
  padding: 0.5rem 0.8rem;
  border-bottom: 2px solid var(--line);
}

td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:last-child td { border-bottom: 1px solid var(--line); }

td code { white-space: nowrap; }

/* ---------- Callouts ---------- */

.callout {
  border-radius: 9px;
  padding: 0.9rem 1.15rem 0.85rem;
  margin: 0 0 1.35rem;
  border-left: 4px solid;
  font-size: 0.94rem;
}

.callout > p:last-child, .callout > ul:last-child { margin-bottom: 0; }

.callout .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.3rem;
}

.note { background: var(--note-bg); border-left-color: var(--note-edge); }
.note .label { color: var(--note-edge); }

.tip { background: var(--tip-bg); border-left-color: var(--tip-edge); }
.tip .label { color: var(--tip-edge); }

.warning { background: var(--warn-bg); border-left-color: var(--warn-edge); }
.warning .label { color: var(--warn-edge); }

/* ---------- Step lists ---------- */

ol.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
  margin: 0 0 1.5rem;
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.15rem;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 750;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Definition lists (glossary) ---------- */

dl { margin: 0 0 1.5rem; }

dt {
  font-weight: 700;
  margin-top: 1.15rem;
}

dd {
  margin: 0.15rem 0 0 0;
  color: #333d49;
}

/* ---------- Lifecycle strip (concepts page) ---------- */

.flow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.flow li {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.flow li.hot {
  background: var(--accent-soft);
  border-color: #bcdcd7;
  color: var(--accent-ink);
}

/* ---------- Cover (index page) ---------- */

.cover {
  padding: 2.5rem 2.5rem 2.25rem;
  border-radius: 14px;
  background: linear-gradient(135deg, #0b5c56 0%, #0f766e 55%, #14867c 100%);
  color: #fff;
  margin-bottom: 2.5rem;
}

.cover .cover-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #a7d6d0;
  margin: 0 0 0.6rem;
}

.cover h1 { color: #fff; margin-bottom: 0.6rem; }

.cover p { color: #d6ebe8; font-size: 1.05rem; max-width: 34rem; margin-bottom: 0; }

/* ---------- Card grid (index page) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin: 0 0 1.5rem;
}

.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
}

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

.card .card-title {
  display: block;
  font-weight: 700;
  color: var(--accent-ink);
  margin-bottom: 0.2rem;
}

.card .card-desc {
  display: block;
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Prev / next pager ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.pager a {
  flex: 1;
  max-width: 48%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
}

.pager a:hover { border-color: var(--accent); background: #fbfdfd; }

.pager .dir {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--faint);
  margin-bottom: 0.15rem;
}

.pager .dest { font-weight: 650; color: var(--accent-ink); }

.pager .next { margin-left: auto; text-align: right; }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 5px;
  padding: 0.1em 0.5em;
  vertical-align: middle;
}

.badge.sealed { background: var(--accent-soft); color: var(--accent-ink); }
.badge.plain { background: #eef0f3; color: var(--muted); }

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  .layout { display: block; }
  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  main { padding: 0 1.5rem 3rem; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ---------- Print ---------- */

@media print {
  :root { --line: #cccccc; }

  .sidebar, .topbar, .pager { display: none !important; }
  .layout { display: block; }
  main { padding: 0; }
  article { max-width: none; }

  body { font-size: 10.5pt; line-height: 1.5; color: #000; }

  @page { margin: 2cm; }

  h1 { font-size: 20pt; }
  h2 { font-size: 14pt; break-after: avoid; }
  h3, h4 { break-after: avoid; }

  pre, table, .callout, .card, .cover { break-inside: avoid; }

  a { color: inherit; text-decoration: none; }

  .cover {
    background: none;
    color: #000;
    border: 2px solid #000;
  }
  .cover h1, .cover p, .cover .cover-kicker { color: #000; }

  pre { background: #f2f2f2; border-color: #ccc; }
  code { background: none; padding: 0; }

  .card { border-color: #ccc; }
}

/* Site footer (2026-07-25) */
.site-footer{margin-top:3rem;padding:1.25rem 0 0.5rem;border-top:1px solid var(--border,#e5e2dc);display:flex;justify-content:space-between;flex-wrap:wrap;gap:0.5rem;font-size:0.85rem;color:var(--muted,#78716c)}
.site-footer a{color:inherit}

/* Release stamp — which build of the product this manual describes. Pinned to
   the bottom of the sidebar: available without being in the way. Written by
   scripts/stamp-manual-version.mjs during the wrap, never by hand — a version
   string maintained by hand across fourteen pages is one that goes wrong. */
.sidebar { display: flex; flex-direction: column; }
.sidebar nav { flex: 1 0 auto; }

.build-stamp {
  margin-top: 2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.build-stamp .stamp-row { display: flex; justify-content: space-between; gap: 0.75rem; }
.build-stamp .stamp-label { text-transform: uppercase; letter-spacing: 0.06em; }
