/*
 * Fire Hydraulics Toolkit site styles.
 * Tokens from projects/fire-hydraulics-toolkit/DESIGN.md ("Hydrant Class Colors"):
 * cast-iron ground, white cards, ink, muted ink, divider, field outline, cell,
 * band iron, shortfall and hatch, light and dark exactly as the app's palette.
 * Chrome yellow #F2C230 is kept for the top bar (ink on yellow in both themes,
 * as in the app) and the active-step marker only. The bonnet colours
 * (AA #4FA3E0, A #2E9E5B, B #F07F1E, C #D2342A) appear only as the hydrant
 * flow-class scale, and every swatch carries its class letter in an ink badge.
 * Type: Archivo (400, 600, 700) for interface text, Archivo Narrow (700) for
 * figures and labels, tabular numerals on numbers only.
 * Motif: the result card's bonnet-cap band (rounded top, flat bottom).
 * Fonts: SIL Open Font License, licenses/Archivo-OFL.txt and
 * licenses/ArchivoNarrow-OFL.txt.
 */

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fire-hydraulics-toolkit/fonts/Archivo-400.woff2") format("woff2");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fire-hydraulics-toolkit/fonts/Archivo-600.woff2") format("woff2");
}

@font-face {
    font-family: "Archivo";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fire-hydraulics-toolkit/fonts/Archivo-700.woff2") format("woff2");
}

@font-face {
    font-family: "Archivo Narrow";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fire-hydraulics-toolkit/fonts/ArchivoNarrow-700.woff2") format("woff2");
}

:root {
    color-scheme: light dark;

    --chrome: #F2C230;
    --on-chrome: #1C232A;
    --on-chrome-muted: #3A3418;
    --ground: #EEECE7;
    --card: #FFFFFF;
    --ink: #1C232A;
    --muted: #4A535C;
    --divider: #E4E1DA;
    --outline: #767C82;
    --cell: #F4F2EE;
    --band-iron: #D6D2C8;
    --on-band-iron: #1C232A;
    --shortfall: #1C232A;
    --on-shortfall: #FFFFFF;
    --hatch: #343D46;
    --badge: #1C232A;
    --on-badge: #FFFFFF;
    --badge-outline: #1C232A;

    --bonnet-aa: #4FA3E0;
    --bonnet-a: #2E9E5B;
    --bonnet-b: #F07F1E;
    --bonnet-c: #D2342A;

    --body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --figure: "Archivo Narrow", "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --r-small: 6px;
    --r-field: 8px;
    --r-card: 16px;

    --wrap: 72rem;
    --gutter: 1.25rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #1A1D20;
        --card: #24282C;
        --ink: #EDE9E1;
        --muted: #B5B0A6;
        --divider: #353A3F;
        --outline: #8C939A;
        --cell: #2E3338;
        --band-iron: #3A4046;
        --on-band-iron: #EDE9E1;
        --shortfall: #DAD5CB;
        --on-shortfall: #1C232A;
        --hatch: #C2BCB0;
        --badge-outline: #B5B0A6;
    }
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 1rem;
}

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--body);
    font-size: 1.0625rem;
    line-height: 1.55;
    overflow-wrap: break-word;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

svg {
    flex: none;
}

a {
    color: var(--ink);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 3px;
    border-radius: 4px;
}

h1,
h2,
h3 {
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
    text-wrap: balance;
    hyphens: none;
}

h1 {
    font-size: clamp(min(2.125rem, 8.5vw), 1rem + 3vw, 3.375rem);
    line-height: 1.06;
}

h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.25;
}

p {
    margin: 0 0 1rem;
}

p:last-child {
    margin-bottom: 0;
}

ul,
ol {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}

sub,
sup {
    line-height: 0;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -10rem;
    z-index: 10;
    padding: 0.75rem 1.25rem;
    background: var(--card);
    color: var(--ink);
    border: 2px solid var(--ink);
    border-radius: var(--r-field);
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
}

/* Small label, the app's section titles ("Test readings", "Hand method") */
.label {
    display: block;
    margin: 0 0 0.625rem;
    font-family: var(--figure);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.answer {
    font-size: 1.125rem;
    max-width: 66ch;
}

.detail {
    color: var(--muted);
    max-width: 66ch;
}

/* ---------- Top bar: chrome yellow with ink, both themes ---------- */

.topbar {
    background: var(--chrome);
    color: var(--on-chrome);
}

.topbar .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.topbar :focus-visible {
    outline-color: var(--on-chrome);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 48px;
    min-width: 0;
    color: var(--on-chrome);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1875rem;
}

.brand img {
    border-radius: 8px;
    outline: 1px solid var(--on-chrome-muted);
}

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--on-chrome);
    text-decoration: none;
    font-weight: 600;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.35em;
}

