/* Shared by every page: base reset, colour tokens for both themes, the site bar and the home page.
   Each analysis page loads its own /p/<page>.css after this one; both use the same token names, so
   the light/dark switch (data-theme on <html>) recolours the whole page. */

/* Self-hosted web fonts (SIL Open Font License 1.1): Golos Text (Paratype) and IBM Plex Mono (IBM).
   Cyrillic and Latin subsets from Google Fonts; the CSP allows only same-origin fonts. */
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/assets/fonts/golos-text-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/assets/fonts/golos-text-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f6f7f9; --surface: #ffffff; --fg: #1b2230; --muted: #5d6779; --line: #dde1e8;
  --accent: #1f4fa3; --accent-soft: #e6edf9;
  --font-body: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151c; --surface: #181e27; --fg: #e5e9f0; --muted: #98a2b3; --line: #2a3240;
  --accent: #8fb3ff; --accent-soft: #1d2a44; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #181e27; --fg: #e5e9f0; --muted: #98a2b3; --line: #2a3240;
  --accent: #8fb3ff; --accent-soft: #1d2a44; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

/* The page's gutter lives on .page, not on body, so the site bar runs edge to edge. The page
   stylesheets give body its own padding; this cancels it (the site bar sits inside body). */
body.pg-index, body[class^="pg-"] { padding: 0 !important; }
.page { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 28px 48px; }

/* Site bar: brand, the sections (scrolls sideways on a phone), the theme switch. */
.sitebar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); }
.sitebar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px; min-height: 52px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.sitebar-brand { font-weight: 700; font-size: 15px; color: var(--fg); text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.sitebar-nav { position: relative; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.sitebar-nav::-webkit-scrollbar { display: none; }
.sitebar-nav a { color: var(--muted); text-decoration: none; font-size: 13.5px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.sitebar-nav a:hover { color: var(--fg); background: var(--bg); }
.sitebar-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sitebar-theme { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; }
.sitebar-theme:hover { background: var(--bg); }
.sitebar-theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sitebar-theme .ic-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sitebar-theme .ic-sun { display: block; }
  :root:not([data-theme="light"]) .sitebar-theme .ic-moon { display: none; } }
:root[data-theme="dark"] .sitebar-theme .ic-sun { display: block; }
:root[data-theme="dark"] .sitebar-theme .ic-moon { display: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Home page. */
.home { max-width: 1240px; margin: 0 auto; display: grid; gap: 36px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 36px 56px; }
.home h1, .home h2 { margin: 0; text-wrap: balance; }
.home-hero { display: grid; gap: 14px; }
.home .eyebrow { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.home h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em; max-width: 22ch; }
.home .lead { margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted); max-width: 68ch; }
.home-facts { margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.home-facts > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.home-facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.home-facts dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.35rem; }
.home-group { display: grid; gap: 14px; }
.home h2 { font-size: 1.1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: grid; gap: 6px; align-content: start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: var(--fg); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { font-weight: 600; font-size: 15.5px; }
.card-text { color: var(--muted); font-size: 14px; line-height: 1.45; }
.home-foot { color: var(--muted); font-size: 13px; display: grid; gap: 4px; max-width: 90ch; }
.home-foot p { margin: 0; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* "i" detail: a small circled i next to a heading, figure or label; clicking it opens a panel
   with the detail (method, sources, legal references). Plain <details>, so it needs no script;
   site/assets/site.js only closes other open panels and keeps the panel inside the viewport.
   Markup:
   <details class="info"><summary aria-label="Детальніше"></summary><div class="info-body">...</div></details> */
.info { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; line-height: 1; }
.info > summary { list-style: none; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted);
  color: var(--muted); display: inline-grid; place-items: center; font: 600 11px/1 var(--font-body); font-style: italic; user-select: none; }
.info > summary::-webkit-details-marker { display: none; }
.info > summary::after { content: "i"; }
.info > summary:hover, .info[open] > summary { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.info > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.info-body { position: absolute; z-index: 30; top: calc(100% + 8px); left: -8px; width: max-content; max-width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14); font: 400 13.5px/1.5 var(--font-body); letter-spacing: normal; text-transform: none;
  text-align: left; white-space: normal; display: grid; gap: 6px; }
.info-body p, .info-body ul { margin: 0; }
.info-body ul { padding-left: 18px; }
.info-body .ref { color: var(--muted); font-size: 12.5px; }
.info-body a { color: var(--accent); }
