/* ATLAS. A catalog, not a landing page: the job is finding one entry among many,
   so density and scannability outrank spectacle. One accent, and it means exactly
   one thing: this is the string you type. */
:root {
  --bg: #0b0c0e;
  --surface: #121316;
  --surface-2: #17181c;
  --border: rgba(255, 255, 255, .08);
  --border-soft: rgba(255, 255, 255, .05);
  --ink: #ecebe7;
  --ink-2: #a9a69e;
  --ink-3: #8a867c;
  --accent: #58a6a0;
  --accent-dim: #2f5f5c;
  --infra: #b08025;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  --lblw: 62px; /* card label column; labelled lines hang at --lblw + 8px gap */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 60px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 24px; top: 12px; z-index: 20; background: var(--accent); color: #06110f; padding: 8px 14px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* masthead: a catalog header, not a landing hero. Identity and the trust line,
   then out of the way; the entries are the page. */
.masthead { padding: 34px 0 22px; border-bottom: 1px solid var(--border-soft); }
.eyebrow { display: flex; align-items: center; gap: 10px; font: 600 11px/1 var(--mono); letter-spacing: .18em; color: var(--ink-3); }
.mark { width: 8px; height: 8px; background: var(--accent); border-radius: 2px; }
.masthead h1 { margin-top: 12px; font-size: clamp(23px, 2.4vw, 32px); font-weight: 620; letter-spacing: -.02em; line-height: 1.12; }
.sub { margin-top: 8px; max-width: 74ch; color: var(--ink-2); font-size: 15px; }
/* the trust line: same mono label + value pattern as the card faces */
.stats { display: flex; flex-wrap: wrap; gap: 8px 26px; margin-top: 16px; }
.stats div { display: flex; align-items: baseline; gap: 8px; }
.stats dt { font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { font: 600 14px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* one sticky toolbar: orientation (group nav) and narrowing (filter) share a band
   instead of stacking two bands of chrome between the masthead and the catalog */
.toolbar { position: sticky; top: -56px; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-soft); }
.toolbar .wrap { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; padding-bottom: 10px; }
.groupnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.groupnav::-webkit-scrollbar { display: none; }
.groupnav a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-size: 13px; white-space: nowrap; }
.groupnav a:hover { background: var(--surface-2); color: var(--ink); }
.groupnav a .n { font: 500 11px var(--mono); color: var(--ink-3); }
/* scrollspy: the nav answers "where am I" while the eye runs down the page */
.groupnav a[aria-current="true"] { background: var(--surface-2); color: var(--ink); }
.groupnav a[aria-current="true"] .n { color: var(--ink-2); }

/* filter: narrow screens put it on the toolbar's top row; the negative sticky top
   above lets that row scroll away so only the slim nav row stays pinned */
.filterbar { order: -1; position: relative; height: 40px; }
#filter { -webkit-appearance: none; appearance: none; width: 100%; height: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0 92px 0 12px; color: var(--ink); font: 14px var(--sans); }
#filter::placeholder { color: var(--ink-3); }
#filter:focus { outline: none; border-color: var(--accent-dim); }
#filter::-webkit-search-cancel-button { -webkit-appearance: none; }
.hits { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11px/1.2 var(--mono); color: var(--ink-3); }
/* the "/" keycap teaches the shortcut; it yields to the hit count and to focus */
.key { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); padding: 3px 7px; border: 1px solid var(--border); border-radius: 4px; font: 500 11px/1 var(--mono); color: var(--ink-3); }
.filterbar:focus-within .key, .hits:not(:empty) + .key { display: none; }

/* wide screens: nav wraps fully (a map with offscreen regions is no map) and the
   filter docks right, matching the nav pill height; the whole toolbar stays pinned */
@media (min-width: 900px) {
  .toolbar { top: 0; }
  .toolbar .wrap { flex-direction: row; align-items: flex-start; gap: 16px; }
  .groupnav { flex: 1 1 auto; flex-wrap: wrap; overflow: visible; }
  .filterbar { order: 0; flex: 0 0 260px; margin-left: auto; height: 33px; }
  html { scroll-padding-top: 104px; }
}

/* groups */
.group { padding-top: 40px; }
/* the first group needs no section-break distance from the toolbar */
.group:first-of-type { padding-top: 24px; }
.group-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.group-head .tag { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.group-head .count { margin-left: auto; font: 500 12px var(--mono); color: var(--ink-3); }

/* auto-fit, not auto-fill: a group with fewer entries than columns lets its cards
   widen instead of leaving a dead track at the top of the catalog */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 14px 16px 15px; }
/* face order = the page's promise: what (title), how invoked (accent string), why
   (short form), then the use-when scan signal; contrast steps down with each line */
.what { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; line-height: 1.45; }
.card-inv { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.inv { font: 600 14px var(--mono); color: var(--accent); }
.inv-infra { color: var(--infra); }
.kind { font: 500 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--border); border-radius: 4px; padding: 3px 6px; }
.why { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.when { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.line { margin-top: 9px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
/* hanging indent: continuation lines align with the text column, not the label */
.why, .when, .line { padding-left: calc(var(--lblw) + 8px); text-indent: calc(-1 * (var(--lblw) + 8px)); }
.lbl { display: inline-block; min-width: var(--lblw); margin-right: 8px; text-indent: 0; font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); vertical-align: 1px; }
.inferred { margin-left: 8px; font: 500 9px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px dotted var(--ink-3); cursor: help; }

/* the mechanism stays on the page but folded: scan first, read on demand */
.mech { margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.mech summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font: 500 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.mech summary::-webkit-details-marker { display: none; }
.mech summary::before { content: ""; flex: 0 0 auto; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 150ms cubic-bezier(.25, 1, .5, 1); }
.mech[open] summary::before { transform: rotate(45deg); }
.mech summary:hover { color: var(--ink-2); }
.mech summary:focus-visible { outline: 1px solid var(--accent-dim); outline-offset: 3px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .mech summary::before { transition: none; } }

.card[hidden] { display: none; }
.group[hidden] { display: none; }

.site-footer { padding: 36px 24px 64px; margin-top: 40px; border-top: 1px solid var(--border-soft); color: var(--ink-3); font-size: 13px; }
.site-footer time { font: 500 12px var(--mono); color: var(--ink-2); }

/* print: chrome off, every mechanism expanded (app.js opens the details on beforeprint) */
@media print {
  .toolbar { display: none; }
  .mech summary::before { display: none; }
}

@media (max-width: 640px) {
  .masthead { padding: 26px 0 18px; }
  .stats { gap: 8px 20px; margin-top: 14px; }
  .cards { grid-template-columns: 1fr; }
  :root { --lblw: 54px; }
  /* narrow screens: heading and count share the first row, tagline drops below,
     so the longer English group names never wrap into the tagline */
  .group-head { flex-wrap: wrap; }
  .group-head .tag { flex-basis: 100%; order: 3; margin-top: 2px; }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf9f5; --surface: #ffffff; --surface-2: #f1efe9;
    --border: rgba(0, 0, 0, .12); --border-soft: rgba(0, 0, 0, .08);
    --ink: #16150f; --ink-2: #4c4a42; --ink-3: #6a675e;
    --accent: #2f6f6a; --accent-dim: #9ac4c0; --infra: #7a5714;
  }
  .skip:focus { color: #fff; }
}
