/* UnlimitedPDF Demos: app styles on top of Bootstrap 6 (alpha). */

/* Light and calm (D-021): white surfaces, brand navy for text accents and primary buttons, brand teal for calls to
   action, and dark teal for the focus ring and the current-page marks. Contrast on white: ink 15:1, muted 7.1:1, navy
   13.3:1, teal ink 6.7:1, dark teal 5.3:1. Brand teal itself (2.9:1) is decoration only, never the one cue. */
:root {
    --app-ink: #13203b;
    --app-muted: #4a5568;
    --app-line: #e3e7ee;
    --app-surface: #ffffff;
    --app-canvas: #f6f8fb;
    --app-accent: #002a73;
    --app-accent-soft: #e8eef8;
    --app-teal: #00ac8c;
    --app-teal-ink: #00694f;
    --app-teal-soft: #e6f6f2;
    --app-focus: #007a64;
    --app-code-bg: #0f1b33;
    --app-mark: #fff3b0;
    --app-danger: #c4314b;
    --app-danger-soft: #fdecef;
    --app-warn-soft: #fff6e0;
    --app-radius: 14px;
    --app-topbar-h: 60px;
    --app-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --app-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* Bootstrap 6 derives its primary theme from these; point them at brand navy. */
:root {
    --bs-primary-base: #002a73;
    --bs-primary-bg: #002a73;
    --bs-primary-fg: #002a73;
    --bs-primary-border: #8fa3c7;
    --bs-primary-contrast: #ffffff;
}

/* Bootstrap 6 buttons read their colors from a theme class; buttons without one get a neutral theme. */
.btn:not([class*="theme-"]) {
    --bs-theme-fg: var(--app-ink);
    --bs-theme-fg-emphasis: var(--app-ink);
    --bs-theme-bg: var(--app-accent);
    --bs-theme-bg-subtle: #eef2fa;
    --bs-theme-bg-muted: #e3e8f2;
    --bs-theme-border: #cfd8ea;
    --bs-theme-contrast: #ffffff;
    --bs-theme-focus-ring: rgba(0, 122, 100, 0.35);
}

/* A control reached with Tab or Shift+Tab is scrolled clear of the sticky top bar (WCAG 2.4.11). */
html { scroll-padding-top: calc(var(--app-topbar-h) + 0.5rem); }

html, body {
    font-family: var(--app-font);
    color: var(--app-ink);
    background: var(--app-canvas);
}

h1:focus { outline: none; }

:where(a:not(.btn)) { color: var(--app-accent); }

/* ---------- Focus and field borders (26111103 AC-03, AC-10) ---------- */

/* One keyboard focus ring for every link, button, tab, and field: solid dark teal, about 5:1 on the light surfaces.
   It replaces the framework's translucent ring, which measured under 2:1. FAQ controls keep their inset ring below. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[role="tab"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
.form-control:focus-visible,
.form-control:focus-within,
.form-select:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid var(--app-focus);
    outline-offset: 2px;
}

/* On the dark code and install blocks the accent is too dark, so the ring is the light code color instead. */
.code-copy:focus-visible,
.install button:focus-visible { outline-color: #dbe5ff; }

/* Field borders at least 3:1 against white and the page canvas, so every field can be found. */
:root { --app-field-border: #7d89a1; }

.form-control,
.form-select,
.field input[type="color"] { border-color: var(--app-field-border); }

/* ---------- Top bar (D-021, D-024, D-028) ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--app-topbar-h);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--app-line);
}

.topbar-inner {
    height: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

/* The wordmark (or the square icon on phones) keeps its own aspect ratio at the top bar's logo height. */
.brand img { display: block; height: 30px; width: auto; }

/* The logo and the library version pill beside it (QF-26111209). The link is the tap area; the pill is its look. */
.brand-group { display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.version-link { display: inline-flex; align-items: center; padding: 0.25rem; border-radius: 999px; text-decoration: none; }
.version-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.55rem;
    border: 1px solid #b9c7e0;
    border-radius: 999px;
    background: var(--app-accent-soft);
    color: var(--app-accent);
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.4;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.version-link:hover .version-badge { border-color: var(--app-accent); }

/* The search box takes the room between the logo and the links. */
.topbar-search { flex: 1 1 auto; min-width: 0; max-width: 34rem; }

.topnav { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }

.topnav-link {
    display: inline-flex;
    align-items: center;
    color: var(--app-ink);
    text-decoration: none;
    font-weight: 550;
    font-size: 0.95rem;
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
}

.topnav-link:hover { color: var(--app-accent); background: var(--app-canvas); }
.topnav-link.active { color: var(--app-accent); font-weight: 700; box-shadow: inset 0 -3px 0 var(--app-focus); border-radius: 8px 8px 0 0; }
.topnav-cta { margin-left: 0.5rem; }

/* Menu: phones and narrow windows only, where the search and the links move into the drawer. */
.topbar-menu { display: none; margin-left: auto; gap: 0.4rem; align-items: center; border: 1px solid var(--app-field-border); }

@media (max-width: 899.98px) {
    .topbar-search, .topnav { display: none; }
    .topbar-menu { display: inline-flex; }
}

@media (max-width: 575.98px) {
    .topbar-inner { padding: 0 0.9rem; }
}

/* The menu drawer: the browser's modal dialog, full height at the right edge, at most 22rem wide. */
.site-menu {
    margin: 0 0 0 auto;
    width: min(22rem, 100vw);
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    padding: 1rem 1.1rem 1.5rem;
    border: 0;
    border-left: 1px solid var(--app-line);
    background: var(--app-surface);
    color: var(--app-ink);
    overflow-y: auto;
}
.site-menu[open] { display: flex; flex-direction: column; gap: 1rem; }
.site-menu::backdrop { background: rgba(15, 27, 51, 0.45); }
.site-menu-head { display: flex; align-items: center; justify-content: space-between; }
.site-menu-title { margin: 0; font-weight: 700; color: var(--app-accent); font-size: 1.05rem; }
.site-menu-close { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--app-field-border); }
.site-menu-nav { display: flex; flex-direction: column; }
.site-menu-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 48px;
    padding: 0 0.25rem;
    border-bottom: 1px solid var(--app-line);
    color: var(--app-accent);
    font-weight: 600;
    text-decoration: none;
}
.site-menu-link.active { box-shadow: inset 4px 0 0 var(--app-focus); padding-left: 0.75rem; }
.site-menu-install { justify-content: center; min-height: 48px; }

.app-main { min-height: calc(100vh - var(--app-topbar-h)); }

/* Focused by the skip link only; the next Tab press continues inside it, so it needs no ring of its own. */
.app-main:focus, .playground-content:focus { outline: none; }

/* "Skip to content": off screen until it has focus, then shown over the top bar's left end, wherever the page is scrolled. */
.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.75rem;
    z-index: 30;
    transform: translateY(-200%);
    padding: 0.6rem 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
    background: var(--app-accent);
    color: #fff;
    font-weight: 650;
    text-decoration: none;
}

.skip-link:focus { transform: none; }
.skip-link:focus-visible { outline-color: var(--app-ink); }

/* ---------- Playground shell ---------- */

/* Demo pages: a breadcrumb to the scenario gallery and the demo's capability, then the demo across the full width. */
.playground { max-width: 1600px; margin: 0 auto; }
.breadcrumb-nav { padding: 1rem 1.75rem 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; list-style: none; font-size: 0.9rem; }
.breadcrumbs li + li::before { content: "/"; margin-right: 0.25rem; color: var(--app-muted); }
.breadcrumbs a { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; min-width: 24px; padding: 0 0.25rem; color: var(--app-accent); }
.playground-content { padding: 0.75rem 1.75rem 3rem; min-width: 0; }

@media (max-width: 899.98px) {
    .breadcrumb-nav { padding: 0.75rem 1.25rem 0; }
    .playground-content { padding: 0.5rem 1.25rem 2.5rem; }
}

/* ---------- Demo page ---------- */

.demo-header { margin-bottom: 1.25rem; }
.demo-header h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.015em; margin: 0 0 0.35rem; }
.demo-lead { color: var(--app-muted); margin: 0; max-width: 60rem; }

