/* Shared "Field Manual" design system for the three audience-specific
   guides (FieldOpsGuide, AdminGuide, ContestGuide) and the /Help landing
   page. Originally authored as a one-off inline <style> block in the old
   standalone wwwroot/UserGuide.html; extracted here so all three guides
   (plus any guide added later) share one consistent look instead of each
   carrying its own copy. See project_documentation_guides memory for the
   initiative this belongs to. */

:root {
    --paper: #eef2f1;
    --paper-raised: #ffffff;
    --ink: #142023;
    --ink-muted: #4b5c5a;
    --accent: #1f7a6c;
    --accent-wash: #dcebe7;
    --line: #c3d2cf;
    --warn: #a8621f;
    --warn-wash: #f3e6d7;
    --font-display: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Helvetica Neue", sans-serif;
    --font-body: Charter, Georgia, "Iowan Old Style", "Times New Roman", serif;
    --font-mono: "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0f1614;
        --paper-raised: #16201e;
        --ink: #dce8e5;
        --ink-muted: #8ea6a1;
        --accent: #52d6c6;
        --accent-wash: #16302c;
        --line: #29403c;
        --warn: #d99a52;
        --warn-wash: #2c2118;
    }
}

.guidePage * { box-sizing: border-box; }

.guidePage {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

@media (prefers-reduced-motion: no-preference) {
    .guidePage { scroll-behavior: smooth; }
}

.guidePage a { color: var(--accent); }
.guidePage a:focus-visible, .guidePage button:focus-visible, .guidePage summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.guidePage .page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 48px 24px 96px;
}

/* --- Masthead --- */

.guidePage .masthead {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 640px;
    margin-bottom: 56px;
}

.guidePage .eyebrow {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
    color: var(--accent);
    margin: 0;
}

.guidePage .masthead h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.1rem, 4.2vw, 3rem);
    letter-spacing: 0.005em;
    line-height: 1.05;
    margin: 0;
    text-wrap: balance;
}

.guidePage .lede {
    color: var(--ink-muted);
    font-size: 1.05rem;
    margin: 0;
    max-width: 58ch;
}

.guidePage .mastheadLinks {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.guidePage .mastheadLinks a {
    font-family: var(--font-display);
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.guidePage .mastheadLinks a:hover { text-decoration: underline; }

.guidePage .signalmeter {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 26px;
    margin-top: 6px;
}
.guidePage .signalmeter span {
    display: block;
    width: 7px;
    background: var(--line);
    border-radius: 1px;
}
.guidePage .signalmeter span:nth-child(1) { height: 30%; }
.guidePage .signalmeter span:nth-child(2) { height: 48%; }
.guidePage .signalmeter span:nth-child(3) { height: 66%; background: var(--accent); opacity: 0.55; }
.guidePage .signalmeter span:nth-child(4) { height: 84%; background: var(--accent); opacity: 0.75; }
.guidePage .signalmeter span:nth-child(5) { height: 100%; background: var(--accent); }

/* --- Layout: TOC rail + content --- */

.guidePage .layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 48px;
    align-items: start;
}

@media (max-width: 860px) {
    .guidePage .layout { grid-template-columns: 1fr; }
}

.guidePage .toc {
    position: sticky;
    top: 32px;
    border-right: 1px solid var(--line);
    padding-right: 20px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
}
@media (max-width: 860px) {
    .guidePage .toc {
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 8px;
        max-height: none;
    }
}

.guidePage .toc-label {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--ink-muted);
    margin: 0 0 10px;
}

.guidePage .toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    counter-reset: toc;
}
@media (max-width: 860px) {
    .guidePage .toc ol {
        flex-direction: row;
        flex-wrap: wrap;
        column-gap: 18px;
    }
}

.guidePage .toc a {
    counter-increment: toc;
    text-decoration: none;
    color: var(--ink-muted);
    font-size: 0.93rem;
    display: flex;
    gap: 8px;
}
.guidePage .toc a::before {
    content: counter(toc, decimal-leading-zero);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--accent);
    flex-shrink: 0;
}
.guidePage .toc a:hover { color: var(--ink); }

