/*
 * Smoke Control Toolkit site styles.
 * Tokens from projects/smoke-control-toolkit/DESIGN.md ("Section Cut"):
 * drafting-white ground, sheet, ink, muted, hairline, outline, clear-air blue
 * and blue ink, alert orange (failing checks only), pass green and note amber
 * marks; dark is "blueprint at night", light and dark exactly as the app's
 * theme. Type: Archivo (400, 500, 600) for body and numbers, Archivo
 * SemiCondensed (600, 700) for headings and figures; sentence-case labels.
 * Shapes: mark 2px, field and frame 4px, button 12px. No card chrome:
 * content sits on the ground between hairlines; the screenshots are the one
 * framed object. Motif: a dimension string (hairline with 45° ticks) under
 * section labels. Fonts: SIL Open Font License, licenses/Archivo-OFL.txt.
 */

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

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

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

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

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

:root {
    color-scheme: light dark;

    --ground: #F7F8F6;
    --surface: #FFFFFF;
    --ink: #15202B;
    --muted: #4A5560;
    --hairline: #D9DDE0;
    --outline: #6B7682;
    --blue: #2E6BD9;
    --blue-ink: #2459B8;
    --on-blue: #FFFFFF;
    --blue-container: #DDE7F8;
    --on-blue-container: #123A80;
    --dimension: #15202B;
    --alert: #C2410C;
    --on-alert: #FFFFFF;
    --pass-ink: #1F5E3A;
    --pass-bg: #E3F0E8;
    --note-ink: #7A4E0C;
    --note-bg: #F5EAD2;

    --body: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --display: "Archivo SemiCondensed", "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --r-mark: 2px;
    --r-field: 4px;
    --r-button: 12px;

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

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0D1826;
        --surface: #132235;
        --ink: #E4ECF5;
        --muted: #A3B3C6;
        --hairline: #24364C;
        --outline: #7A8DA3;
        --blue: #8DB4F7;
        --blue-ink: #8DB4F7;
        --on-blue: #0D1826;
        --blue-container: #1E3A66;
        --on-blue-container: #D6E4FC;
        --dimension: #B8C7D9;
        --alert: #FF9466;
        --on-alert: #0D1826;
        --pass-ink: #9ED9B3;
        --pass-bg: #16352A;
        --note-ink: #EBC98A;
        --note-bg: #33291A;
    }
}

/* ---------- 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;
}

::selection {
    background: var(--blue-container);
    color: var(--on-blue-container);
}

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

svg {
    flex: none;
}

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

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

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

h1,
h2,
h3 {
    font-family: var(--display);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin: 0;
    text-wrap: balance;
}

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

h2 {
    font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2.25rem);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.3125rem;
    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(--surface);
    color: var(--ink);
    border: 2px solid var(--blue);
    border-radius: var(--r-button);
    font-weight: 600;
}

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

/* Section label: sentence case over a dimension string (hairline, 45° ticks) */
.label {
    display: block;
    margin: 0 0 0.75rem;
    font-family: var(--body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--muted);
}
.label:has(+ h1)::after,
.label:has(+ h2)::after {
    content: "";
    display: block;
    height: 9px;
    margin-top: 0.375rem;
    max-width: 22rem;
    background:
        linear-gradient(45deg, transparent 44%, var(--dimension) 44% 56%, transparent 56%) left center / 9px 9px no-repeat,
        linear-gradient(45deg, transparent 44%, var(--dimension) 44% 56%, transparent 56%) right center / 9px 9px no-repeat,
        linear-gradient(var(--dimension), var(--dimension)) center / 100% 1px no-repeat;
    opacity: 0.8;
}
/* Rule between parts of a block: a plain hairline */
.perf {
    height: 0;
    margin: 1rem 0;
    border: 0;
    border-top: 1px solid var(--hairline);
}
.answer {
    font-size: 1.125rem;
    max-width: 66ch;
}

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

/* ---------- Top bar ---------- */

.topbar {
    border-bottom: 1px solid var(--hairline);
    background: var(--ground);
}

.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;
}

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

.brand img {
    border-radius: var(--r-field);
}

.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(--ink);
    text-decoration: none;
    font-weight: 600;
}

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

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

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

.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: 44ch;
    margin: 1rem 0 1.5rem;
}

.get {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.get p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9375rem;
    max-width: 30ch;
}

/* Official Google Play badge: unmodified art */
.play-badge {
    display: inline-block;
    border-radius: 8px;
    line-height: 0;
}

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

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

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

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

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

.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;
}

/* Result block: no card; content on the ground between hairlines */
.pass {
    color: var(--ink);
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--hairline);
    padding: 1.25rem 0;
    min-width: 0;
}

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

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

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

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

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

/* Verdict readout, redrawn from engine output */
.readout {
    margin: 0;
}

.figure {
    font-family: var(--display);
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}

.figure span {
    font-family: var(--body);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0;
}

.facts {
    margin: 0;
}

.facts div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.125rem 1rem;
    padding: 0.5625rem 0;
    border-bottom: 1px solid var(--hairline);
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

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

/* Verdict marks: always a word, never a colour alone */
.stamp {
    display: inline-block;
    padding: 0.1875rem 0.5rem;
    border-radius: var(--r-mark);
    font-family: var(--body);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.stamp-pass {
    background: var(--pass-bg);
    color: var(--pass-ink);
}

.stamp-fail {
    background: var(--alert);
    color: var(--on-alert);
}

.stamp-note {
    background: var(--note-bg);
    color: var(--note-ink);
}

/* Reliance notice */
.notice {
    background: var(--note-bg);
    color: var(--ink);
    border-radius: var(--r-field);
    padding: 1.25rem 1.5rem;
    max-width: 72ch;
}

.notice a {
    color: var(--ink);
    outline-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);
}

/* 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(--hairline);
    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: var(--blue-ink);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

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

.cta .get {
    justify-content: center;
}

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

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

.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(--hairline);
    scroll-margin-top: 1rem;
}

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

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

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

/* Equations: text, wrapping, never a sideways scroll */
.eqs {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    border-top: 1px solid var(--hairline);
    display: grid;
    gap: 0;
    max-width: 72ch;
}

.eqs li {
    color: var(--ink);
    border-bottom: 1px solid var(--hairline);
    padding: 0.625rem 0;
    min-width: 0;
}

.eq {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.eqs .note {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

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

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

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

/* Tables (stack into cards under 600px) */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0 0;
    font-size: 1rem;
}

.table caption {
    display: block;
    text-align: left;
    color: var(--muted);
    padding-bottom: 0.75rem;
}

.table th,
.table td {
    text-align: left;
    vertical-align: top;
    padding: 0.75rem 1rem 0.75rem 0;
    border-bottom: 1px solid var(--hairline);
}

.table thead th {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom-color: var(--outline);
}

.table tbody th {
    font-weight: 600;
}

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

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

.footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
    margin-bottom: 1.25rem;
}

.footer-top p {
    margin: 0;
}

.footer-top strong {
    font-family: var(--display);
    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 (max-width: 37.5rem) {
    .table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .table,
    .table tbody,
    .table tr,
    .table th,
    .table td,
    .table caption {
        display: block;
        width: 100%;
    }

    .table tr {
        background: var(--surface);
        color: var(--ink);
        border: 1px solid var(--hairline);
        border-radius: var(--r-field);
        padding: 0.75rem 1rem;
        margin-bottom: 0.75rem;
    }

    .table th,
    .table td {
        border: 0;
        padding: 0.25rem 0;
    }

    .table [data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--muted);
    }
}

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

    .calcs {
        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;
    }
}