/* Three columns (D-023): the visitor's data, the PDF, and the C# code. Below 1,280 px the code goes under the data and
   the PDF; below 900 px all three stack in that order. */
.demo-grid {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1.25fr) minmax(300px, 0.85fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 1279.98px) {
    .demo-grid { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
    .demo-code { grid-column: 1 / -1; }
}

@media (max-width: 899.98px) {
    .demo-grid { grid-template-columns: minmax(0, 1fr); }
}

.demo-column-title { margin: 0; padding: 0.85rem 1rem 0.35rem; font-size: 1rem; font-weight: 700; color: var(--app-accent); }
.output-head .demo-column-title { padding: 0.6rem 0; }

.panel {
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    box-shadow: 0 1px 2px rgba(18, 33, 61, 0.04), 0 8px 24px rgba(18, 33, 61, 0.04);
}

.demo-inputs { display: flex; flex-direction: column; }
.demo-inputs-body { padding: 0.5rem 1rem 0.75rem; }

.demo-actions {
    position: sticky;
    bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--app-line);
    background: var(--app-surface);
    border-radius: 0 0 var(--app-radius) var(--app-radius);
}

.demo-actions .btn-generate { min-width: 9.5rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.demo-shortcut { margin-left: auto; font-size: 0.78rem; color: var(--app-muted); }

/* Phones and tablets usually have no keyboard, so the Ctrl + Enter hint is left out there (26111103 F-13). */
@media (max-width: 1023.98px) {
    .demo-shortcut { display: none; }
}

/* "Back to options": only where the options sit above the output (below 1,280 px). The options panel keeps its top
   below the sticky top bar when scrolled to, and shows no ring when focused this way. */
.output-actions .btn.back-to-options { display: none; }
.demo-inputs { scroll-margin-top: calc(var(--app-topbar-h) + 1rem); }

/* After Generate the output is scrolled into view below 1,280 px; this keeps its header (tabs, Back to options,
   Open, Download) below the sticky top bar instead of under it (26111103 F-15). */
.demo-output { scroll-margin-top: calc(var(--app-topbar-h) + 0.5rem); }
.demo-inputs:focus { outline: none; }

@media (max-width: 899.98px) {
    .output-actions .btn.back-to-options { display: inline-flex; align-items: center; gap: 0.35rem; }
}
.demo-shortcut kbd {
    font-family: var(--app-mono);
    font-size: 0.72rem;
    background: var(--app-canvas);
    color: var(--app-ink);
    border: 1px solid var(--app-line);
    border-radius: 5px;
    padding: 0.05rem 0.35rem;
}

.demo-output { overflow: hidden; }

.output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 0;
    border-bottom: 1px solid var(--app-line);
    flex-wrap: wrap;
}

.output-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; padding-bottom: 0.4rem; }
.output-actions .btn { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Phones: Back to options and Download all fit on one line at 375 px; narrower screens wrap (QF-26111303). */
@media (max-width: 575.98px) {
    .output-head { padding-inline: 0.5rem; }
    .output-actions { gap: 0.15rem; }
    .output-actions .btn-sm { padding-inline: 0.5rem; }
}

/* Split demos: one row per part, above the preview of the selected part. */
.split-parts { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.35rem; max-height: 14rem; overflow-y: auto; }
.split-part { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 0.6rem; padding: 0.4rem 0.6rem; border: 1px solid var(--app-line); border-radius: 10px; background: #fbfcfe; font-size: 0.85rem; }
.split-part.is-selected { border-color: var(--app-accent); }
.split-part-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-part-pages, .split-part-size { color: var(--app-muted); white-space: nowrap; }
.split-part-actions { display: inline-flex; gap: 0.35rem; }
.split-part-actions .btn { display: inline-flex; align-items: center; gap: 0.35rem; }
@media (max-width: 560px) {
    .split-part { grid-template-columns: minmax(0, 1fr) auto; }
    .split-part-actions { grid-column: 1 / -1; }
}

.status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    min-height: 2.5rem;
    padding: 0.5rem 0.9rem;
    border-top: 1px solid var(--app-line);
    font-size: 0.85rem;
    color: var(--app-muted);
}

.status-meta { display: inline-flex; gap: 0.9rem; font-variant-numeric: tabular-nums; }
.status-meta strong { color: var(--app-ink); font-weight: 650; }

.stale-note {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--app-warn-soft);
    color: #7a5200;
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-weight: 550;
}