/* --- Content --- */

.guidePage .content { max-width: 66ch; }

.guidePage .content > section {
    padding-top: 6px;
    margin-bottom: 44px;
    scroll-margin-top: 20px;
}
.guidePage .content > section + section {
    border-top: 1px solid var(--line);
    padding-top: 38px;
}

.guidePage .section-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    margin: 0 0 4px;
}

.guidePage h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    letter-spacing: 0.01em;
    margin: 0 0 14px;
    text-wrap: balance;
}

.guidePage h3 {
    font-family: var(--font-display);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.92rem;
    color: var(--ink-muted);
    margin: 28px 0 12px;
}

.guidePage p { margin: 0 0 14px; }
.guidePage ul { margin: 0 0 14px; padding-left: 1.3em; }
.guidePage li { margin-bottom: 6px; }
.guidePage li > ul { margin-top: 6px; }

.guidePage strong { font-weight: 700; }

.guidePage code {
    font-family: var(--font-mono);
    background: var(--accent-wash);
    color: var(--accent);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.88em;
}

.guidePage kbd {
    font-family: var(--font-mono);
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    color: var(--ink);
    padding: 0.05em 0.5em;
    border-radius: 5px;
    font-size: 0.84em;
}

/* --- Reference tables --- */

.guidePage .table-wrap {
    overflow-x: auto;
    margin: 0 0 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.guidePage table {
    border-collapse: collapse;
    width: 100%;
    min-width: 420px;
    background: var(--paper-raised);
}

.guidePage th, .guidePage td {
    text-align: left;
    padding: 9px 14px;
    font-size: 0.94rem;
    border-bottom: 1px solid var(--line);
}

.guidePage th {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    color: var(--ink-muted);
    background: var(--accent-wash);
}

.guidePage tr:last-child td { border-bottom: none; }
.guidePage td:first-child { white-space: nowrap; }

/* --- Callouts --- */

.guidePage .callout {
    border-left: 3px solid var(--warn);
    background: var(--warn-wash);
    padding: 12px 18px;
    border-radius: 0 6px 6px 0;
    margin: 0 0 18px;
}
.guidePage .callout p:last-child { margin-bottom: 0; }
.guidePage .callout-label {
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    color: var(--warn);
    margin: 0 0 6px;
}

.guidePage footer {
    max-width: 66ch;
    margin-left: auto;
    color: var(--ink-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 12px;
}
@media (max-width: 860px) { .guidePage footer { margin-left: 0; } }

/* --- /Help landing page cards (shares the masthead/page shell above) --- */

.guidePage .guideCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.guidePage .guideCard {
    background: var(--paper-raised);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guidePage .guideCard h2 {
    font-size: 1.2rem;
    margin: 0;
}
.guidePage .guideCard p {
    color: var(--ink-muted);
    font-size: 0.95rem;
    margin: 0;
    flex-grow: 1;
}
.guidePage .guideCardLinks {
    display: flex;
    gap: 16px;
    margin-top: 4px;
}
.guidePage .guideCardLinks a {
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.85rem;
}
.guidePage .guideCardLinks a:hover { text-decoration: underline; }

/* --- Print --- */

@media print {
    .guidePage {
        background: #ffffff;
        color: #142023;
    }
    .guidePage .layout {
        display: block;
    }
    .guidePage .toc {
        position: static;
        border-right: none;
        border-bottom: 1px solid #c3d2cf;
        padding: 0 0 16px;
        margin-bottom: 24px;
        max-height: none;
        overflow: visible;
        page-break-after: always;
    }
    .guidePage .toc ol {
        flex-direction: column !important;
    }
    .guidePage .content > section {
        break-inside: avoid-page;
        page-break-before: always;
    }
    .guidePage .content > section:first-child {
        page-break-before: avoid;
    }
    .guidePage .content > section + section {
        border-top: none;
    }
    .guidePage .mastheadLinks {
        display: none;
    }
    .guidePage a {
        color: #142023;
    }
    .guidePage a[href]::after {
        content: "";
    }
}
