/* SAPIENT Helpdesk. Dark by default, light when the OS asks for it.
   All text/background pairs below meet WCAG 2.2 AA (most meet AAA). */

/* IBM Plex Sans and IBM Plex Mono, Latin subset, self-hosted (SIL OFL 1.1,
   see /fonts/OFL-*.txt). From @fontsource/ibm-plex-sans and
   @fontsource/ibm-plex-mono 5.3.0. Only the weights below are used. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #0b0c0d;
  --surface: #131517;
  --surface-2: #1a1d20;
  --border: #2c3136;
  --text: #e9ebee;
  --muted: #a7adb5;
  --link: #e9ebee;
  --accent: #f0b429;        /* focus rings and small markers only */
  --code-bg: #101214;
  --ok: #7fd18b;
  --bad: #ff8f8f;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 70ch;
  --radius: 6px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --surface-2: #f2f3f4;
    --border: #d4d7db;
    --text: #15171a;
    --muted: #4f565e;
    --link: #15171a;
    --accent: #9a6700;
    --code-bg: #f4f5f6;
    --ok: #1d6b2b;
    --bad: #a3171b;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--font);
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-inline: clamp(1rem, 4vw, 2rem); }

/* Links: always underlined in body text so they don't rely on colour. */
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: var(--muted); }
a:hover { text-decoration-color: currentColor; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; padding: 0.6rem 1rem; background: var(--text); color: var(--bg); font-weight: 600; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem; padding-block: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand-mark { width: 2rem; height: 2rem; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.8125rem; color: var(--muted); }
.nav-list { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; list-style: none; font-size: 0.9375rem; }
.nav-list li { margin: 0; }
.nav-list a { display: inline-block; padding-block: 0.35rem; text-decoration: none; color: var(--muted); }
.nav-list a:hover { color: var(--text); text-decoration: underline; }
.nav-list a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* Typography */
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); margin: 0 0 1rem; }
h2 { font-size: 1.5rem; margin: 3rem 0 0.75rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
h3 { font-size: 1.125rem; margin: 2rem 0 0.5rem; }
p, ul, ol, dl, table, pre, .callout { margin: 0 0 1.1rem; }
li + li { margin-top: 0.35rem; }
strong { font-weight: 600; }
.lede { font-size: 1.25rem; color: var(--muted); max-width: 46rem; }
.eyebrow { margin: 0 0 0.5rem; font: 600 0.8125rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.muted { color: var(--muted); }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { padding: 0.1em 0.35em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; overflow-wrap: anywhere; }
kbd { padding: 0.05em 0.35em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }
pre { padding: 1rem 1.1rem; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; line-height: 1.5; tab-size: 4; }
pre code { font-size: 0.875rem; }
figure { margin: 0 0 1.25rem; }
figcaption { font-size: 0.875rem; color: var(--muted); margin: 0 0 0.4rem; font-family: var(--mono); }

/* Page layout */
.page { padding-block: clamp(2.5rem, 6vw, 4.5rem) 4rem; }
.page-head { max-width: 50rem; margin-bottom: 2rem; }
.prose { max-width: var(--measure); }
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.with-toc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
@media (min-width: 62rem) {
  .with-toc { grid-template-columns: minmax(0, 1fr) 15rem; gap: 4rem; }
  .toc { position: sticky; top: 1.5rem; align-self: start; order: 2; }
}
.toc { font-size: 0.9375rem; border-left: 2px solid var(--border); padding-left: 1rem; }
.toc h2 { font-size: 0.8125rem; font-weight: 600; margin: 0 0 0.5rem; padding: 0; border: 0; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc a { text-decoration: none; color: var(--muted); }
.toc a:hover { color: var(--text); text-decoration: underline; }

/* Hero */
.hero { padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(2.4rem, 1.5rem + 4vw, 4rem); margin-bottom: 0.25rem; }
.hero .subtitle { font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); font-weight: 500; margin: 0 0 1.25rem; color: var(--muted); }
.hero .lede { color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.button { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.6rem 1.15rem; border: 1px solid var(--text); border-radius: var(--radius); font-weight: 600; text-decoration: none; }
.button-primary { background: var(--text); color: var(--bg); }
.button-primary:hover { background: transparent; color: var(--text); text-decoration: none; }
.button-secondary { color: var(--text); }
.button-secondary:hover { background: var(--surface-2); text-decoration: none; }

/* Cards */
.section { padding-block: 3.5rem; }
.section + .section { border-top: 1px solid var(--border); }
.section > .wrap > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: 1rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.cards > li { margin: 0; }
.card { position: relative; display: flex; flex-direction: column; height: 100%; padding: 1.4rem 1.4rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card:hover { border-color: var(--muted); }
.card h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.card h3 a { text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable, one link */
.card p { color: var(--muted); }
.card ul { margin: auto 0 0; padding: 0.9rem 0 0; list-style: none; border-top: 1px solid var(--border); font: 0.8125rem/1.5 var(--mono); color: var(--muted); }
.card ul li { margin: 0; }
.card .tag { font: 600 0.75rem/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.75rem; }

.audience { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1.5rem 2rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.audience li { margin: 0; padding-left: 1rem; border-left: 2px solid var(--border); }
.audience strong { display: block; }
.audience span { color: var(--muted); font-size: 0.9375rem; }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 3rem; margin: 0 0 1.75rem; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0.05rem; width: 2rem; height: 2rem; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; font: 600 0.875rem/1 var(--mono); color: var(--text); background: var(--surface); }
.steps .h3-like { font-size: 1.25rem; margin: 0.1rem 0 0.6rem; padding: 0; border: 0; }

/* Callouts */
.callout { padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin-bottom: 0.3rem; }

/* Tables */
.table-scroll { overflow-x: auto; margin-bottom: 1.25rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
th { font-weight: 600; }
thead th { border-bottom-color: var(--muted); }
td:first-child code { white-space: nowrap; overflow-wrap: normal; } /* short labels: never split mid-word */
caption { text-align: left; font-size: 0.875rem; color: var(--muted); padding-bottom: 0.5rem; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
@media (max-width: 34rem) { dl.facts { grid-template-columns: 1fr; gap: 0.1rem; } dl.facts dd { margin-bottom: 0.6rem; } }

.layers { list-style: none; padding: 0; }
.layers > li { padding: 1rem 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin: 0 0 0.6rem; }
.layers .layer-name { font-weight: 600; }
.layers .layer-q { color: var(--muted); }

.placeholder { display: inline-block; padding: 0.1rem 0.45rem; border: 2px dashed var(--accent); border-radius: 4px; font-size: 0.875rem; font-weight: 600; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.download-pick { margin: 1.5rem 0; }
.download-pick .actions { margin: 0 0 0.6rem; }
.download-pick .muted { font-size: 0.9375rem; }
.pass { color: var(--ok); }
.fail { color: var(--bad); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); font-size: 0.9375rem; color: var(--muted); background: var(--surface); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 2rem; padding-block: 2.5rem 1.5rem; }
.footer-grid > div:first-child { grid-column: span 2; max-width: 34rem; }
@media (max-width: 40rem) { .footer-grid > div:first-child { grid-column: auto; } }
.footer-brand { color: var(--text); font-weight: 700; margin-bottom: 0.4rem; }
.footer-heading { font-size: 0.8125rem; font-weight: 600; margin: 0 0 0.6rem; padding: 0; border: 0; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.footer-base { padding-block: 1rem 2rem; border-top: 1px solid var(--border); font-size: 0.8125rem; }
.footer-base p { margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header nav, .skip-link, .toc { display: none; }
  body { background: #fff; color: #000; }
}