.stale-note button { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0; font: inherit; min-height: 24px; }

.error-box {
    margin: 0.9rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--app-danger-soft);
    color: var(--app-danger);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: space-between;
}

.error-box p { margin: 0; color: #7d1b2d; }

/* ---------- PDF preview (D-015, D-025) ---------- */

/* The drawn preview: a toolbar above the pages, then the pages in one scrolling column on a grey desk. */
.viewer { position: relative; display: flex; flex-direction: column; background: #e9edf3; border-top: 1px solid var(--app-line); }

.viewer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-line);
}
.viewer-go { display: flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; }
.viewer-go label { font-weight: 600; }
.viewer-page-input { width: 4.75rem; min-height: 36px; padding: 0.2rem 0.45rem; font-variant-numeric: tabular-nums; }
.viewer-page-total { color: var(--app-muted); white-space: nowrap; }
.viewer-zoom { display: flex; align-items: center; gap: 0.25rem; }
.viewer-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    border: 1px solid var(--app-field-border);
    background: var(--app-surface);
}
.viewer-tool[aria-pressed="true"] { border-color: var(--app-accent); background: var(--app-accent-soft); color: var(--app-accent); font-weight: 650; }
.viewer-zoom-level { min-width: 3.25rem; text-align: center; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-left: auto; }
.viewer-actions .btn { display: inline-flex; align-items: center; gap: 0.35rem; }

/* Two fingers pan the pages but don't zoom the whole site: the preview takes the pinch for its own zoom. */
.viewer-scroll {
    position: relative;
    height: min(78vh, 900px);
    min-height: 420px;
    overflow: auto;
    padding: 1rem;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
}
.viewer-scroll:focus-visible { outline-offset: -3px; }

.viewer-pages {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    transform: scale(var(--pinch, 1));
    transform-origin: top center;
}

/* A page at the chosen zoom (1 point is 4/3 CSS pixels at 100%), or, fitting the width, the widest page fills it. The
   auto margins center a page that fits and let a wider one scroll to both of its edges. */
.viewer-page {
    position: relative;
    flex: none;
    width: calc(var(--pw) * var(--scale) * 1.3333px);
    aspect-ratio: var(--pw) / var(--ph);
    margin-inline: auto;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 27, 51, 0.18), 0 6px 18px rgba(15, 27, 51, 0.08);
}
.viewer.is-fit .viewer-page { width: calc(100% * var(--pw) / var(--widest)); }
.viewer-canvas, .viewer-canvas > svg { display: block; width: 100%; height: 100%; }

.viewer-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    background: var(--app-warn-soft);
    color: var(--app-ink);
    overflow-wrap: anywhere;
}
.viewer-page > .viewer-notice { position: absolute; inset: 0; }
.viewer-notice .btn { display: inline-flex; align-items: center; gap: 0.35rem; }

.viewer-empty {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 0.25rem;
    min-height: 100%;
    padding: 2rem;
    text-align: center;
    color: var(--app-muted);
}
.viewer-empty .icon { color: #8f9bb3; margin-bottom: 0.5rem; }
.viewer-empty strong { color: var(--app-ink); font-size: 1.05rem; }

/* Phones: the page box and the zoom share one row, Open PDF and Download the next; "Page" is still read aloud. */
@media (max-width: 575.98px) {
    .viewer-toolbar { gap: 0.4rem 0.6rem; padding: 0.4rem 0.5rem; }
    .viewer-go label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .viewer-zoom-level { min-width: 2.6rem; }
    .viewer-scroll { height: 70vh; min-height: 320px; padding: 0.6rem; }
    .viewer-actions { margin-left: 0; }
    .viewer-tool, .viewer-page-input { min-height: 44px; min-width: 44px; }
}

.preview-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem;
    background: rgba(246, 248, 252, 0.72);
    backdrop-filter: blur(1.5px);
    animation: fade-in 0.15s ease-out;
}

.preview-progress { width: min(18rem, 70%); }
.preview-progress-label { font-weight: 600; margin-bottom: 0.6rem; }

.progress-indeterminate {
    height: 4px;
    border-radius: 999px;
    background: #dbe3f3;
    overflow: hidden;
    position: relative;
}

.progress-indeterminate::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--app-accent), var(--app-teal));
    animation: indeterminate 1.1s ease-in-out infinite;
}

@keyframes indeterminate {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .progress-indeterminate::before { animation-duration: 3s; }
    .preview-overlay { animation: none; }
}

/* ---------- Code view ---------- */

.code-view { position: relative; height: min(78vh, 900px); min-height: 420px; background: var(--app-code-bg); }
.demo-code { overflow: hidden; }
.demo-code .code-view { border-top: 1px solid var(--app-line); }

.code-view pre {
    margin: 0;
    height: 100%;
    overflow: auto;
    /* The top room keeps the first lines clear of the Copy button (26111103 R-02); Home and FAQ samples set their own. */
    padding: 2.9rem 1.1rem 2rem;
    color: #dbe5ff;
    font-family: var(--app-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    tab-size: 4;
}

.code-copy {
    position: absolute;
    top: 0.65rem;
    right: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(219, 229, 255, 0.5); /* about 4.4:1 on the code background (26111103 F-14) */
    background: rgba(15, 26, 46, 0.85);
    color: #dbe5ff;
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.code-copy:hover { background: #1b2a47; }

/* Side by side (900 px and wider): the pages and the code take the screen height left after the top bar, the
   breadcrumb, the demo heading, the toolbar, and the status line, so Generate, the pages, and the status line all fit
   the first screen (26111103 AC-06). On the split demos the parts list above the preview is capped and its room is
   taken off. */
@media (min-width: 900px) {
    .viewer-scroll, .code-view { height: clamp(320px, calc(100dvh - 22rem), 900px); min-height: 0; }
    .split-parts { max-height: 8rem; }
    .split-parts + .viewer .viewer-scroll { height: clamp(260px, calc(100dvh - 31rem), 900px); }
}

/* ---------- Option sections and fields ---------- */

.opt-section + .opt-section { border-top: 1px solid var(--app-line); }

.opt-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: none;
    padding: 0.85rem 0 0.6rem;
    font-weight: 650;
    font-size: 0.92rem;
    color: var(--app-ink);
}

.opt-section-toggle .icon { color: var(--app-muted); transition: transform 0.15s ease; }
.opt-section-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.opt-section-body { padding-bottom: 0.85rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }

/* Columns may shrink below a field's built-in width, so nothing scrolls sideways at 320 px (WCAG 1.4.10). */
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.form-control { min-width: 0; max-width: 100%; }
input[type="file"] { max-width: 100%; }
.field { min-width: 0; }
.field-row .btn { min-width: 0; white-space: normal; }
.field label, .field .field-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--app-muted); margin-bottom: 0.25rem; }
.field .form-control { font-size: 0.9rem; }
.field input[type="color"] { width: 100%; height: 2.25rem; padding: 0.2rem; border: 1px solid var(--app-field-border); border-radius: 8px; background: #fff; }
/* A button that acts on the field above it (Remove a file): the same gap as between fields (26111201 AC-06). */
.field-action { margin-top: 0.7rem; }
.field-hint { font-size: 0.75rem; color: var(--app-muted); margin-top: 0.25rem; }
.field-hint > a { display: inline-flex; align-items: center; min-height: 24px; }
.field-error { font-size: 0.75rem; color: var(--app-danger); margin: 0.25rem 0 0; }

/* HTML to PDF: the HTML editor and the warning list. */
.code-input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.8rem; line-height: 1.45; resize: vertical; white-space: pre; }
.warning-list { margin: 0; padding-left: 1.1rem; font-size: 0.8rem; }
.warning-list li { margin-bottom: 0.3rem; }

