/* Layout: a reference-book app. Header with search, a filter bar,
   then a term index (left) beside the open entry (right).
   Track colors follow the four twisted pairs of an Ethernet cable (T568B). */
:root {
  --bg: #F2F4F7;
  --surface: #FFFFFF;
  --sunk: #E8ECF1;
  --line: #D2D9E2;
  --fg: #19212C;
  --muted: #566273;
  --faint: #8792A2;
  --ink: #19212C;
  --on-ink: #FFFFFF;
  --wire-white: #F4F1EA;
  --c-I: #2A62C4;   /* blue:   IT foundations */
  --c-A: #0E8A94;   /* teal:   network & sys admin */
  --c-S: #C2600F;   /* amber:  cybersecurity */
  --c-P: #7A41C9;   /* violet: programming & web */
  --c-C: #2E8B4F;   /* green:  cloud & devops */
  --ok: #1E8558;
  --bad: #BF3A2F;
  --vbox: #FFFFFF;
  --vline: #8D99A8;
  --tbg: #18202A;
  --tbar: #232D3A;
  --tfg: #DDE4EC;
  --tmuted: #8995A5;
  --tcmd: #9BE0B3;
  --tnote: #E8C27A;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E131A; --surface: #151C26; --sunk: #1B2430; --line: #2A3546; --fg: #E6EBF1; --muted: #A2AEBD; --faint: #6E7B8C;
    --ink: #E6EBF1; --on-ink: #0E131A; --wire-white: #D9D4CA;
    --c-I: #77A3F2; --c-A: #3FC2CE; --c-S: #F2A64F; --c-P: #B394F2; --c-C: #5CC487; --ok: #52C48F; --bad: #F2786E;
    --vbox: #19212D; --vline: #5E6B7C; --tbg: #0A0E13; --tbar: #141B24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E131A; --surface: #151C26; --sunk: #1B2430; --line: #2A3546; --fg: #E6EBF1; --muted: #A2AEBD; --faint: #6E7B8C;
  --ink: #E6EBF1; --on-ink: #0E131A; --wire-white: #D9D4CA;
  --c-I: #77A3F2; --c-A: #3FC2CE; --c-S: #F2A64F; --c-P: #B394F2; --c-C: #5CC487; --ok: #52C48F; --bad: #F2786E;
  --vbox: #19212D; --vline: #5E6B7C; --tbg: #0A0E13; --tbar: #141B24;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
code { font-family: var(--font-mono); font-size: 0.88em; background: var(--sunk); padding: 0.08em 0.35em; border-radius: 5px; overflow-wrap: anywhere; }

.tr-I { --tc: var(--c-I); } .tr-A { --tc: var(--c-A); } .tr-S { --tc: var(--c-S); } .tr-P { --tc: var(--c-P); } .tr-C { --tc: var(--c-C); }

/* ---------- header ---------- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in {
  max-width: 1440px; margin: 0 auto; box-sizing: border-box;
  padding-block: 14px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 14px 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.plug { display: flex; gap: 2px; padding: 5px 6px 9px; border-radius: 6px 6px 4px 4px; background: var(--sunk); border: 1px solid var(--line); flex: none; }
.wire { width: 4px; height: 26px; border-radius: 2px 2px 0 0; background: var(--wc); }
.wire.s { background: repeating-linear-gradient(160deg, var(--wc) 0 3px, var(--wire-white) 3px 7px); }
.brand h1 { font-family: var(--font-display); font-weight: 800; font-size: 1.65rem; line-height: 1; letter-spacing: -0.02em; margin: 0; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.3; }
.search { flex: 1 1 340px; position: relative; max-width: 640px; margin-left: auto; }
.search input {
  width: 100%; box-sizing: border-box; height: 48px; padding: 0 84px 0 44px;
  border: 1.5px solid var(--line); border-radius: 24px; background: var(--bg); font-size: 1rem;
}
.search input:focus { outline: 2.5px solid var(--ink); outline-offset: 2px; border-color: var(--ink); background: var(--surface); }
.search svg { position: absolute; left: 15px; top: 14px; width: 20px; height: 20px; color: var(--muted); }
.search kbd { position: absolute; right: 16px; top: 13px; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; background: var(--surface); }
.search .clear { position: absolute; right: 8px; top: 7px; height: 34px; padding: 0 12px; border: 0; border-radius: 17px; background: var(--sunk); cursor: pointer; font-size: 0.85rem; }

/* ---------- filters ---------- */
.filters { border-bottom: 1px solid var(--line); background: var(--surface); }
.filters-in {
  max-width: 1440px; margin: 0 auto; box-sizing: border-box; padding-block: 10px 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 8px;
}
.frow { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.flabel { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); min-width: 52px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  border: 1.5px solid var(--line); border-radius: 17px; background: var(--surface);
  cursor: pointer; font-size: 0.9rem; white-space: nowrap;
}
.chip:hover { border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.chip .n { font-size: 0.76rem; opacity: 0.7; font-variant-numeric: tabular-nums; }
.sw { width: 13px; height: 13px; border-radius: 50%; flex: none; background: repeating-linear-gradient(135deg, var(--tc) 0 3px, var(--wire-white) 3px 5.5px); box-shadow: 0 0 0 1.5px var(--tc) inset; }
.sw.all { background: conic-gradient(var(--c-I) 0 20%, var(--c-A) 0 40%, var(--c-S) 0 60%, var(--c-P) 0 80%, var(--c-C) 0); box-shadow: none; }
.spacer { flex: 1; }
.sortsel { height: 34px; border: 1.5px solid var(--line); border-radius: 17px; background: var(--surface); padding: 0 12px; cursor: pointer; }

/* signal-strength style level icon */
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; flex: none; }
.sig i { width: 3.5px; background: currentColor; opacity: 0.22; border-radius: 1px; }
.sig i:nth-child(1) { height: 5px; } .sig i:nth-child(2) { height: 9px; } .sig i:nth-child(3) { height: 13px; }
.sig.l1 i:nth-child(1), .sig.l2 i:nth-child(-n+2), .sig.l3 i { opacity: 1; }

/* ---------- main layout ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); max-width: 1440px; width: 100%; margin: 0 auto; box-sizing: border-box; }
.list-pane { overflow-y: auto; border-right: 1px solid var(--line); min-height: 0; scroll-padding-top: 48px; } /* the selected term scrolls into view below the sticky count bar, not under it */
.detail-pane { overflow-y: auto; min-height: 0; }
.count { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 10px 18px; font-size: 0.85rem; color: var(--muted); border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.group-h { padding: 14px 18px 6px; font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.group-h .sw { width: 11px; height: 11px; }
.item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: start;
  width: 100%; text-align: left; padding: 10px 18px; border: 0; border-left: 3px solid transparent; background: none; cursor: pointer;
}
.item:hover { background: var(--surface); }
.item[aria-current="true"] { background: var(--surface); border-left-color: var(--tc); }
.item .sw { margin-top: 5px; }
.it-name { display: block; font-weight: 700; font-size: 0.98rem; line-height: 1.3; }
.it-name mark { background: color-mix(in srgb, var(--tc) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.it-def { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 0.86rem; line-height: 1.4; margin-top: 2px; }
.item .sig { margin-top: 4px; color: var(--muted); }
.empty { padding: 40px 22px; color: var(--muted); }
.empty strong { color: var(--fg); display: block; font-size: 1.05rem; margin-bottom: 6px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 19px; border: 1.5px solid var(--ink); background: var(--ink); color: var(--on-ink); cursor: pointer; font-weight: 700; font-size: 0.9rem; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }

/* ---------- entry ---------- */
.entry { max-width: 820px; box-sizing: border-box; padding-block: 28px 56px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.back { display: none; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tc); margin: 0 0 10px; }
.eyebrow .dim { color: var(--muted); }
.entry h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.05; letter-spacing: -0.025em; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.aka { color: var(--muted); margin: 8px 0 0; font-size: 0.95rem; }
.aka em { font-style: normal; color: var(--fg); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 26px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--sunk); font-size: 0.85rem; color: var(--fg); }
.pill .sig { color: var(--tc); }
.sec { margin: 0 0 24px; }
.sec h3, .figure-h { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.sec p { margin: 0; max-width: 66ch; }
.sec.lead p { font-size: 1.16rem; line-height: 1.55; }
.entry a.tl { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--fg) 35%, transparent); text-decoration-thickness: 1.5px; text-underline-offset: 3px; cursor: pointer; }
.entry a.tl:hover { text-decoration-color: var(--fg); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card h3 { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; display: flex; align-items: center; gap: 7px; }
.card p { margin: 0; }
.card svg.ic { width: 15px; height: 15px; color: var(--tc); }
figure.viz { margin: 0 0 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.viz-scroll { overflow-x: auto; padding: 14px 10px 6px; }
/* Diagrams are drawn 600 units wide. Never narrower than 480 px, so their text stays at 80% or more
   (about 10 px); on narrower screens the diagram scrolls sideways in its own focusable box. */
.viz-scroll svg { display: block; width: 100%; min-width: 480px; max-width: 680px; height: auto; margin: 0 auto; }
figure.viz figcaption { padding: 10px 18px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; background: var(--bg); }
figure.viz figcaption b { color: var(--fg); }
.related { display: flex; flex-wrap: wrap; gap: 8px; }
.rel { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 17px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 0.9rem; }
.rel:hover { border-color: var(--tc); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager button { min-width: 0; max-width: 48%; text-align: left; border: 0; background: none; cursor: pointer; padding: 6px 0; }
.pager button:last-child { text-align: right; margin-left: auto; }
.pager small { display: block; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.pager span { font-weight: 700; overflow-wrap: anywhere; }

/* SVG diagram classes */
.viz svg text { font-family: var(--font-body); }
.viz svg .v-mono { font-family: var(--font-mono); }
.v-t { fill: var(--fg); } .v-m { fill: var(--muted); } .v-acct { fill: var(--tc); }
.v-okt { fill: var(--ok); } .v-badt { fill: var(--bad); }
.v-caps { letter-spacing: 0.08em; text-transform: uppercase; }
.v-box { fill: var(--vbox); stroke: var(--vline); stroke-width: 1.3; }
.v-sunk { fill: var(--sunk); stroke: var(--line); stroke-width: 1; }
.v-acc { fill: color-mix(in srgb, var(--tc) 14%, var(--vbox)); stroke: var(--tc); stroke-width: 1.6; }
.v-acc.v-strong { fill: color-mix(in srgb, var(--tc) 26%, var(--vbox)); stroke-width: 2.2; }
.v-acc2 { fill: color-mix(in srgb, var(--fg) 7%, var(--vbox)); stroke: var(--vline); stroke-width: 1.6; }
.v-note { fill: color-mix(in srgb, var(--tc) 8%, var(--vbox)); stroke: var(--tc); stroke-width: 1; stroke-dasharray: 4 3; }
.v-ln { stroke: var(--vline); stroke-width: 1.8; fill: none; }
.v-ln-strong { stroke: var(--fg); stroke-width: 1.6; }
.v-dash { stroke-dasharray: 6 5; }
.v-lnbad { stroke: var(--bad); }
.v-life { stroke: var(--vline); stroke-width: 1.3; stroke-dasharray: 5 5; }
.v-head { fill: var(--vline); }
.v-axis { stroke: var(--line); stroke-width: 1.5; }
.v-layer { fill: var(--tc); stroke: color-mix(in srgb, var(--tc) 60%, transparent); stroke-width: 1.2; }
.v-layer-hl { stroke: var(--tc); stroke-width: 2.6; }
.v-dot { fill: var(--tc); } .v-dott { fill: var(--surface); }
.v-badge { fill: var(--surface); stroke: var(--vline); stroke-width: 1.4; }
.v-bar { fill: color-mix(in srgb, var(--tc) 55%, var(--vbox)); }
.v-bar-hl { fill: var(--tc); }
.v-band { fill: var(--tc); }
.v-bandframe { fill: none; stroke: var(--tc); stroke-width: 1.5; }
.v-mark { fill: var(--fg); }
.v-zone { fill: color-mix(in srgb, var(--tc) 5%, transparent); stroke: color-mix(in srgb, var(--tc) 55%, var(--line)); stroke-width: 1.4; stroke-dasharray: 7 5; }
.v-tag { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.v-badbox { fill: color-mix(in srgb, var(--bad) 13%, var(--vbox)); stroke: var(--bad); stroke-width: 1.6; }
.v-okbox { fill: color-mix(in srgb, var(--ok) 13%, var(--vbox)); stroke: var(--ok); stroke-width: 1.6; }
.v-ok { fill: color-mix(in srgb, var(--ok) 13%, var(--vbox)); stroke: var(--ok); stroke-width: 1.4; }
.v-no { fill: color-mix(in srgb, var(--bad) 11%, var(--vbox)); stroke: var(--bad); stroke-width: 1.4; }
.v-tri { fill: color-mix(in srgb, var(--tc) 7%, transparent); stroke: var(--tc); stroke-width: 2; stroke-dasharray: 2 0; }
.v-ring { fill: var(--tc); stroke: var(--tc); stroke-width: 1.2; stroke-opacity: 0.7; }
.v-term { fill: var(--tbg); } .v-termbar { fill: var(--tbar); } .v-tdot { fill: var(--tmuted); opacity: 0.6; }
.v-tmuted { fill: var(--tmuted); } .v-tcmd { fill: var(--tcmd); } .v-tout { fill: var(--tfg); } .v-tnote { fill: var(--tnote); font-style: italic; }

/* ---------- home panel ---------- */
.home { max-width: 860px; box-sizing: border-box; padding-block: 34px 56px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.home h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 3.6vw, 2.6rem); letter-spacing: -0.025em; line-height: 1.08; margin: 0 0 12px; text-wrap: balance; }
.home > p { color: var(--muted); max-width: 62ch; margin: 0 0 26px; font-size: 1.05rem; }
.home h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 30px 0 12px; }
.tracks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.track-card { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
.track-card:hover { border-color: var(--tc); }
.track-card .sw { width: 18px; height: 18px; margin-top: 3px; grid-row: span 2; }
.track-card b { font-family: var(--font-display); font-size: 1.1rem; }
.track-card b small { font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-left: 6px; }
.track-card span { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.howto div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 0.92rem; color: var(--muted); }
.howto b { display: block; color: var(--fg); margin-bottom: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 0.88rem; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
details.add { margin-top: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.add summary { cursor: pointer; padding: 14px 18px; font-weight: 700; }
details.add > div { padding: 0 18px 18px; color: var(--muted); font-size: 0.92rem; }
details.add pre { background: var(--tbg); color: var(--tfg); font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.55; padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: 10px 0; }
.m-only { display: none; }

/* ---------- narrow or short screens: one pane at a time ----------
   Phones, small tablets and short windows (a landscape phone, a laptop at 150% zoom) stack the
   index and the entry instead of squeezing two scrolling panes side by side.
   app.js uses the same media query (STACKED). */
@media (max-width: 880px), (max-height: 560px) {
  html, body { height: auto; }
  body { display: block; }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
  .top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
  .layout { display: block; }
  .list-pane { border-right: 0; overflow: visible; }
  .count { position: static; }
  .detail-pane { position: fixed; inset: 0; z-index: 20; background: var(--bg); transform: translateX(100%); visibility: hidden; transition: transform 0.22s ease, visibility 0s 0.22s; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .detail-pane.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
  .detail-pane .home { display: none; }
  .entry { margin-inline: auto; padding-block: 0 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .back { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 3; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 18px; padding: 12px max(16px, env(safe-area-inset-left, 0px)); width: calc(100% + 2 * max(16px, env(safe-area-inset-left, 0px))); background: var(--bg); border: 0; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 700; text-align: left; }
  .m-only { display: block; }
  .m-intro { padding: 16px max(16px, env(safe-area-inset-left, 0px)) 4px; }
  .m-intro p { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; }
  .m-intro .related { margin-bottom: 6px; }
}
/* narrow screens: one column, a full-width search box, and filter chips that scroll sideways */
@media (max-width: 880px) {
  .brand p { display: none; }
  .search { flex-basis: 100%; margin-left: 0; max-width: none; }
  .search kbd { display: none; }
  .frow { flex-wrap: nowrap; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; min-width: 0; }
  .chips::-webkit-scrollbar { display: none; }
  .flabel { min-width: 0; }
  .pair { grid-template-columns: 1fr; }
  .tracks, .howto { grid-template-columns: 1fr; }
}
/* short windows (a landscape phone, or 400% zoom): the header scrolls away with the page
   instead of covering a large share of the screen */
@media (max-height: 500px) {
  .top { position: static; }
  body::before { display: none; }
}
/* touch screens: controls at least 44 px tall; mouse and keyboard sizes are unchanged */
@media (pointer: coarse) {
  .chip, .rel, .sortsel, .btn, .site-nav a, .pill.bm-btn, a.brand { min-height: 44px; }
  .search input { height: 52px; }
  .search svg { top: 16px; }
  .search .clear { top: 4px; height: 44px; }
  /* filter chips stay on one line and scroll sideways, as on phones, so a tablet keeps tall panes */
  .frow { flex-wrap: nowrap; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; min-width: 0; }
  .chips::-webkit-scrollbar { display: none; }
  .flabel { min-width: 0; }
}
/* very narrow screens: a tighter header, so it covers less of the page while it stays on screen */
@media (max-width: 360px) { .top-in { padding-block: 8px; row-gap: 8px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
/* Skip link (both pages) */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 10px; }
main[tabindex="-1"]:focus { outline: none; } /* the skip link's target is a container, not a control */
/* Windows High Contrast and other forced-colors modes remove backgrounds and shadows,
   so selected states and focus are shown with system colors instead */
@media (forced-colors: active) {
  :focus-visible, .search input:focus, .cmd-line:focus-within, .term-in:focus-within { outline: 3px solid Highlight; outline-offset: 2px; }
  [aria-pressed="true"], .toc a[aria-current="page"], .tick.on { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
}

/* ---------- site navigation, sources and bookmarks (shared with learn.html) ---------- */
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border-radius: 20px; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 0.95rem; }
.site-nav a:hover { background: var(--sunk); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.top-in > .site-nav { order: 3; flex-basis: 100%; }
.entry .srcs { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.entry .srcs li { margin: 2px 0; }
.entry .srcs.open-h { margin: 10px 0 2px; padding: 0; font-weight: 700; color: var(--fg); }
.pill.bm-btn { border: 0; cursor: pointer; }
.pill.bm-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--c-S) 18%, var(--sunk)); }
@media (min-width: 881px) {
  .top-in > .site-nav { order: 0; flex-basis: auto; gap: 2px; }
  /* compact on the dictionary so brand, links and search still share one row */
  .top-in > .brand + .site-nav a { padding: 0 10px; font-size: 0.88rem; height: 36px; }
}
@media (max-width: 880px) {
  .site-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: 1 1 auto; justify-content: center; padding: 0 10px; white-space: nowrap; font-size: 0.9rem; height: 38px; }
}
/* very narrow screens and 400% zoom: wrap the links instead of hiding some off-screen */
@media (max-width: 360px) { .site-nav { flex-wrap: wrap; overflow-x: visible; } }
/* Footer with the creator credit (both pages). On the wide dictionary layout it is a thin
   strip under the two panes; elsewhere it follows the page. */
.site-foot { flex: none; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.8rem; line-height: 1.4; text-align: center; padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.site-foot p { margin: 0; }
/* Accessibility: in light mode the teal, amber and green track colors are too light
   for small text (3.8-4.3:1, WCAG AA needs 4.5:1), so the track label is darkened
   (5.8:1 or better). Dark mode keeps the original colors, which already pass. */
.eyebrow { color: color-mix(in srgb, var(--tc) 76%, #000); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eyebrow { color: var(--tc); } }
:root[data-theme="dark"] .eyebrow { color: var(--tc); }
@media (min-width: 881px) and (max-width: 1199px) { .top-in:has(> .site-nav) .brand p { display: none; } }
