:root {
    --content-width: 86rem;
    --radius-large: 1rem;
    --shadow-card: 0 .85rem 2.5rem rgba(5, 4, 3, .12);
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font-body: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
    --font-hand: "Segoe Print", "Bradley Hand", cursive;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* The router's FocusOnNavigate lands programmatic focus on each page's first h1 for screen-reader
   announcement; headings are never keyboard-reachable, so the browser's focus ring on them is pure
   visual noise rather than a usable indicator. */
h1:focus,
h2:focus,
h3:focus {
    outline: none;
}

html {
    min-width: 20rem;
    scroll-behavior: smooth;
    /* Clears the sticky site-header (min-height ~5.5rem) plus breathing room, so in-page anchor targets
       never land hidden beneath it. */
    scroll-padding-top: 7rem;
    /* Phone browsers in landscape inflate text on their own; the page's clamp()-based type already adapts. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* The sticky header is shorter at phone widths (min-height 4.75rem), so anchors need less clearance. */
@media (max-width: 40rem) {
    html { scroll-padding-top: 6rem; }
}

body {
    /* svh tracks the *small* mobile viewport (browser chrome visible), so full-height surfaces never
       overshoot behind the address bar; the vh line stays as the fallback for older engines. */
    min-height: 100vh;
    min-height: 100svh;
    margin: 0;
    color: var(--text-primary);
    background: var(--surface-app);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
}

.site-root {
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text-primary);
    background: var(--surface-app);
}

/* Palette hexes below are hand-copied from the canonical desktop palettes at
   Shared/Themes/Palettes/Base/*.axaml (CozyDark.axaml, CozyDay.axaml) and must stay in sync with them.
   Selectors are attribute-only (not scoped to .site-root) so <body data-theme="cozy-dark"> in index.html also
   receives these custom properties, giving body/.skip-link/.boot-status* a themed palette before Blazor mounts
   .site-root. The Blazor-toggled .site-root[data-theme] attribute still wins for its own subtree, since a rule
   matching an element directly always beats an inherited value from an ancestor. */
[data-theme="cozy-dark"] {
    color-scheme: dark;
    --surface-app: #151110;
    --surface-header: #201913;
    --surface-rail: #262019;
    --surface-nav: #221c15;
    --surface-raised: #2e251d;
    --surface-hover: #3a322b;
    --text-primary: #c9bca6;
    --text-secondary: #b8a888;
    --text-muted: #8a7860;
    --stroke: #3e3228;
    --stroke-strong: #524238;
    --accent: #d2b078;
    --accent-hover: #dec28f;
    --accent-soft: rgba(185, 149, 95, .16);
    --text-on-accent: #0f0d0b;
    --scrollbar-thumb: #6b4f3a;
}

[data-theme="cozy-day"] {
    color-scheme: light;
    --surface-app: #ebe6e0;
    --surface-header: #dcd1c6;
    --surface-rail: #d0c0af;
    --surface-nav: #f3f0ed;
    --surface-raised: #e5ded7;
    --surface-hover: #d8cabb;
    --text-primary: #432d19;
    --text-secondary: #6a4c2f;
    --text-muted: #926f4f;
    --stroke: #c6ae95;
    --stroke-strong: #bc9976;
    --accent: #806039;
    --accent-hover: #997a4c;
    --accent-soft: rgba(128, 96, 57, .14);
    --text-on-accent: #fff8ed;
    --scrollbar-thumb: #c2a986;
}

.site-root,
.site-root * {
    scrollbar-color: var(--scrollbar-thumb) transparent;
    scrollbar-width: thin;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 1000;
    padding: .7rem 1rem;
    border-radius: .5rem;
    color: var(--text-on-accent);
    background: var(--text-primary);
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

/* Global button primitive: originally lived scoped to Home.razor.css, moved here so every page
   (the 404 view rendered from App.razor and the /thanks, /license, /license/reset pages) can reuse
   the exact same pill button without duplicating it per component-scoped stylesheet. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    min-height: 3rem;
    padding: .8rem 1.2rem;
    border: 1px solid transparent;
    border-radius: .65rem;
    font: inherit;
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    border-color: var(--accent-hover);
}

.button:disabled {
    opacity: .62;
    cursor: not-allowed;
}

.button--primary {
    color: var(--text-on-accent);
    background: var(--accent);
    box-shadow: 0 .5rem 1.4rem rgba(5, 4, 3, .14);
}

.site-nav .button--primary {
    color: var(--text-on-accent);
}

.button--primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 .6rem 1.6rem rgba(5, 4, 3, .17);
}

.button--quiet {
    border-color: var(--stroke-strong);
    color: var(--text-primary);
    background: var(--surface-nav);
}

.button--quiet:hover { background: var(--surface-raised); }

.button--full { width: 100%; }

.message-page {
    display: grid;
    align-content: center;
    justify-items: start;
    min-height: 100vh;
    min-height: 100svh;
    width: min(calc(100% - 2rem), 48rem);
    margin: 0 auto;
}

.message-page h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.35rem, 5vw, 3.25rem);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.05;
}

.message-page p:not(.eyebrow) { color: var(--text-secondary); }
.message-page .button { margin-top: 1rem; }

.boot-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .85rem;
    min-height: 100vh;
    min-height: 100svh;
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 700;
}

.boot-status__mark {
    display: block;
    width: 2.25rem;
    height: 2.25rem;
}

.boot-status__mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#blazor-error-ui {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    z-index: 1000;
    display: none;
    max-width: 42rem;
    margin: 0 auto;
    padding: 1rem 3rem 1rem 1rem;
    border: 1px solid #d7b27d;
    border-radius: .75rem;
    color: #4e392d;
    background: #fff1d9;
    box-shadow: var(--shadow-card);
    font-size: .82rem;
}

#blazor-error-ui .reload {
    margin-left: .45rem;
    color: #704531;
    font-weight: 800;
}

#blazor-error-ui .dismiss {
    position: absolute;
    top: .7rem;
    right: .7rem;
    width: 1.8rem;
    height: 1.8rem;
    overflow: hidden;
    border: 0;
    color: transparent;
    background: transparent;
    cursor: pointer;
}

#blazor-error-ui .dismiss::before {
    color: #704531;
    content: "×";
    font-size: 1.25rem;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

.policy-page { width: min(calc(100% - 2rem), 52rem); margin: 0 auto; padding-block: clamp(3.5rem, 8vw, 6rem); }
.policy-page h1 { max-width: 18ch; margin: 0; color: var(--text-primary); font-family: var(--font-display); font-size: clamp(2.5rem, 6vw, 4.6rem); font-weight: 580; line-height: 1.02; text-wrap: balance; }
.policy-page__lede { margin: 1.4rem 0 0; color: var(--text-secondary); font-size: 1.08rem; line-height: 1.75; }
.policy-page section { padding-block: 2rem; border-bottom: 1px solid var(--stroke); }
.policy-page h2 { margin: 0 0 .8rem; color: var(--text-primary); font-family: var(--font-display); font-size: 1.55rem; font-weight: 580; }
.policy-page p, .policy-page li { color: var(--text-secondary); line-height: 1.75; }
.policy-page a { color: var(--accent); }
.policy-page__notice { padding: 1rem 1.1rem; border: 1px solid var(--stroke-strong); border-radius: .7rem; background: var(--surface-raised); }
.download-page > .button { margin-top: 1.5rem; }
.policy-page .section-kicker {
    margin: 0 0 .8rem;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: .82rem;
    font-style: italic;
}