/* Common problems: the scenario list, the handled or limitation badge, and the scenario text. */
.scenario-list { display: grid; gap: 0.15rem; font-size: 0.85rem; }
.scenario-list ul { list-style: none; margin: 0 0 0.45rem; padding: 0; }
.scenario-list a { display: block; padding: 0.2rem 0.5rem; border-radius: 6px; color: var(--app-ink); text-decoration: none; }
.scenario-list a:hover { background: var(--app-canvas); }
.scenario-list a[aria-current="page"] { background: var(--app-accent-soft); color: var(--app-accent); font-weight: 600; }
/* An inset ring: the list scrolls on its own below 1,280 px, so a ring outside the link would be cut off at its edges
   (26111201 AC-05). */
.scenario-list a:focus-visible { outline-offset: -2px; }
.scenario-group { margin: 0.35rem 0 0.1rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--app-muted); }
.scenario-badge { display: inline-block; margin: 0; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; justify-self: start; }
.scenario-badge.is-handled { background: #e3f6f4; color: #0b6e66; }
.scenario-badge.is-limitation { background: var(--app-warn-soft); color: #7a5300; }
.scenario-text { font-size: 0.85rem; display: grid; gap: 0.4rem; }
.scenario-text p { margin: 0; }
/* In the one-column layout the list scrolls on its own, so the chosen scenario's text, HTML, and PDF follow it
   closely instead of after every scenario (14-html-to-pdf review F-47). */
@media (max-width: 1279.98px) {
    .scenario-list { max-height: 15rem; overflow-y: auto; padding-right: 0.25rem; }
}

/* A checkbox and its text are one target: the whole label row toggles it, at least 24 px tall (26111103 AC-05). */
.check-field { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; min-height: 24px; cursor: pointer; }
.check-field input { width: 1.05rem; height: 1.05rem; accent-color: var(--app-accent); }

.segmented { display: inline-flex; border: 1px solid var(--app-line); border-radius: 9px; padding: 2px; background: var(--app-canvas); }
.segmented button { border: 0; background: none; padding: 0.3rem 0.75rem; border-radius: 7px; font-size: 0.85rem; font-weight: 600; color: var(--app-muted); }
/* The pressed segment is filled navy with white text: 13.3:1, and 12.5:1 against the group (WCAG 1.4.1, 1.4.11). */
.segmented button[aria-pressed="true"] { background: var(--app-accent); color: #fff; box-shadow: 0 1px 2px rgba(18, 33, 61, 0.12); }

/* Repeating rows (line items, results) */
.rows { display: grid; gap: 0.5rem; }
.row-item { display: grid; gap: 0.4rem; align-items: end; padding: 0.6rem; border: 1px solid var(--app-line); border-radius: 10px; background: #fbfcfe; }
.row-item-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.78rem; font-weight: 650; color: var(--app-muted); }
.row-remove { display: inline-grid; place-items: center; min-width: 24px; min-height: 24px; border: 0; background: none; color: var(--app-muted); padding: 0.15rem; border-radius: 6px; line-height: 0; }
.row-remove:hover { color: var(--app-danger); background: var(--app-danger-soft); }
.row-add { justify-self: start; display: inline-flex; align-items: center; gap: 0.35rem; }

/* ---------- Image picker ---------- */

.picker-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }

.picker-choice {
    border: 1px solid var(--app-line);
    border-radius: 10px;
    background: #fff;
    padding: 0.4rem;
    display: grid;
    gap: 0.3rem;
    justify-items: center;
    font-size: 0.75rem;
    color: var(--app-muted);
}

.picker-choice img { width: 100%; height: 48px; object-fit: contain; }
.picker-choice[aria-pressed="true"] { border-color: var(--app-accent); box-shadow: 0 0 0 2px var(--app-accent-soft); color: var(--app-accent); font-weight: 650; }

.dropzone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 0.2rem;
    text-align: center;
    padding: 1rem;
    border: 1.5px dashed #b9c5df;
    border-radius: 12px;
    background: #fafbff;
    color: var(--app-muted);
    font-size: 0.85rem;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.dropzone .icon { color: var(--app-accent); }
.dropzone strong { color: var(--app-ink); }
.dropzone.is-over { border-color: var(--app-accent); background: var(--app-accent-soft); }
/* The file input is invisible over its label, so the zone shows the keyboard focus (WCAG 2.4.7). */
.dropzone:focus-within { outline: 2px solid var(--app-focus); outline-offset: 2px; }

.dropzone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Fonts and languages: one slot per script; a slot the chosen invoice needs is outlined. */
.font-slots { display: grid; gap: 0.6rem; }
.font-slot { border: 1px solid var(--app-line); border-radius: 12px; padding: 0.6rem 0.7rem; display: grid; gap: 0.4rem; }
.font-slot.is-needed { border-color: var(--cap-languages); background: var(--cap-languages-soft); }
.font-slot-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; font-size: 0.9rem; }
.font-slot-needed { font-size: 0.7rem; font-weight: 600; color: #11692f; border: 1px solid #11692f; border-radius: 6px; padding: 0 0.35rem; }
.font-slot-link { margin-left: auto; font-size: 0.8rem; display: inline-flex; align-items: center; gap: 0.2rem; }
.font-slot-file { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; min-width: 0; }
.font-slot-file .icon { color: var(--cap-languages); flex: none; }
.font-slot-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-slot .dropzone { padding: 0.5rem; font-size: 0.8rem; }
.segmented.wrap { flex-wrap: wrap; }
.missing-note { font-size: 0.8rem; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 9px; padding: 0.45rem 0.6rem; margin: 0; }
.prerequisites { padding-left: 1.1rem; margin: 0; }
.prerequisites li + li { margin-top: 0.35rem; }
.prerequisites code { font-size: 0.95em; overflow-wrap: anywhere; }

.upload-card {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: #fff;
}

.upload-card img { width: 64px; height: 48px; object-fit: contain; background: var(--app-canvas); border-radius: 6px; }
.upload-name { font-weight: 600; font-size: 0.85rem; overflow-wrap: anywhere; }
.upload-meta { font-size: 0.75rem; color: var(--app-muted); }
.upload-error { font-size: 0.82rem; color: var(--app-danger); }
.upload-reading { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; }

/* ---------- Home (D-026, D-027) ---------- */

/* The call to action: brand teal with dark teal text, 4.75:1. */
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: var(--app-teal);
    color: #04342c;
    font-weight: 650;
}
/* Hover lightens the teal, keeping 5.7:1 with the dark text. */
.btn-cta:hover { background: #26bc9f; color: #04342c; }

.hero {
    padding: 3.5rem 1.25rem 2.5rem;
    text-align: center;
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-line);
}
.hero h1 {
    max-width: 52rem;
    margin: 0.9rem auto 0.75rem;
    color: var(--app-accent);
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.12;
}
/* Large text in dark teal, 5.3:1 (brand teal itself is under 3:1 on white). */
.hero h1 span { color: var(--app-focus); }
.hero-lead { max-width: 40rem; margin: 0 auto; color: var(--app-muted); font-size: 1.1rem; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin: 1.5rem 0 2rem; }
.hero-actions .btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.hero-install { display: flex; justify-content: center; margin: -0.75rem 0 2rem; }

/* The release announcement above the headline (QF-26111209): a filled version pill, then what the release adds. */
.hero-release {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.25rem 0.3rem;
    border-radius: 999px;
    background: var(--app-teal-soft);
    color: var(--app-teal-ink);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.hero-release-version { padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--app-teal-ink); color: #ffffff; font-variant-numeric: tabular-nums; }
.hero-release:hover .hero-release-text { text-decoration: underline; }

/* The production illustration; width and height attributes reserve its 16:9 box before it loads. */
.showcase { max-width: 900px; margin: 0 auto; }
.showcase img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--app-line);
    box-shadow: 0 10px 30px rgba(0, 42, 115, 0.12);
    background: var(--app-canvas);
}