/* ---------- Hero ---------- */

.hero {
    padding: 2.5rem 0 3rem;
    border-bottom: 1px solid var(--divider);
}

.hero-grid {
    display: grid;
    gap: 2.5rem;
    align-items: center;
}

.hero-copy {
    min-width: 0;
}

.hero .sub {
    font-size: 1.1875rem;
    color: var(--muted);
    max-width: 46ch;
    margin: 1rem 0 1.5rem;
}

.hero-shot {
    justify-self: center;
    width: min(100%, 20rem);
}

.hero-shot img,
.shot img {
    border: 1px solid var(--outline);
    border-radius: var(--r-card);
    background: var(--card);
}

/* Availability: early-build status card above the Play badge */
.status {
    max-width: 46ch;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--outline);
    border-radius: var(--r-card);
    overflow: hidden;
}

.status .cap {
    margin: 0;
}

.status p {
    padding: 0 1.25rem;
}

.status p:last-child {
    padding-bottom: 1.125rem;
}

/* Official Google Play badge: unmodified art with its own clear space */
.play-badge {
    display: inline-block;
    padding: 4px;
    margin: -4px;
    border-radius: 8px;
    line-height: 0;
}

.play-badge img {
    width: 188px;
    height: 56px;
}

.hero-copy .play-badge {
    margin-top: 1.25rem;
}

.cta .play-badge,
.footer-top .play-badge {
    margin-top: 0.75rem;
}

/* ---------- Bonnet-cap band (the result card's signature) ---------- */

.card {
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--divider);
    border-radius: var(--r-card);
    overflow: hidden;
    min-width: 0;
}

.card .body {
    padding: 1rem 1.25rem 1.25rem;
}

.card p {
    color: var(--ink);
}

.cap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    min-height: 2.5rem;
    padding: 0.5rem 1.25rem;
    background: var(--band-iron);
    color: var(--on-band-iron);
    font-weight: 700;
    font-size: 0.9375rem;
    margin: 0 0 1rem;
}

.cap-short {
    background-color: var(--shortfall);
    background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 9px);
    color: var(--on-shortfall);
}

.cap-short span {
    background: var(--shortfall);
    padding: 0 0.375rem;
    border-radius: var(--r-small);
}

.cap-yellow {
    background: var(--chrome);
}

/* Band ink wins over card and notice paragraph ink */
.card .cap,
.notice .cap,
.status .cap {
    color: var(--on-band-iron);
}

.cap.cap-short,
.card .cap.cap-short,
.notice .cap.cap-short {
    color: var(--on-shortfall);
}

.cap.cap-yellow,
.card .cap.cap-yellow,
.status .cap.cap-yellow {
    color: var(--on-chrome);
}

/* ---------- Sections ---------- */

.section {
    padding: 3rem 0;
    border-bottom: 1px solid var(--divider);
}

.section:last-of-type {
    border-bottom: 0;
}

.section-head {
    max-width: 66ch;
    margin-bottom: 1.75rem;
}

.split {
    display: grid;
    gap: 2rem;
    align-items: start;
}

.split > * {
    min-width: 0;
}

.calcs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.calcs h3 {
    margin-bottom: 0.5rem;
}

.std {
    display: inline-block;
    padding: 0 0.4rem;
    border: 1px solid var(--outline);
    border-radius: var(--r-small);
    font-family: var(--figure);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--ink);
    vertical-align: 0.15em;
    white-space: nowrap;
}

.features {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--divider);
}

.features li {
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--divider);
}

/* Hand method: numbered steps in one card */
.steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
}

.steps li {
    position: relative;
    counter-increment: step;
    padding: 0.75rem 0 0.75rem 2.75rem;
    border-bottom: 1px solid var(--divider);
}

.steps li:last-child {
    border-bottom: 0;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.625rem;
    width: 1.875rem;
    height: 1.875rem;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--figure);
    font-weight: 700;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
}

