/* ============================================================================
   quick-score.css — Fatigue Quick Score (tools/quick-score.html)
   ----------------------------------------------------------------------------
   The page frame and the result. The form above the result is the first page
   the Full Assessment shares, styled by frms-system/css/flight-setup.css.
   History: FRMS restructure phase 2a (2026-09-14) cut the old calculator
   sheet to this; on 2026-09-15 Quick Score became its own tool and its form
   rules moved to the shared sheet.

   Every colour is a css/tokens.css token.
   ============================================================================ */

/* The AA-safe secondary ink the FRMS pages share (FRMS-049 / Structural D). */
:root {
    --text-secondary: #586576;
    --text-muted: #586576;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Quiet page header: 22px/700 ink title, subtitle. */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--line);
}
.page-header-text { min-width: 0; }
/* The weight is the title token (css/kit.css owns #main-content h1). */
.page-header-title {
    font-size: 22px;
    font-weight: var(--weight-title);
    line-height: 1.25;
    color: var(--text-heading);
    margin: 0;
}
.page-header-subtitle {
    margin: var(--spacing-xs) 0 0 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 72ch;
}
.page-header-subtitle a { color: var(--accent); }

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.btn {
    padding: 0.75rem 1.5rem;
    background-color: var(--accent);
    color: var(--text-inverse);
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn:hover { background-color: var(--accent-deep); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
    background-color: var(--surface);
    color: var(--accent);
    border-color: var(--line-strong);
}
.btn-secondary:hover { background-color: var(--accent-soft); border-color: var(--accent-light); }
.btn:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.qs-actions {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

/* ── Results ────────────────────────────────────────────────────────── */
#results { margin-top: var(--spacing-lg); }

.qs-stale {
    margin-bottom: var(--spacing-md);
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--warn-ink);
    background: var(--warn-bg);
    border-radius: var(--radius-md);
}
.qs-stale[hidden] { display: none; }
.qs-results.is-stale .qs-total,
.qs-results.is-stale .qs-summary,
.qs-results.is-stale .qs-table-wrap { opacity: 0.55; }

.qs-results-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
}
.qs-results-head h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
}
.qs-results-route { color: var(--text-secondary); font-size: 0.875rem; }

.qs-total {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    align-items: baseline;
    column-gap: 2px;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    min-width: 160px;
}
.qs-total-value { font-size: 2.25rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.qs-total-max { font-size: 1rem; font-weight: 500; opacity: 0.8; }
.qs-total-band { grid-column: 1 / -1; font-size: 0.875rem; font-weight: 600; margin-top: 0.25rem; }
.qs-total-ok   { background: var(--ok-bg);   color: var(--ok-ink); }
.qs-total-warn { background: var(--warn-bg); color: var(--warn-ink); }
.qs-total-bad  { background: var(--bad-bg);  color: var(--bad-ink); }
.qs-total-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }
/* What the band calls for: reports a hazard and says who to tell; never rules on the pilot. */
.qs-action { margin: 0 0 1rem; font-weight: 600; color: var(--ink); }
.qs-action-bad { color: var(--bad-ink); }
.qs-factors .qs-group th {
    padding-top: 0.875rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: normal;
}
.qs-factors .qs-row-note { display: block; font-weight: 400; white-space: normal; }
.qs-notes { margin: 0.75rem 0 0; padding-left: 1.1rem; font-size: 0.8125rem; color: var(--ink-muted); }
.qs-notes li { margin: 0.2rem 0; }

/* Eight facts: two or four to a row, so none sits alone. */
.qs-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-md) var(--spacing-lg);
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-lg);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
@media (min-width: 700px) {
    .qs-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.qs-summary dt {
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.125rem;
}
.qs-summary dd { color: var(--ink); font-size: 0.9375rem; }
.qs-dim { color: var(--ink-muted); font-size: 0.8125rem; }
.qs-summary .qs-dim { display: block; white-space: nowrap; }

.qs-table-wrap { overflow-x: auto; }
.qs-factors {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.qs-factors th,
.qs-factors td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
.qs-factors thead th {
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-muted);
}
.qs-factors tbody th { font-weight: 500; color: var(--ink); white-space: nowrap; }
.qs-factors tfoot th,
.qs-factors tfoot td { font-weight: 700; color: var(--ink); border-bottom: none; }
.qs-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qs-factors th.qs-num,
.qs-factors td.qs-num { text-align: right; }

.qs-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.qs-next p { flex: 1 1 28rem; max-width: 72ch; font-size: 0.875rem; line-height: 1.5; }
.qs-next a { color: var(--accent); font-weight: 600; }

/* No page-level horizontal scroll at 375px: on a phone the factor names
   wrap, so the points stay on screen. */
@media (max-width: 480px) {
    .container { padding: var(--spacing-md); }
    .card { padding: var(--spacing-md); }
    .qs-factors th,
    .qs-factors td { padding: 0.5rem 0.375rem; }
    .qs-factors tbody th { white-space: normal; }
    .qs-next .btn { width: 100%; }
}

/* FRMS-051: honour prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