.section { max-width: 1200px; margin: 0 auto; padding: 2.75rem 1.25rem 0.5rem; }
.home-section { scroll-margin-top: calc(var(--app-topbar-h) + 1rem); }
.section-title { margin: 0 0 0.35rem; color: var(--app-accent); font-size: 1.65rem; font-weight: 750; letter-spacing: -0.015em; }
.section-title.is-centered { text-align: center; }
.section-lead { margin: 0 0 1.25rem; color: var(--app-muted); }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.25rem; }
.section-head .section-lead { margin-bottom: 0; }
.section-more { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 44px; font-weight: 700; text-decoration: none; }
.section-more:hover { text-decoration: underline; }

/* Why UnlimitedPDF: six tiles, three across from 900 px, two from 576 px. */
.benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.benefit { padding: 1.1rem 1.2rem; }
.benefit h3 { margin: 0 0 0.3rem; color: var(--app-accent); font-size: 1.05rem; font-weight: 700; }
.benefit p { margin: 0; color: var(--app-muted); font-size: 0.92rem; }

/* Three lines to your first PDF: the words and the install command beside the code. */
.first-pdf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: center; }
.first-pdf-code .code-view { height: auto; min-height: 0; border-radius: 14px; overflow: hidden; }
.first-pdf-code .code-view pre { height: auto; padding-top: 2.9rem; }

