/* Wabalo custom styles over Pico CSS. No preprocessor, no build step. */

:root {
    --wabalo-primary: #075985;
    --wabalo-valid: #15803d;
    --wabalo-error: #b91c1c;
}

header nav strong {
    color: var(--wabalo-primary);
    font-size: 1.2rem;
}

/* Tighten Pico's roomy header/main rhythm. */
body > header.container {
    padding-block: 0.5rem 0.25rem;
    margin-bottom: 0.5rem;
}

body > main.container {
    padding-top: 0.25rem;
}

.tagline {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.form-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 0.75rem 1rem 0.5rem;
    margin-bottom: 1.5rem;
}

.compact-form label {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.compact-form input,
.compact-form select {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    padding-block: 0.45rem;
    line-height: 1.5;
    /* Same explicit height as the joined fuel widget: text inputs size their
       content box from font metrics (ignoring line-height), so only a shared
       fixed height aligns every input. */
    height: calc(1.5em + 0.9rem + 2px);
}

/* Joined fuel amount + unit widget: give the amount ~70% of the width.
   Pico fixes input height via calc() but leaves select to size from padding,
   so cancel the fixed height and let flex stretch equalize both. */
/* Joined fuel amount + unit widget: give the amount ~70% of the width.
   Text inputs size their content box from font metrics (ignoring line-height)
   while selects use line-height, so a shared explicit height is the only way
   to align both regardless of font metrics. */
.compact-form div[role="group"] > input {
    flex: 7 1 0;
    min-width: 0;
}

.compact-form div[role="group"] > select {
    flex: 3 1 0;
}

.compact-form .field-error:empty {
    display: none;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1rem;
}

.form-grid > * {
    min-width: 0;
}

.form-grid .span-all {
    grid-column: 1 / -1;
}

.form-grid .hint {
    margin-bottom: 0.5rem;
}

.compact-form details {
    margin-bottom: 0.75rem;
}

.compact-form details summary {
    cursor: pointer;
    font-weight: bold;
}

.details-grid {
    margin-top: 0.5rem;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .form-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.result-card {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 1rem;
}

.validity {
    font-weight: bold;
    padding: 0.5rem 0.75rem;
    border-radius: var(--pico-border-radius);
}

.validity.valid {
    color: var(--wabalo-valid);
    border: 1px solid var(--wabalo-valid);
}

.validity.invalid {
    color: var(--wabalo-error);
    border: 1px solid var(--wabalo-error);
}

ul.messages {
    padding-left: 1.25rem;
}

ul.messages li.error-message {
    color: var(--wabalo-error);
}

.field-error {
    color: var(--wabalo-error);
    font-size: 0.9rem;
}

.stat-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1rem;
    margin: 0.75rem 0;
}

.stat-groups > * {
    min-width: 0;
}

.stat-group h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
    margin-bottom: 0.4rem;
}

dl.stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

@media (min-width: 600px) {
    dl.stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .stat-groups {
        grid-template-columns: 3fr 2fr 3fr;
        align-items: start;
    }

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

    .stat-group:nth-child(2) .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.stat {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    padding: 0.5rem 0.75rem;
    margin: 0;
}

.stat dt {
    font-size: 0.8rem;
    color: var(--pico-muted-color);
}

.stat dd {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
}

.charts-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1.5rem;
}

.charts-row > * {
    min-width: 0;
}

@media (min-width: 900px) {
    .charts-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.chart-wrap {
    margin: 0.75rem 0;
}

.chart-wrap svg.chart {
    width: 100%;
    height: auto;
    display: block;
}
