/* Frontier. Plain, dense, readable. No webfonts, no scripts. */

:root {
  /* Light theme: dark text on a warm off-white, below the glare of pure black on
     pure white (13.9:1 instead of 17.5:1). The soft dark theme follows the
     reader's system setting, and the header button overrides it; its text stays
     near 10:1, because near-white on near-black (15.7:1) caused halation. */
  --bg: #faf9f6;
  --fg: #24292f;        /* 13.92:1 on bg, 12.83:1 on surface */
  --muted: #57606a;     /* 6.07:1 on bg, 5.59:1 on surface */
  --line: #d8dee4;
  --surface: #eef0f2;
  --link: #066f89;      /* brand key #0891b2 darkened, same hue: 5.48:1 on bg, 5.05:1 on surface */
  --accent: #0891b2;    /* brand key: bars, focus rings, non-text marks (3.50:1 on bg) */
  --band: #080b10;      /* brand base: header band, same as the icon background */
  --band-fg: #e1e6ea;
  --band-link: #cbd1d6; /* brand curve gray */
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #1d2228;
  --fg: #c5ccd3;        /* 9.87:1 on bg, 8.46:1 on surface */
  --muted: #929ca6;     /* 5.74:1 on bg, 4.92:1 on surface */
  --line: #353d46;
  --surface: #272e36;
  --link: #5bbcd6;      /* brand key lightened, same hue: 7.33:1 on bg, 6.28:1 on surface */
  --accent: #0891b2;    /* 4.35:1 on bg, non-text marks only */
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.wrap { max-width: 50rem; margin: 0 auto; padding: 0 1rem; }

a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, video:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header band */
.top { background: var(--band); color: var(--band-fg); border-top: 3px solid var(--accent); border-bottom: 1px solid var(--line); }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; padding-top: .5rem; padding-bottom: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--band-fg); font-weight: 700; font-size: 1.125rem; text-decoration: none; }
.brand img { display: block; border-radius: 4px; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.top nav a { color: var(--band-link); text-decoration: none; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--band-fg); text-decoration: underline; }

main { padding-top: 1rem; padding-bottom: 2rem; }

.crumbs { font-size: .875rem; color: var(--muted); margin: 0 0 .5rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: .25rem 0 .75rem; }
h2 { font-size: 1.1875rem; line-height: 1.3; margin: 2rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
h3 { font-size: 1rem; margin: 1.25rem 0 .25rem; }
p, ul, ol, dl, pre, figure, table { margin-top: 0; margin-bottom: .75rem; }
ul, ol { padding-left: 1.25rem; }
li { margin-bottom: .25rem; }

.muted, .meta, figcaption, .note { color: var(--muted); }
.note { font-size: .875rem; }

code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: .875em; }
code { overflow-wrap: anywhere; }
pre { background: var(--surface); border: 1px solid var(--line); padding: .5rem .75rem; overflow-x: auto; line-height: 1.45; }
pre code { overflow-wrap: normal; font-size: 1em; }

/* Key facts of a test */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; border: 1px solid var(--line); padding: .5rem .75rem; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 34rem) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: .375rem; }
}

/* Tables: scroll inside their own box on narrow screens, never the page */
.table-wrap { overflow-x: auto; margin-bottom: .75rem; }
table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.table-wrap table { margin-bottom: 0; }
table.wide { min-width: 44rem; }
th, td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; vertical-align: top; }
th { background: var(--surface); font-weight: 600; }
td.n, th.n { text-align: right; white-space: nowrap; }

/* Test list on the home page, forum-style */
.topics { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.topics li { border-bottom: 1px solid var(--line); padding: .625rem 0; margin: 0; }
.topics .t { font-weight: 600; }
.topics .meta { display: block; font-size: .875rem; }
.topics p { margin: .25rem 0 0; }

/* Media */
img, video { max-width: 100%; height: auto; }
figure { margin-left: 0; margin-right: 0; }
figure img, figure video { display: block; width: 100%; border: 1px solid var(--line); background: #fafaf8; }
figure video { aspect-ratio: 16 / 9; background: #000; }
figcaption { font-size: .875rem; margin-top: .375rem; }

/* Footer */
.foot { border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.foot .wrap { padding-top: .75rem; padding-bottom: 1.5rem; }
.foot p { margin-bottom: .375rem; }

/* Theme switch in the header */
.theme-toggle { font: inherit; font-size: .875rem; color: var(--band-link); background: transparent; border: 1px solid #3a4550; border-radius: 4px; padding: 0 .5rem; cursor: pointer; }
.theme-toggle:hover, .theme-toggle[aria-pressed="true"] { color: var(--band-fg); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