.install {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 100%;
    background: var(--app-code-bg);
    color: #dbe5ff;
    border-radius: 12px;
    padding: 0.55rem 0.6rem 0.55rem 1rem;
    font-family: var(--app-mono);
    font-size: 0.9rem;
}
.install code { color: inherit; white-space: nowrap; overflow: auto; }
.install code::before { content: "$ "; color: #9aa7c4; }
.install button { border: 1px solid rgba(219, 229, 255, 0.5); background: transparent; color: inherit; border-radius: 8px; padding: 0.25rem 0.55rem; display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--app-font); font-size: 0.8rem; }
.install button:hover { background: #1b2a47; }

/* Capability colors: an icon color and its soft background. Each icon color has at least 3:1 against its soft
   background (26111101 AC-20). */
:root {
    --cap-create: #2357e8;
    --cap-create-soft: #e8efff;
    --cap-merge: #0b7a72;
    --cap-merge-soft: #dff4f2;
    --cap-split: #9a5800;
    --cap-split-soft: #fff0d4;
    --cap-html: #7339cc;
    --cap-html-soft: #f0e8fd;
    --cap-languages: #15803d;
    --cap-languages-soft: #e3f5e9;
}

.tone-blue { --tone: var(--cap-create); --tone-soft: var(--cap-create-soft); }
.tone-teal { --tone: var(--cap-merge); --tone-soft: var(--cap-merge-soft); }
.tone-amber { --tone: var(--cap-split); --tone-soft: var(--cap-split-soft); }
.tone-purple { --tone: var(--cap-html); --tone-soft: var(--cap-html-soft); }
.tone-green { --tone: var(--cap-languages); --tone-soft: var(--cap-languages-soft); }

/* Capability rows (D-026): the icon, name, description, and every demo beside the code sample; one column below
   1,024 px, in the order name, description, demos, sample. */
.cap-rows { display: grid; gap: 1rem; }
.cap-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas: "intro code" "demos code";
    gap: 0.75rem 1.5rem;
    align-items: start;
    padding: 1.25rem 1.4rem;
    scroll-margin-top: calc(var(--app-topbar-h) + 1rem);
}
.cap-intro { grid-area: intro; }
.cap-code { grid-area: code; }
.cap-demos { grid-area: demos; }
.cap-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.35rem; }
.cap-icon { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.cap-head h3 { margin: 0; color: var(--app-accent); font-size: 1.25rem; font-weight: 750; }
.cap-lead { margin: 0; color: var(--app-muted); }
.cap-group-title { margin: 0.6rem 0 0.3rem; color: var(--app-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.cap-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.cap-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 36px;
    padding: 0.25rem 0.75rem 0.25rem 0.45rem;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    color: var(--app-accent);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.cap-link:hover { border-color: var(--app-accent); background: var(--app-accent-soft); }
.cap-link-icon { display: inline-flex; color: var(--tone, var(--app-accent)); }
/* The row keeps to names; each description is on its demo's page and read with the link. */
.cap-link-desc { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cap-code .code-view { height: auto; min-height: 0; border-radius: 12px; overflow: hidden; }
.cap-code .code-view pre { height: auto; max-height: 14rem; padding-top: 2.9rem; }

@media (max-width: 1023.98px) {
    .cap-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "demos" "code"; }
    .first-pdf { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
}

@media (max-width: 899.98px) {
    .benefits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The six popular scenarios: three across from 1,024 px. */
@media (min-width: 1024px) {
    .home-section .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* "How do I...?": two columns of questions, one on a phone. */
.questions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.question {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 1rem;
    min-height: 44px;
    padding: 0.75rem 1rem;
    color: var(--app-accent);
    font-weight: 600;
    text-decoration: none;
}
.question:hover { border-color: var(--app-accent); }
.question-demo { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--app-muted); font-size: 0.85rem; font-weight: 500; }

/* "More questions in the FAQ" at the end of "How do I...?". */
.questions-more { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 1rem; font-weight: 600; text-decoration: none; }
.questions-more:hover { text-decoration: underline; }

/* The FAQ band: white on brand navy, 13.3:1. */
.faq-band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 2.5rem;
    padding: 1.75rem 2rem;
    border-radius: 16px;
    background: var(--app-accent);
    color: #ffffff;
}
.faq-band h2 { margin: 0 0 0.35rem; font-size: 1.4rem; font-weight: 750; }
.faq-band p { margin: 0; max-width: 44rem; color: #dce5f5; }
.faq-band .btn-cta:focus-visible { outline-color: #ffffff; }

@media (max-width: 575.98px) {
    .hero { padding: 2.25rem 1rem 1.75rem; }
    .section { padding: 2rem 1rem 0.5rem; }
    .benefits, .questions { grid-template-columns: minmax(0, 1fr); }
    .install { font-size: 0.74rem; gap: 0.5rem; padding: 0.5rem 0.5rem 0.5rem 0.75rem; }
    .install button { padding: 0.3rem 0.5rem; min-height: 36px; }
    .hero h1 span { white-space: nowrap; }
    .faq-band { padding: 1.4rem 1.25rem; }
}

/* The narrowest phones (320 px): the command keeps fitting beside Copy. */
@media (max-width: 359.98px) {
    .install { font-size: 0.64rem; gap: 0.35rem; padding-left: 0.6rem; }
}

/* The site footer, on every page (MainLayout): the credit line, then the platform, license, and demo-data notes. */
.footer { border-top: 1px solid var(--app-line); padding: 1.5rem 1.25rem; text-align: center; color: var(--app-muted); font-size: 0.85rem; background: var(--app-surface); }
.footer p { margin: 0; }
.footer p + p { margin-top: 0.35rem; }
.footer a { text-decoration: underline; text-underline-offset: 2px; }
.footer-heart { fill: currentColor; color: var(--app-danger); vertical-align: -2px; }

/* A missing page: the code, what happened, the search, and the ways on. */
.not-found { max-width: 36rem; margin: 4rem auto; padding: 0 1.25rem; text-align: center; }
.not-found .not-found-code { margin: 0; color: var(--app-focus); font-size: 3.5rem; font-weight: 800; letter-spacing: -0.03em; }
.not-found h1 { margin: 0 0 0.5rem; color: var(--app-accent); font-size: 1.9rem; font-weight: 750; }
.not-found p { color: var(--app-muted); }
.not-found-search { margin: 1.5rem 0; text-align: left; }
.not-found-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

/* ---------- FAQ page ---------- */

.faq { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
.faq-head { margin-bottom: 1.5rem; }
.faq-head h1 { font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; margin: 0 0 0.35rem; }
.faq-head p { color: var(--app-muted); margin: 0; }

/* From 1,024 px the topic index is a column beside the questions; below it, a line of chips above the search box. */
.faq-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }

/* Room after the last topic, so choosing any topic in the index can bring its heading to the top of the view. */
.faq-main { padding-bottom: calc(100vh - var(--app-topbar-h) - 7rem); }

.faq-index { position: sticky; top: calc(var(--app-topbar-h) + 1.25rem); }
.faq-index-title { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--app-muted); margin-bottom: 0.5rem; }
.faq-index ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.faq-index a { display: block; padding: 0.35rem 0.75rem; border-left: 2px solid var(--app-line); color: var(--app-muted); text-decoration: none; font-size: 0.92rem; }
.faq-index a:hover { color: var(--app-ink); border-left-color: #c9d6f5; }
.faq-index a[aria-current="true"] { color: var(--app-accent); border-left-color: var(--app-accent); font-weight: 600; }

.faq-search { position: relative; }
.faq-search .icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--app-muted); pointer-events: none; }
.faq-search-input {
    width: 100%;
    min-height: 44px;
    padding: 0.55rem 0.9rem 0.55rem 2.6rem;
    border: 1px solid var(--app-field-border); /* 3.5:1 on white, like every other field (26111201 AC-01) */
    border-radius: 10px;
    background: var(--app-surface);
    color: var(--app-ink);
    font-size: 1rem;
}
.faq-search-input:focus { outline: none; border-color: var(--app-accent); box-shadow: 0 0 0 3px rgba(35, 87, 232, 0.2); }
.faq-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.faq-count { color: var(--app-muted); font-size: 0.85rem; margin: 0.5rem 0 0; }

.faq-empty { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem 1.25rem; margin-top: 1rem; }
.faq-empty p { margin: 0; }

.faq-group { margin-top: 1.75rem; scroll-margin-top: calc(var(--app-topbar-h) + 1rem); }
.faq-group h2 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.6rem; }
.faq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }

.faq-item { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 12px; scroll-margin-top: calc(var(--app-topbar-h) + 1rem); }
.faq-item.is-open { border-color: #c9d6f5; }

.faq-question { position: relative; display: flex; align-items: stretch; }

.faq-toggle {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem 0.85rem 1.1rem;
    border: 0;
    background: none;
    color: var(--app-ink);
    text-align: left;
    font-weight: 600;
    border-radius: 12px;
}
.faq-toggle .icon { flex: none; margin-left: auto; color: var(--app-muted); transition: transform 0.15s ease; }
.faq-item.is-open .faq-toggle .icon { transform: rotate(180deg); }
.faq-toggle:focus-visible, .faq-link:focus-visible { outline: 2px solid var(--app-accent); outline-offset: -2px; }
.faq-question-text { min-width: 0; }

.faq-not-yet { flex: none; font-size: 0.75rem; font-weight: 650; background: var(--app-warn-soft); color: #7a5200; border-radius: 6px; padding: 0.1rem 0.45rem; }

/* The copy-link control: a link icon in the muted color, 5.6:1 on white (26111201 AC-02). */
.faq-link { flex: none; width: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--app-muted); border-radius: 12px; }
.faq-link:hover { color: var(--app-accent); }
/* Kept rendered while empty, so screen readers hear the text when it arrives. */
.faq-link-status:empty { padding: 0; background: none; }
.faq-link-status {
    position: absolute;
    right: 0.5rem;
    top: -0.9rem;
    background: var(--app-ink);
    color: #fff;
    font-size: 0.75rem;
    border-radius: 6px;
    padding: 0.15rem 0.5rem;
    pointer-events: none;
}

.faq-answer { padding: 0 1.1rem 1rem; color: var(--app-muted); line-height: 1.6; }
.faq-answer p { margin: 0 0 0.6rem; }
.faq-code { margin: 0.25rem 0 0.75rem; }
.faq-code .code-view { height: auto; min-height: 0; border-radius: 10px; overflow: hidden; }
.faq-code .code-view pre { height: auto; padding: 2.6rem 1rem 1rem; overflow-x: auto; }
.faq-demo { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; text-decoration: none; }
.faq-demo:hover { text-decoration: underline; }

@media (max-width: 1023.98px) {
    .faq-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .faq-main { padding-bottom: 0; }
    .faq-index { position: static; }
    .faq-index-title { display: none; }
    .faq-index ul { flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
    .faq-index a { border: 1px solid var(--app-line); border-radius: 999px; background: var(--app-surface); padding: 0.3rem 0.8rem; font-size: 0.85rem; color: var(--app-ink); }
    .faq-index a[aria-current="true"] { border-color: var(--app-line); color: var(--app-ink); font-weight: 400; }
}

@media (max-width: 575.98px) {
    .faq { padding: 1.5rem 0.9rem 2rem; }
    .faq-head h1 { font-size: 1.55rem; }
    .faq-toggle { padding: 0.8rem 0.25rem 0.8rem 0.9rem; }
    .faq-index a { display: inline-flex; align-items: center; min-height: 44px; } /* topic chips (26111201 AC-03) */
    .faq-answer { padding: 0 0.9rem 0.9rem; }
    .faq-code .code-view pre { font-size: 0.76rem; padding: 2.5rem 0.8rem 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
    .faq-toggle .icon { transition: none; }
}

/* ---------- Shared ---------- */

.spinner-sm-inline { width: 1rem; height: 1rem; border-width: 2px; }

#blazor-error-ui {
    color-scheme: light only;
    background: #fff6e0;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.5rem; top: 0.25rem; min-width: 44px; min-height: 44px; border: 0; background: none; color: inherit; }

/* ---------- Phone tap targets (26111103 AC-05) ---------- */

/* Phone tap targets: every shared and playground control is at least 44 px on a phone (26111103 AC-05). Desktop
   sizes are unchanged. Home's own controls follow in the Home section. */
@media (max-width: 575.98px) {
    .brand { min-width: 44px; min-height: 44px; justify-content: center; }
    .version-link { min-height: 44px; }
    .topnav-link { min-height: 44px; }
    .btn { align-items: center; justify-content: center; min-height: 44px; }
    .breadcrumbs a { min-height: 44px; }
    .site-search .site-search-field { min-height: 44px; }
    .demo-choice-option { min-height: 44px; }
    .form-control, .form-select { min-height: 44px; }
    .field input[type="color"] { height: 44px; }
    input[type="file"] { min-height: 44px; }
    input[type="file"]::file-selector-button { min-height: 44px; }
    .segmented button { min-height: 44px; }
    .scenario-list a { display: flex; align-items: center; min-height: 44px; }
    .check-field { min-height: 44px; }
    .row-remove { min-width: 44px; min-height: 44px; }
    /* The Copy button keeps its drawn size so it covers no code; a transparent layer around it is the 44 px target. */
    .code-copy::before { content: ""; position: absolute; inset: -7px -4px; }
}

/* Home's own phone tap targets: the install Copy button, the demo links of the capability rows, and the link to the
   FAQ (26111103 AC-05), and the release announcement (QF-26111209). */
@media (max-width: 575.98px) {
    .hero-release { min-height: 44px; }
    .install button { min-height: 44px; }
    .cap-link { min-height: 44px; }
    .questions-more { min-height: 44px; }
}

/* A demo's variants (a document type, a pack's domain): a labelled row of links, the current one filled. */
.demo-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1rem; }
.demo-choice-label { font-weight: 600; color: var(--app-ink); }
.demo-choice-options { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.demo-choice-option {
    display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0.3rem 0.85rem;
    border: 1px solid var(--app-field-border); border-radius: 999px; background: var(--app-surface);
    color: var(--app-ink); font-size: 0.9rem; text-decoration: none;
}
.demo-choice-option:hover { border-color: var(--app-accent); background: var(--app-accent-soft); }
.demo-choice-option[aria-current="page"] { border-color: var(--app-accent); background: var(--app-accent); color: #fff; font-weight: 600; }

/* ---------- Site-wide search (D-024) ---------- */

.site-search { position: relative; }
.site-search-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 0.75rem;
    border: 1px solid var(--app-field-border);
    border-radius: 10px;
    background: var(--app-surface);
    color: var(--app-muted);
}
.site-search-field:focus-within { outline: 2px solid var(--app-focus); outline-offset: 2px; }
.site-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--app-ink);
    font-size: 0.95rem;
}
/* The field shows the ring for the box as a whole. */
.site-search-input:focus-visible { outline: none; }
.site-search-input::placeholder { color: var(--app-muted); opacity: 1; }
.site-search-key {
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--app-line);
    border-radius: 6px;
    background: var(--app-canvas);
    color: var(--app-muted);
    font-family: var(--app-font);
    font-size: 0.75rem;
    white-space: nowrap;
}
.site-search-results {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    right: 0;
    z-index: 25;
    max-height: min(70vh, 32rem);
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: var(--app-surface);
    box-shadow: 0 12px 32px rgba(0, 42, 115, 0.16);
}
.site-search-results[hidden] { display: none; }
.site-search-group {
    margin: 0.4rem 0.5rem 0.2rem;
    color: var(--app-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.site-search-list { margin: 0; padding: 0; list-style: none; }
.site-search-result {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-height: 44px;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    color: var(--app-ink);
    text-decoration: none;
}
.site-search-result:hover, .site-search-result:focus-visible { background: var(--app-accent-soft); }
.site-search-result:focus-visible { outline-offset: -2px; }
.site-search-title { color: var(--app-accent); font-weight: 650; }
.site-search-detail { color: var(--app-muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.site-search-detail.is-code { font-family: var(--app-mono); font-size: 0.8rem; }
.site-search-result mark { padding: 0; background: var(--app-mark); color: inherit; font-weight: 700; }
.site-search-empty { margin: 0.5rem; color: var(--app-muted); }

/* In the drawer the results take the drawer's width, below the box. */
.site-menu .site-search-results { position: static; margin-top: 0.4rem; box-shadow: none; max-height: none; }

/* ---------- Scenario gallery (D-022) ---------- */

.gallery { max-width: 1240px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.gallery-head h1 { margin: 0 0 0.4rem; color: var(--app-accent); font-size: clamp(1.8rem, 3vw, 2.4rem); }
.gallery-lead { max-width: 44rem; margin: 0 0 1.25rem; color: var(--app-muted); font-size: 1.05rem; }

.gallery-tabs ul, .gallery-chips ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.gallery-tabs ul { gap: 0.25rem 1.25rem; border-bottom: 1px solid var(--app-line); }
.gallery-tab {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--app-muted);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.gallery-tab:hover { color: var(--app-accent); }
.gallery-tab[aria-current="page"] { color: var(--app-accent); font-weight: 700; border-bottom-color: var(--app-focus); }

.gallery-chips ul { gap: 0.5rem; margin: 1rem 0 0.75rem; }
.gallery-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.25rem 0.9rem;
    border: 1px solid #8a94a6;
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-ink);
    font-size: 0.9rem;
    text-decoration: none;
}
.gallery-chip:hover { border-color: var(--app-accent); }
.gallery-chip[aria-current="page"] { border-color: var(--app-accent); background: var(--app-accent); color: #fff; font-weight: 600; }

.gallery-count { margin: 0 0 1rem; color: var(--app-muted); font-size: 0.9rem; }
.gallery-empty { padding: 2rem; border: 1px dashed var(--app-field-border); border-radius: var(--app-radius); text-align: center; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* The whole card opens the demo: the title link's area covers it, and the card shows the link's focus ring. */
.scenario-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius);
    background: var(--app-surface);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.scenario-card:hover { border-color: #b9c7e0; box-shadow: 0 8px 22px rgba(0, 42, 115, 0.1); }
.scenario-card:focus-within { outline: 2px solid var(--app-focus); outline-offset: 2px; }
.scenario-link { color: var(--app-accent); text-decoration: none; }
.scenario-link::after { content: ""; position: absolute; inset: 0; }
.scenario-link:focus-visible { outline: none; }
.scenario-thumb {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 150px;
    overflow: hidden;
    background: var(--tone-soft, var(--app-accent-soft));
    color: var(--tone, var(--app-accent));
}
.scenario-thumb img { width: 78%; height: auto; margin-top: 2.25rem; border-radius: 4px 4px 0 0; box-shadow: 0 2px 10px rgba(0, 42, 115, 0.18); }
.tone-navy { --tone: var(--app-accent); --tone-soft: var(--app-accent-soft); }
.scenario-body { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.9rem 1rem 1rem; flex: 1 1 auto; }
.scenario-title { margin: 0; font-size: 1.05rem; font-weight: 700; }
.scenario-desc { margin: 0; color: var(--app-muted); font-size: 0.9rem; }
.scenario-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; margin: auto 0 0; padding-top: 0.35rem; font-size: 0.8rem; }
.scenario-capability { color: var(--app-muted); font-weight: 600; }
.scenario-tags { color: var(--app-teal-ink); font-weight: 650; }

@media (max-width: 575.98px) {
    .gallery { padding: 1.25rem 1rem 2rem; }
    .gallery-grid { grid-template-columns: 1fr; }
    .gallery-chip { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .scenario-card { transition: none; }
}

/* KPI report: the twelve monthly figures in three columns. */
.kpi-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 0.6rem; }

/* Phone tap targets for controls whose base rules come later in this file, so these win (26111103 AC-05). */
@media (max-width: 575.98px) {
    .demo-choice .demo-choice-option { min-height: 44px; }
    .breadcrumbs a { min-height: 44px; min-width: 44px; }
    .gallery-tabs .gallery-tab { min-height: 44px; min-width: 44px; justify-content: center; }
    .stale-note button { min-height: 44px; }
    .font-slot-link { min-height: 44px; }
    .faq-demo { min-height: 44px; }
    .field-hint > a { min-height: 44px; }
    .site-search .site-search-field { min-height: 44px; height: 48px; }
}
