/* purepure v2. One immutable stylesheet for every public v2 page, including
   /gpt (its CSP forbids inline styles); the URL carries the file's own
   content hash (search/ui_v2.py). "@bundle" lines mark its parts: base
   (until the first mark: every page), serp, access and pages. The static
   front gives the home page and the results page only the parts they use, in
   this order (ui_v2.CSS_BUNDLES); everything else gets the whole file.
   The look is the purepure design system (docs/branding/purepure: brand
   book, tokens.json, components, mockups): ink on off-white, water blue only
   in the wordmark's u's and the focus ring, pill controls, borders instead
   of shadows. The token names below are the system's own; the few values it
   does not define (visited links, highlights, the ranking bars' negative
   tone, the paid-content label) are marked as product additions.
   Type: DM Sans 700 for the wordmark and headings, Public Sans for
   everything else. Both are self-hosted (no third-party request sees a
   query) and swap in over metric-matched local fallbacks.
   The SERP: filter chips above a 640px results column and a 360px source
   panel, the column aligned with the header's search field. Phones: result
   cards on the sunken ground, the source details in a bottom sheet.
   Hard rule kept from v1: no horizontal scroll at any viewport. */

/* fonts: variable, limited to the weights the design uses; Latin preloaded
   (_shell_head.html), Latin Extended on demand. File names carry the
   content hash (tests/test_ui_v2.py). DM Sans keeps its optical-size axis
   (9-40), so the 116px wordmark and 22px headings each get their cut. */
@font-face {
  font-family: "Public Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/public-sans-latin.f9454fc3.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: "Public Sans"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/public-sans-latin-ext.d349d2ab.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/dm-sans-latin.4f7589ff.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: "DM Sans"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/dm-sans-latin-ext.e04b9c61.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Local fallbacks scaled to the web fonts' widths and heights (Arimo and
   Liberation are the metric twins of Arial). Public Sans: measured on SERP
   text (speed review 2026-09-25). DM Sans: its advance widths over heading
   text at optical sizes 24-30 against Liberation Sans Bold (99%), and its
   ascent 992 and descent 310 per 1000. Android has neither Arial nor
   Liberation, so Roboto gets its own face. */
@font-face {
  font-family: "Public Sans fb"; font-weight: 100 549;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans");
  size-adjust: 105.17%; ascent-override: 90.33%; descent-override: 21.39%; line-gap-override: 0%;
}
@font-face {
  font-family: "Public Sans fb"; font-weight: 550 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold");
  size-adjust: 99.21%; ascent-override: 95.76%; descent-override: 22.68%; line-gap-override: 0%;
}
@font-face {
  font-family: "Public Sans fb2"; src: local("Roboto"), local("Roboto-Regular");
  size-adjust: 105.71%; ascent-override: 89.87%; descent-override: 21.29%; line-gap-override: 0%;
}
@font-face {
  font-family: "DM Sans fb"; font-weight: 700;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold");
  size-adjust: 99%; ascent-override: 100.2%; descent-override: 31.31%; line-gap-override: 0%;
}