.steps li.active::before {
    background: var(--chrome);
    color: var(--on-chrome);
    border-color: var(--on-chrome);
}

.steps strong {
    display: block;
}

.steps span {
    color: var(--muted);
    font-size: 0.9375rem;
}

/* Hydrant flow-class scale: colour plus its letter, never colour alone */
.scale {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.375rem;
}

.scale li {
    min-width: 0;
    border-radius: var(--r-small);
    padding: 0.5rem 0.25rem;
    display: grid;
    place-items: center;
}

.scale .c { background: var(--bonnet-c); }
.scale .b { background: var(--bonnet-b); }
.scale .a { background: var(--bonnet-a); }
.scale .aa { background: var(--bonnet-aa); }

.letter {
    display: inline-block;
    min-width: 2.25rem;
    padding: 0.125rem 0.375rem;
    border: 1.5px solid var(--badge-outline);
    border-radius: var(--r-small);
    background: var(--badge);
    color: var(--on-badge);
    font-family: var(--figure);
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.scale-note {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Early-build notice */
.notice {
    border: 2px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    border-radius: var(--r-card);
    overflow: hidden;
    max-width: 72ch;
}

.notice .cap {
    margin: 0;
}

.notice .body {
    padding: 1.25rem 1.5rem;
}

.notice p {
    color: var(--ink);
}

/* Gallery */
.gallery {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.shot {
    margin: 0;
    min-width: 0;
}

.shot figcaption {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* Sibling calculators */
.siblings {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.siblings a {
    font-weight: 700;
}

/* Question links */
.qlinks {
    list-style: none;
    margin: 0;
    padding: 0;
}

.qlinks a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--divider);
    color: var(--ink);
    text-decoration: none;
    font-weight: 600;
}

.qlinks a:hover span {
    text-decoration: underline;
}

.qlinks svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Closing band */
.cta {
    padding: 3rem 0;
    border-top: 1px solid var(--divider);
}

.cta h2 {
    margin-bottom: 1rem;
}

/* ---------- Inner pages ---------- */

.page-head {
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid var(--divider);
}

.crumbs ol {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.9375rem;
    color: var(--muted);
}

.crumbs li {
    display: inline-flex;
    align-items: center;
}

.crumbs li + li::before {
    content: "›";
    padding: 0 0.5rem;
}

.crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--muted);
}

.page-head .answer {
    margin-top: 1rem;
}

.ledger > section {
    padding: 2.25rem 0;
    border-bottom: 1px solid var(--divider);
    scroll-margin-top: 1rem;
}

.ledger > section:last-child {
    border-bottom: 0;
}

.ledger h2 {
    max-width: 34ch;
}

.ledger h3 {
    margin: 1.5rem 0 0.5rem;
}

.ledger .card {
    max-width: 44rem;
    margin: 1.25rem 0;
}

.limits {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    max-width: 75ch;
    border-top: 1px solid var(--divider);
    counter-reset: lim;
}

.limits li {
    padding: 0.875rem 0 0.875rem 2.75rem;
    border-bottom: 1px solid var(--divider);
    position: relative;
    counter-increment: lim;
}

.limits li::before {
    content: counter(lim);
    position: absolute;
    left: 0;
    top: 0.875rem;
    min-width: 2rem;
    font-family: var(--figure);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

/* ---------- Footer ---------- */

.footer {
    background: var(--card);
    color: var(--ink);
    padding: 2.5rem 0 3rem;
    border-top: 1px solid var(--divider);
}

.footer-top {
    margin-bottom: 1rem;
}

.footer-top p {
    margin: 0;
}

.footer-top strong {
    font-size: 1.25rem;
}

.footer-links {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
}

.footer-links a {
    overflow-wrap: anywhere;
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    color: var(--ink);
}

.fine {
    font-size: 0.875rem;
    color: var(--muted);
}

.fine p {
    margin-bottom: 0.375rem;
}

.fine a {
    color: var(--muted);
}

/* ---------- Breakpoints ---------- */

@media (min-width: 40rem) {
    :root {
        --gutter: 2rem;
    }

    .calcs,
    .siblings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 60rem) {
    .hero {
        padding: 3.5rem 0 4rem;
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
        gap: 3rem;
    }

    .hero-shot {
        justify-self: end;
        width: 21rem;
    }

    .split {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        gap: 3rem;
    }

    .gallery {
        max-width: 56rem;
    }
}
