/* Cooling load and water estimator. Builds on subnet/tool.css, which supplies
   .calc, .lede, .result-grid, .examples, .tool-prose and .app-pitch. */

.cool-form {
    display: grid;
    gap: 1.4rem;
}

.cool-form fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0; /* a fieldset refuses to shrink below its content otherwise */
}

.cool-form legend {
    padding: 0;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint, #5b6779);
}

/* Radio groups drawn as chips. The input stays in the accessibility tree and
   keeps arrow-key navigation; only its appearance is replaced. */
.opts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.opt input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.opt span {
    display: block;
    background: var(--bg-raised, #080d16);
    border: 1px solid var(--border-solid, #182234);
    border-radius: var(--radius);
    padding: 0.4rem 0.9rem;
    color: var(--text-dim, #8e9bb0);
    font-size: 0.85rem;
    cursor: pointer;
}

.opt:has(input:checked) span {
    background: var(--brand, #006efe);
    border-color: transparent;
    color: #fff;
}

.opt:has(input:focus-visible) span {
    outline: 2px solid var(--brand-bright, #3d92ff);
    outline-offset: 2px;
}

.opt:hover span {
    border-color: var(--brand-bright, #3d92ff);
}

.option-note {
    margin: 0.7rem 0 0;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-dim, #8e9bb0);
    max-width: 62ch;
}

/* The load fields. */
.loads {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

/* display:flex would otherwise win over the hidden attribute and show both
   ways of entering the load at once. */
.loads[hidden] {
    display: none;
}

.num {
    display: grid;
    gap: 0.3rem;
}

.num-label {
    font-size: 0.8rem;
    color: var(--text-dim, #8e9bb0);
}

.num-input {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #02050b;
    border: 1px solid var(--border-solid, #182234);
    border-radius: var(--radius);
    padding-right: 0.9rem;
}

.num-input:focus-within {
    border-color: var(--brand-bright, #3d92ff);
    box-shadow: 0 0 0 3px #3d92ff33;
}

.num-input input {
    width: 7rem;
    box-sizing: border-box;
    padding: 0.8rem 0.9rem;
    font-family: var(--mono, ui-monospace, Menlo, monospace);
    font-size: 1.1rem;
    color: var(--text, #e8edf5);
    background: none;
    border: 0;
}

.num-input input:focus {
    outline: none;
}

.num-unit {
    font-family: var(--mono, monospace);
    font-size: 0.85rem;
    color: var(--text-faint, #5b6779);
}

.times {
    align-self: end;
    padding-bottom: 0.9rem;
    color: var(--text-faint, #5b6779);
}

/* ── results ─────────────────────────────────────────────────────────────── */

.headline {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem 2.5rem;
    margin-top: 1.6rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border-solid, #182234);
}

.figure-value {
    display: block;
    font-size: clamp(1.6rem, 5vw, 2.1rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.figure-value .unit {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-dim, #8e9bb0);
    letter-spacing: 0;
}

.figure-label {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    color: var(--text-dim, #8e9bb0);
}

.water .figure-value {
    color: var(--brand-bright, #3d92ff);
}

.figure-note,
.results-scope {
    margin: 0.9rem 0 0;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-faint, #5b6779);
    max-width: 68ch;
}

/* Wider than the shared default: these values are ranges with a unit on the
   end — "12.3–17.5 million litres" — and at 230px a column they wrapped onto
   two lines, which reads as two numbers. */
.calc .result-grid {
    /* min() so a phone narrower than the track does not get one 340px column
       overflowing the card. */
    grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}

.result dt .hint {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.78rem;
    color: var(--text-faint, #5b6779);
}

.result dd.value {
    font-family: var(--mono, monospace);
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

/* The trade-off is the argument the page is making, so it gets the room a
   verdict gets rather than being a footnote under the table. */
.trade {
    margin: 1.4rem 0 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-solid, #182234);
    border-left: 3px solid var(--pending, #f0a83c);
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-dim, #8e9bb0);
    max-width: 68ch;
}

.trade strong {
    color: var(--text, #e8edf5);
}

.compare-head {
    margin: 2rem 0 0;
    font-size: 1rem;
}

.compare-sub {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    color: var(--text-dim, #8e9bb0);
    max-width: 68ch;
}

/* The wrapper scrolls, not the page. Five columns will not fit a phone and
   should not try to. */
.table-wrap {
    overflow-x: auto;
    margin-top: 0.9rem;
    border: 1px solid var(--border-solid, #182234);
    border-radius: var(--radius);
}

table.compare {
    border-collapse: collapse;
    width: 100%;
    min-width: 40rem;
    font-family: var(--mono, monospace);
    font-size: 0.82rem;
}

table.compare th,
table.compare td {
    padding: 0.55rem 0.9rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--border, #16203180);
}

table.compare th {
    background: var(--bg-card, #0b1220);
    color: var(--text, #e8edf5);
    font-family: var(--sans, system-ui, sans-serif);
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
}

table.compare td:first-child {
    color: var(--brand-bright, #3d92ff);
    font-weight: 600;
}

table.compare tr:last-child td {
    border-bottom: 0;
}

table.compare tr.current td {
    background: var(--row-hover);
}

table.compare tr.current td:first-child::after {
    content: " ←";
    color: var(--text-faint, #5b6779);
}

/* The prose tables use the same treatment, but their second column is a
   sentence rather than a figure, so it wraps instead of scrolling away. */
.tool-prose .table-wrap {
    margin: 1.6rem 0;
}

.tool-prose table.compare {
    min-width: 0;
}

.tool-prose table.compare td:last-child {
    white-space: normal;
    color: var(--text-dim, #8e9bb0);
    font-family: var(--sans, system-ui, sans-serif);
    font-size: 0.9rem;
}

@media (max-width: 30rem) {
    .num-input input {
        width: 5.5rem;
    }

    .headline {
        gap: 1rem 1.6rem;
    }

    /* Smaller type buys the two columns that matter — design and water —
       inside a phone's width before the table has to be scrolled. */
    table.compare {
        min-width: 34rem;
        font-size: 0.75rem;
    }

    table.compare th,
    table.compare td {
        padding: 0.5rem 0.6rem;
    }
}