/* tokens: docs/branding/purepure/tokens.json, exact values */
:root {
  color-scheme: light dark;
  --surface: #fbfcfd;
  --surface-raised: #ffffff;
  --surface-sunken: #f4f6f8;
  --line: #e1e6eb;
  --line-strong: #86909b;
  --ink: #14181c;
  --ink-muted: #58616a;
  --on-ink: #ffffff;
  --link: #1b4f8f;
  --water: #2f7fd6;
  --water-soft: #e3effb;
  --scrim: rgba(20, 24, 28, 0.45);
  --tag-public-bg: #e3efe7; --tag-public-ink: #1e5a3a;
  --tag-research-bg: #e6ecf7; --tag-research-ink: #23427a;
  --tag-media-bg: #ede8f3; --tag-media-ink: #4b2f72;
  --tag-org-bg: #dff0ee; --tag-org-ink: #175a54;
  --tag-business-bg: #f4ead8; --tag-business-ink: #6b4a12;
  --tag-person-bg: #f7e5eb; --tag-person-ink: #7b2c47;
  --shadow-dialog: 0 8px 28px rgba(20, 24, 28, 0.14);
  /* product additions (not in the design system) */
  --visited: #5c3d86;
  --mark: #fff1b8;
  --neg: #9a4a2e;
  --tag-paid-bg: #f8e3da; --tag-paid-ink: #7a2e0e;
  /* type, space, radius */
  --font-display: "DM Sans", "DM Sans fb", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Public Sans", "Public Sans fb", "Public Sans fb2", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4rem;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 14px; --radius-pill: 999px;
  /* geometry */
  --gutter: max(1rem, env(safe-area-inset-left, 0px));
  --gutter-end: max(1rem, env(safe-area-inset-right, 0px));
  --col: 40rem;
  --panel: 22.5rem;
  --inset: var(--gutter);
  /* the sticky results header's real height: field 46px, padding, border */
  --header-h: calc(4.375rem + 1px + env(safe-area-inset-top, 0px));
  --chips-h: 3.25rem;
}
@media screen and (prefers-color-scheme: dark) {
  :root {
    --surface: #0f1317; --surface-raised: #171c21; --surface-sunken: #0b0e11;
    --line: #273039; --line-strong: #6b7682;
    --ink: #e8edf2; --ink-muted: #a3adb7; --on-ink: #0f1317;
    --link: #8fbbf0; --water: #5aa0ea; --water-soft: #1c3450;
    --scrim: rgba(0, 0, 0, 0.6);
    --tag-public-bg: #16301f; --tag-public-ink: #9fd4b1;
    --tag-research-bg: #18233a; --tag-research-ink: #a9c1ee;
    --tag-media-bg: #261d33; --tag-media-ink: #c8b3ea;
    --tag-org-bg: #12302d; --tag-org-ink: #8fd3cb;
    --tag-business-bg: #33270f; --tag-business-ink: #e6c98a;
    --tag-person-bg: #351a24; --tag-person-ink: #eeaac1;
    --shadow-dialog: 0 8px 28px rgba(0, 0, 0, 0.5);
    --visited: #c3a9ea; --mark: #5c4d12; --neg: #e39a7f;
    --tag-paid-bg: #3f2219; --tag-paid-ink: #f2b59c;
  }
}
@media (min-width: 48rem) {
  :root { --gutter: max(2rem, env(safe-area-inset-left, 0px)); --gutter-end: max(2rem, env(safe-area-inset-right, 0px)); --header-h: calc(5.375rem + 1px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 64rem) {
  :root { --gutter: max(2.5rem, env(safe-area-inset-left, 0px)); --gutter-end: max(2.5rem, env(safe-area-inset-right, 0px)); }
}
/* Wide screens (mockup Results): the results column starts under the
   header's search field, about 190px in; the wordmark's slot fills the rest. */
@media (min-width: 80rem) {
  :root { --inset: 11.875rem; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  font-family: var(--font-text); font-size: 1rem; line-height: 1.55;
  color: var(--ink); background: var(--surface); overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
main { flex: 1 0 auto; width: 100%; min-width: 0; padding-inline: var(--gutter) var(--gutter-end); }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: from-font; }
/* focus-ring: a 2px gap in the page colour, then a solid 2px water ring */
:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; border-radius: var(--radius-sm); }
[hidden] { display: none !important; }
::selection { background: var(--water-soft); color: var(--ink); }
.sr-only {
  position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link, .skip-to {
  position: fixed; inset-block-start: 0.5rem; inset-inline-start: 0.5rem; z-index: 100;
  padding: 0.6rem 0.9rem; border-radius: var(--radius-pill); background: var(--ink); color: var(--on-ink);
  transform: translateY(-160%);
}
.skip-link:focus, .skip-to:focus { transform: none; }
code { font-family: var(--mono); font-size: 0.85em; color: var(--ink-muted); }
button { font: inherit; color: inherit; cursor: pointer; }
strong, b { font-weight: 600; }
mark {
  padding: 0 0.125rem; border-radius: 0.125rem; background: var(--mark); color: inherit;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* the wordmark: live type, water in the two u's. --lvl (0-1) is the water;
   21% of the u's box is the baseline, +44% the x-height (design system,
   Wordmark). The first u holds a little less, as in the component. */
.wordmark {
  --lvl: 0;
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.045em; line-height: 1;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.wordmark.is-low { --lvl: 0.35; }
.wm-u {
  --f: var(--lvl);
  background: linear-gradient(to top, var(--water) 0, var(--water) calc(21% + var(--f) * 44%), var(--ink) calc(21% + var(--f) * 44%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wm-u:first-of-type { --f: calc(var(--lvl) * 0.8); }
a.wordmark:hover { color: var(--ink); text-decoration: none; }
a.wordmark:focus-visible { border-radius: var(--radius-md); }

/* buttons (design system, Button): pills; primary is an ink fill */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); flex: none;
  min-height: 2.75rem; padding: 0 1.375rem; border: 1px solid transparent; border-radius: var(--radius-pill);
  font-family: var(--font-text); font-size: 0.9375rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-primary:hover { color: var(--on-ink); opacity: 0.88; }
.btn-secondary { background: var(--surface-raised); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { color: var(--ink); background: var(--surface-sunken); }
.btn-l { min-height: 3.25rem; padding: 0 1.625rem; }
.btn svg { flex: none; }

/* header and footer */
.site-header { flex: none; padding-block-start: env(safe-area-inset-top, 0px); background: var(--surface); }
.site-header-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 1.5rem;
  min-height: 4.25rem; padding-inline: var(--gutter) var(--gutter-end);
}
.site-header .wordmark { display: inline-flex; align-items: center; min-height: 2.75rem; flex: none; font-size: 1.75rem; }
.footer-links a {
  display: inline-flex; align-items: center; min-height: 2.75rem;
  color: var(--ink-muted); font-size: 0.875rem; text-decoration: none;
}
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.footer-links a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.site-footer {
  flex: none; margin-block-start: 3.5rem;
  padding: 0.75rem var(--gutter-end) max(1rem, env(safe-area-inset-bottom, 0px)) var(--gutter);
  border-block-start: 1px solid var(--line); color: var(--ink-muted); font-size: 0.8125rem;
}
.site-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1.5rem; }
.site-footer p { margin: 0.5rem 0; text-wrap: pretty; }
.site-footer p a { color: inherit; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
.footer-links a { font-size: 0.8125rem; }
.index-count { font-variant-numeric: tabular-nums; }
.footer-timings { order: 1; flex-basis: 100%; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
@media (max-width: 47.99rem) { .site-footer-inner, .footer-links { justify-content: center; text-align: center; } }

/* the search field (design system, SearchField): a pill with the search
   icon; 52px on the front page, 46px in the results header */
.search-form { position: relative; display: flex; align-items: center; gap: 0.625rem; width: 100%; min-width: 0; margin: 0; }
.search-field {
  position: relative; display: flex; align-items: center; gap: var(--space-3); flex: 1 1 auto; min-width: 0;
  block-size: 3.25rem; padding: 0 1.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: var(--surface-raised); color: var(--ink-muted);
}
.search-field:focus-within { outline: 2px solid var(--water); outline-offset: 2px; }
.search-field-m { block-size: 2.875rem; padding: 0 1.125rem; }
.search-icon { flex: none; }
.search-field-m .search-icon { inline-size: 1rem; block-size: 1rem; }
.search-combobox { position: relative; flex: 1 1 auto; min-width: 0; align-self: stretch; display: flex; align-items: center; }
input[type="search"] {
  display: block; width: 100%; min-width: 0; block-size: 100%; margin: 0; padding: 0;
  font: inherit; font-size: 1.0625rem; color: var(--ink); background: transparent; border: 0; border-radius: 0;
  appearance: none; -webkit-appearance: none;
}
.search-field-m input[type="search"] { font-size: 1rem; }
input[type="search"]::placeholder { color: var(--ink-muted); opacity: 1; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="search"]:focus, input[type="search"]:focus-visible { outline: none; }
.suggestions {
  position: absolute; z-index: 50; inset: calc(100% + 0.625rem) -1.25rem auto -2.875rem; margin: 0; padding: 0.375rem;
  list-style: none; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dialog); max-height: 22rem; overflow-y: auto; text-align: start; color: var(--ink);
}
.suggestions [role="option"] {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  min-height: 2.75rem; padding: 0.55rem 0.75rem; border-radius: var(--radius-md); cursor: pointer; overflow-wrap: anywhere;
}
.suggestions [role="option"].is-active, .suggestions [role="option"]:hover { background: var(--surface-sunken); }
.suggestions small { color: var(--ink-muted); font-size: 0.8125rem; white-space: nowrap; }

/* front page: the wordmark and the field centred, space-6 apart, one line
   of promise under the field (mockups Main, MobileHome). Nothing else. */
.home-page main { display: flex; flex-direction: column; justify-content: center; padding-block: 1rem 5rem; }
.home { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); width: 100%; max-width: 40rem; margin: 0 auto; text-align: center; }
.home-mark { margin: 0; font-size: clamp(4rem, 17vw, 7.25rem); }
.home-form { text-align: start; }
.home-promise { margin: calc(-1 * var(--space-3)) 0 0; color: var(--ink-muted); font-size: 0.875rem; }
@media (max-width: 47.99rem) {
  /* Phones submit with the keyboard's search key (mockup MobileHome). */
  .home-go { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; padding: 0; border: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip-face, .more-link, .search-field, .panel-btn, .result { transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, opacity 120ms ease-out; }
}
@media (forced-colors: active) {
  .search-field, .chip-face, .more-link, .site-box, .about-panel, .source-panel, .notice, .tag, .btn, .facets-apply, .about-card, .info-sheet { border: 1px solid CanvasText; }
  .wm-u { forced-color-adjust: none; background: none; color: CanvasText; }
  .why-track { forced-color-adjust: none; border: 1px solid CanvasText; background: Canvas; }
  .why-track::before { background: CanvasText; }
  .chip.is-on .chip-face, .chip-selected .chip-face { forced-color-adjust: none; background: SelectedItem; color: SelectedItemText; border-color: SelectedItem; }
  mark { background: Mark; color: MarkText; }
  :focus-visible, .chip:focus-visible .chip-face, .search-field:focus-within { outline-color: Highlight; }
  html.js .serp.has-panel .panel-btn { opacity: 1; }
  html.js .serp.has-panel .result-source { padding-inline-end: 8.75rem; }
  /* The icons are masks over a background colour, which forced colours
     would paint as the page background. */
  .about > summary::before { forced-color-adjust: none; background: ButtonText; }
  .about[open] > summary::before { background: Highlight; }
}
@media (forced-colors: active) and (min-width: 64rem) {
  /* Only beside the panel is a result "selected". */
  html:not(.panel-off) .serp.has-panel .result.is-selected { outline: 2px solid Highlight; }
}
@media print {
  .site-header, .site-footer, .filter-bar, .facets, .source-panel, .applied, .applied-note, .about, .panel-btn, .more, .skip-link, .skip-to { display: none !important; }
  .serp { display: block; margin: 0; max-width: none; padding: 0; }
  .results > .result { margin: 0; padding: 0 0 1rem; border: 0; }
  .result-title::after { content: " – " attr(href); overflow-wrap: anywhere; font-family: var(--font-text); font-size: 0.75rem; color: var(--ink-muted); }
}
