/* Shared locale presentation (Phase 57, ADR-0008) — the font contract and the
 * language chrome every page gets, loaded before the page's own stylesheet so
 * a page can still override a token. Three surfaces used to declare these
 * separately (app/millionfold/index.html, app/endless.html and
 * app/millionfold/report.css), so a new script or a chrome fix was a three-file
 * edit; now it is one.
 *
 * The url() paths are relative to this file's own location, so the single
 * `../fonts/` prefix resolves to app/fonts/ for every page no matter where the
 * page lives. Nothing here names a remote origin: the zero-network promise
 * holds (ADR-0008, CSP `default-src 'self'`).
 *
 * The brand faces draw Latin only; each other script names the system face
 * that draws it rather than falling through to a tofu box. A page that draws
 * no brand face (the report and its siblings) redeclares --serif/--sans in its
 * own stylesheet, which is loaded after this one and therefore wins. */

@font-face {
    font-family: 'Geist';
    src: url('../fonts/Geist-latin-ext.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
    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: 'Geist';
    src: url('../fonts/Geist-latin.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
    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: 'Geist Mono';
    src: url('../fonts/GeistMono-latin-ext.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
    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: 'Geist Mono';
    src: url('../fonts/GeistMono-latin.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
    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: 'Newsreader';
    src: url('../fonts/Newsreader-Italic-latin-ext.woff2') format('woff2');
    font-weight: 400; font-style: italic; font-display: swap;
    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: 'Newsreader';
    src: url('../fonts/Newsreader-Italic-latin.woff2') format('woff2');
    font-weight: 400; font-style: italic; font-display: swap;
    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: 'Newsreader';
    src: url('../fonts/Newsreader-latin-ext.woff2') format('woff2');
    font-weight: 200 800; font-style: normal; font-display: swap;
    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: 'Newsreader';
    src: url('../fonts/Newsreader-latin.woff2') format('woff2');
    font-weight: 200 800; font-style: normal; font-display: swap;
    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;
}
/* Space Grotesk is the plate-stimulus face (the engine's SVG text and plate
   export name it), never page chrome. */
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-latin.woff2') format('woff2');
    font-weight: 400 700; font-style: normal; font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('../fonts/SpaceGrotesk-latin-ext.woff2') format('woff2');
    font-weight: 400 700; font-style: normal; font-display: swap;
    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, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+1EA0-1EF9;
}

/* Latin and Latin-extended come from the brand faces; Cyrillic and Greek fall
   through the system stack. Every other script is named explicitly below.

   The selector is `:root:lang(x)`, not `:lang(x)`, on purpose: a page whose own
   stylesheet is loaded after this one redeclares `--serif`/`--sans` on a plain
   `:root` (the report surfaces draw no brand face), and two equal-specificity
   rules would then be decided by load order — the later `:root` would win and
   the script stack would be lost. Raising this rule's specificity to two
   pseudo-classes makes the script stack win regardless of order. The `[lang]:lang(x)`
   alternative keeps that specificity for an element carrying its own lang
   attribute (the locale bar's buttons and the control's options are labelled
   in their own language), so a label in another script still gets that
   script's stack inside an unrelated page. */
:root {
    --serif: 'Newsreader', Georgia, "Noto Serif", "Times New Roman", serif;
    --sans: 'Geist', system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: 'Geist Mono', ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
:root:lang(ar), [lang]:lang(ar) { --serif: "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif; --sans: "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif; --mono: 'Geist Mono', "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif; }
:root:lang(he), [lang]:lang(he) { --serif: "Noto Sans Hebrew", "Segoe UI", Arial, sans-serif; --sans: "Noto Sans Hebrew", "Segoe UI", Arial, sans-serif; --mono: 'Geist Mono', "Noto Sans Hebrew", "Segoe UI", Arial, sans-serif; }
:root:lang(hi), [lang]:lang(hi) { --serif: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif; --sans: "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif; --mono: 'Geist Mono', "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif; }
:root:lang(ja), [lang]:lang(ja), :root:lang(zh), [lang]:lang(zh) { --serif: "Noto Sans CJK SC", "Noto Sans CJK JP", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Yu Gothic", sans-serif; --sans: "Noto Sans CJK SC", "Noto Sans CJK JP", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Yu Gothic", sans-serif; --mono: 'Geist Mono', "Noto Sans CJK SC", "Noto Sans CJK JP", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Yu Gothic", sans-serif; }
/* Japanese headings wrap between phrases, never inside a word (Phase 172: the
   phone hero broke "IQテスト" in two). A phrase wider than the line may still
   break inside, or the transition heading overflows a 390 px phone. Browsers
   without auto-phrase keep their default breaking. */
h1:lang(ja), h2:lang(ja) { word-break: auto-phrase; overflow-wrap: anywhere; }

/* The mark (Phase 124, ADR-0009 amendment): one rule for every page, drawn
   from tools/icons.mjs's files. It sits beside the wordmark, sized by the
   font, and never mirrors in RTL: the curve reads low to high, left to right. */
.nf-mark { display: inline-block; flex: none; width: 1.25em; height: 1.25em; vertical-align: -0.2em; background: url('../icons/mark.svg') center / contain no-repeat; }
.nf-mark.on-ink { background-image: url('../icons/mark-on-ink.svg'); }

/* Tracked capitals (eyebrows, labels) are a Latin device. Letter-spacing
   splits Devanagari conjuncts and breaks Arabic joining, and these scripts
   have no capitals to space, so every element in them sets none. */
:lang(ar), :lang(hi) { letter-spacing: normal !important; }

/* Language chrome: the suggestion banner.
   The colour tokens carry the classic view's literal values as fallbacks, so
   the same rule renders correctly on a page that declares --ink/--paper (the
   branded view and the report) and on one that does not (the classic view).
   The compact control differs per surface (padding, border token) and stays
   with the page that owns that surface. */
.lang-banner { margin: 0; padding: 10px 24px; background: var(--ink, #17150f); color: var(--paper, #f5f2e9); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 0.9rem; }
.lang-banner[hidden] { display: none; }
.lang-banner p { margin: 0; }
.lang-banner button { font: inherit; font-size: 0.82rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--paper, #f5f2e9); background: transparent; color: var(--paper, #f5f2e9); cursor: pointer; }
.lang-banner-open { background: var(--paper, #f5f2e9); color: var(--ink, #17150f); }

/* Language selector (Phase 125, the 2026-09-26 handover): a header pill that
   opens a two-column listbox, and a bottom sheet on phones. One rule set for
   every page; the tokens carry literal fallbacks for the classic view. */
.lang-control-host { position: relative; display: inline-flex; }
.lang-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border: 1px solid var(--hairline, #DCD6C8); border-radius: 999px; background: transparent; color: var(--ink, #17150F); font: 500 12px/1 'Geist Mono', var(--mono, monospace); letter-spacing: 0.04em; cursor: pointer; }
.lang-pill:hover { border-color: var(--ink, #17150F); }
/* The pill stays 32 px to the eye; its hit area is 44 px tall (B-090, F-032). */
.lang-pill { position: relative; }
.lang-pill::after { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.lang-control-host.open .lang-pill { border: 1.5px solid var(--ink, #17150F); background: #fff; }
.lang-pill:focus-visible, .lang-option:focus-visible, .lang-close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(200, 69, 31, 0.35); }
.lang-pill-caret { width: 0; height: 0; border-inline: 4px solid transparent; border-top: 5px solid currentColor; }
.lang-control-host.open .lang-pill-caret { border-top: 0; border-bottom: 5px solid currentColor; }
.lang-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60; width: 420px; max-width: calc(100vw - 32px); padding: 0 0 12px; background: var(--panel, #FBF9F4); border: 1px solid var(--hairline, #DCD6C8); border-radius: 12px; box-shadow: 0 24px 48px rgba(23, 21, 15, 0.16); color: var(--ink, #17150F); text-align: start; }
.lang-panel[hidden] { display: none; }
.lang-panel-head { display: flex; align-items: baseline; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--hairline, #DCD6C8); }
.lang-panel-title { font: 400 20px/1.2 'Newsreader', var(--serif, serif); }
.lang-panel-count { margin-inline-start: auto; font: 400 12px/1 'Geist Mono', var(--mono, monospace); color: var(--graphite, #6B675C); }
.lang-close { display: none; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink, #17150F); cursor: pointer; min-width: 44px; min-height: 44px; }
.lang-list { list-style: none; margin: 0; padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.lang-option { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 6px; font: 400 14.5px/1.3 var(--sans, system-ui, sans-serif); cursor: pointer; }
.lang-option:hover { background: var(--paper-hover, #EFEAE0); }
.lang-option[aria-selected="true"] { background: var(--ink, #17150F); color: var(--paper, #F4F1EA); }
.lang-option[aria-selected="true"]::after { content: "\2713"; margin-inline-start: auto; font-size: 12px; }
.lang-option-tag { margin-inline-start: auto; font: 400 10.5px/1 'Geist Mono', var(--mono, monospace); color: var(--graphite, #6B675C); }
.lang-option[aria-selected="true"] .lang-option-tag { color: inherit; margin-inline-start: 0; }
.lang-option-browser { grid-column: 1 / -1; color: var(--graphite, #6B675C); font-size: 13px; }
.lang-panel-note { margin: 4px 18px 0; padding-top: 10px; border-top: 1px solid var(--hairline, #DCD6C8); font: 400 12.5px/1.45 var(--sans, system-ui, sans-serif); color: var(--graphite, #6B675C); }
@media (max-width: 719px) {
    .lang-control-host.open::before { content: ""; position: fixed; inset: 0; z-index: 59; background: rgba(23, 21, 15, 0.45); }
    .lang-panel { position: fixed; inset-inline: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: 85vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding-top: 10px; }
    .lang-panel::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 4px; border-radius: 2px; background: var(--hairline, #DCD6C8); }
    .lang-close { display: inline-block; margin-inline-start: auto; }
    .lang-panel-count { display: none; }
    .lang-list { grid-template-columns: 1fr; padding: 0 18px; gap: 0; }
    .lang-option { min-height: 44px; border-radius: 0; border-bottom: 1px solid var(--hairline-soft, #E8E3D7); font-size: 16px; }
    .lang-option[aria-selected="true"] { background: transparent; color: var(--ink, #17150F); font-weight: 600; }
    .lang-option[aria-selected="true"]::after { color: var(--accent, #C8451F); }
}

/* Problem reports (Launchkit's shared report flow, app/reporting/report-flow.mjs).
   This is the one stylesheet every page links, so the header control and the
   flow's plain elements are styled here, with the same literal fallbacks the
   language chrome uses. The control sits beside the language pill and stays
   visible during a sitting; the flow's status and receipts close the page. */
.nf-report-control { display: inline-flex; align-items: center; min-height: 32px; margin-inline-start: 12px; padding: 4px 12px; border: 1px solid var(--hairline, #DCD6C8); border-radius: 999px; background: transparent; color: var(--ink, #17150F); font: 500 12px/1 var(--sans, system-ui, sans-serif); cursor: pointer; position: relative; white-space: nowrap; }
.nf-report-control:hover { border-color: var(--ink, #17150F); }
.nf-report-control::after { content: ''; position: absolute; inset-inline: 0; top: 50%; height: 44px; transform: translateY(-50%); }
.nf-report-control:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(200, 69, 31, 0.35); }
/* During a sitting below 881 px the home view's masthead keeps one row (it
   hides the language control and the links for it), so the control becomes a
   mark there; its label stays in the button as the accessible name. */
@media (max-width: 880px) {
    .masthead.in-test .nf-report-control { justify-content: center; width: 28px; min-height: 28px; height: 28px; padding: 0; margin-inline-start: 4px; }
    .masthead.in-test .nf-report-control::before { content: '!'; font: 600 14px/1 var(--sans, system-ui, sans-serif); }
    .masthead.in-test .nf-report-control::after { inset-inline: -8px; }
    .masthead.in-test .nf-report-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.nf-report-flow { max-width: 720px; margin: 0 auto; padding: 0 24px; font: 400 0.875rem/1.5 var(--sans, system-ui, sans-serif); color: var(--body, #4A463D); }
.nf-report-flow > p:empty { display: none; }
.nf-report-flow > p, .nf-report-flow section p { margin: 12px 0; }
.nf-report-flow section button { margin-inline-start: 10px; font: inherit; font-size: 0.8125rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--hairline, #DCD6C8); background: transparent; color: var(--ink, #17150F); cursor: pointer; }
#launchkit-report-dialog { margin: auto; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 20px 24px; border: 1px solid var(--hairline, #DCD6C8); border-radius: 12px; background: var(--panel, #FBF9F4); color: var(--ink, #17150F); box-shadow: 0 24px 48px rgba(23, 21, 15, 0.16); }
#launchkit-report-dialog::backdrop { background: rgba(23, 21, 15, 0.45); }
#launchkit-report-dialog h2 { margin: 0 0 8px; font: 400 1.375rem/1.2 var(--serif, Georgia, serif); }
#launchkit-report-dialog p { margin: 8px 0; color: var(--body, #4A463D); }
#launchkit-report-dialog label { display: block; margin: 12px 0 4px; font-weight: 500; }
#launchkit-report-dialog textarea, #launchkit-report-dialog input { box-sizing: border-box; width: 100%; padding: 8px 10px; border: 1px solid var(--hairline, #DCD6C8); border-radius: 6px; background: #fff; color: var(--ink, #17150F); font: inherit; }
#launchkit-report-dialog textarea { min-height: 72px; resize: vertical; }
#launchkit-report-preview { max-height: 200px; overflow: auto; margin: 8px 0 16px; padding: 10px; border-radius: 6px; background: var(--paper, #F4F1EA); font: 400 12px/1.45 'Geist Mono', var(--mono, monospace); white-space: pre-wrap; word-break: break-all; direction: ltr; }
#launchkit-report-dialog > button { min-height: 40px; margin-inline-end: 8px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--ink, #17150F); background: transparent; color: var(--ink, #17150F); font: 500 0.875rem/1 var(--sans, system-ui, sans-serif); cursor: pointer; }
#launchkit-report-send { background: var(--ink, #17150F) !important; color: var(--paper, #F4F1EA) !important; }
#launchkit-report-dialog > button:disabled { opacity: 0.5; cursor: default; }
#launchkit-report-dialog > button[hidden] { display: none; }
