/*
 * HVAC Load Calculator site styles.
 * Tokens from projects/HVAC-load-calculator/DESIGN.md (theme/Color.kt):
 * ground, surface, surfaceHigh, outline, outlineStrong, text, textDim,
 * primary (cool blue), primaryText, accent (heat orange), accentText and the
 * warning pair for the demonstration-data notice, light and dark exactly as
 * the app's two themes. Orange is heat and the peak, never an error.
 * Type: system sans for text, the system monospace for every number, unit
 * and formula (DESIGN.md → Typography). No font files, so no licence entry.
 * Motif: the app's peak tile (the one loud element) and plain labelled rules;
 * no gradients, no elevation.
 */

:root {
    color-scheme: light dark;

    --ground: #F6F8FA;
    --surface: #FFFFFF;
    --surface-high: #E9EEF3;
    --outline: #D3DAE2;
    --outline-strong: #6B7788;
    --text: #17202A;
    --text-dim: #465263;
    --primary: #1F5F8B;
    --on-primary: #FFFFFF;
    --primary-text: #1F5F8B;
    --accent: #C2410C;
    --accent-text: #9A3412;
    --warn-ink: #78350F;
    --warn-bg: #FEF3C7;

    --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, "Roboto Mono", Menlo, Consolas, monospace;

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

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

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0F141A;
        --surface: #171E26;
        --surface-high: #222B35;
        --outline: #33404D;
        --outline-strong: #7B8794;
        --text: #E8EEF4;
        --text-dim: #A5B1BE;
        --primary: #7DB8E8;
        --on-primary: #0B1722;
        --primary-text: #8EC5F0;
        --accent: #F59E5B;
        --accent-text: #F6A86B;
        --warn-ink: #FDE68A;
        --warn-bg: #3A2F0A;
    }
}

/* ---------- 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(--text);
    font-family: var(--sans);
    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(--primary-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

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

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

h1,
h2,
h3 {
    font-weight: 700;
    line-height: 1.15;
    margin: 0;
    text-wrap: balance;
    hyphens: manual;
}

h1 {
    font-size: clamp(min(2rem, 8vw), 1rem + 2.8vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
}

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

h3 {
    font-size: 1.25rem;
    font-weight: 650;
    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;
}

code,
.mono {
    font-family: var(--mono);
    font-size: 0.9375em;
    direction: ltr;
    unicode-bidi: isolate;
}

.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(--text);
    border: 2px solid var(--primary-text);
    border-radius: var(--r-field);
    font-weight: 600;
}

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

/* Section label: tracked caps in heat-orange text */
.label {
    display: block;
    margin: 0 0 0.625rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-text);
}

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

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

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

.topbar {
    border-top: 4px solid var(--primary);
    border-bottom: 1px solid var(--outline);
    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(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
}

.brand img {
    border-radius: 8px;
}

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

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

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

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

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

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

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

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

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

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

/* Framed marketing shots: 1px border */
.hero-shot img,
.shot img,
.split-shot img {
    border: 1px solid var(--outline-strong);
    border-radius: var(--r-card);
    background: var(--surface);
}

/* Demonstration-data notice: the app's warning pair, always with its words */
.demo {
    background: var(--warn-bg);
    color: var(--warn-ink);
    border: 1px solid var(--warn-ink);
    border-radius: var(--r-field);
    padding: 0.875rem 1rem;
    margin: 0 0 1.5rem;
    max-width: 62ch;
}

.demo strong {
    display: block;
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.demo p {
    color: var(--warn-ink);
    margin: 0;
}

.demo a {
    color: var(--warn-ink);
    outline-color: var(--warn-ink);
}

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

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

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

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

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

/* Cards: surface with a hairline */
.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1rem;
}

.card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--outline);
    border-radius: var(--r-card);
    padding: 1.25rem 1.25rem 1rem;
    min-width: 0;
}

.card h3 {
    margin-bottom: 0.75rem;
}

.card ul {
    margin: 0;
    padding-left: 1.125rem;
}

.card li {
    margin-bottom: 0.5rem;
}

/* Peak tile: the one loud element, labels only (no computed figures) */
.tile {
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--r-card);
    padding: 1.25rem;
    margin: 0;
    min-width: 0;
}

.tile .tile-head {
    font-weight: 700;
    font-size: 1.125rem;
    margin: 0 0 0.25rem;
    color: var(--on-primary);
}

.tile .units {
    font-family: var(--mono);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
    color: var(--on-primary);
    overflow-wrap: anywhere;
}

.tile dl {
    margin: 0;
    border-top: 1px solid currentColor;
    padding-top: 0.5rem;
}

.tile dl div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 1rem;
    padding: 0.25rem 0;
}

.tile dt {
    font-weight: 600;
}

.tile dd {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.9375rem;
}

.tile figcaption {
    margin-top: 0.75rem;
    font-size: 0.9375rem;
    color: var(--on-primary);
}

.features {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--outline);
    max-width: 72ch;
}

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

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

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

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

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

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

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

.qlinks svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--primary-text);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Closing band */
.cta {
    padding: 3rem 0;
    border-top: 1px solid var(--outline);
    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(--outline);
}

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

.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(--text-dim);
}

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

.ledger > section {
    padding: 2.25rem 0;
    border-bottom: 1px solid var(--outline);
    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: monospaced, left to right, wrapping, never a sideways scroll */
.eqs {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
    display: grid;
    gap: 0.625rem;
    max-width: 76ch;
}

.eqs li {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--outline);
    border-radius: var(--r-field);
    padding: 0.75rem 0.875rem;
    min-width: 0;
}

.eqs .what {
    display: block;
    font-weight: 650;
    margin-bottom: 0.25rem;
}

.eq {
    display: block;
    font-family: var(--mono);
    font-size: 0.9375rem;
    color: var(--primary-text);
    overflow-wrap: anywhere;
    direction: ltr;
    unicode-bidi: isolate;
}

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

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

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

.limits li::before {
    content: counter(lim);
    position: absolute;
    left: 0;
    top: 0.875rem;
    min-width: 2rem;
    font-family: var(--mono);
    font-weight: 700;
    color: var(--accent-text);
}

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

.footer {
    background: var(--surface);
    color: var(--text);
    padding: 2.5rem 0 3rem;
    border-top: 1px solid var(--outline);
}

.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-size: 1.1875rem;
}

.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(--text);
}

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

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

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

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

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

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