/* Shared styles for the calculators embedded in articles (source/_includes/calc/).
   Calculator includes must not contain blank lines: they are pulled into Markdown, which ends
   an HTML block at the first blank line and would render the rest as text. */
.calc {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #222;
    background: #f7f9fc;
    border: 1px solid #e3e9f0;
    border-radius: 10px;
    padding: 1.1rem 1.2rem 1.3rem;
    margin: 1.5rem 0 2rem;
}
.calc * { box-sizing: border-box; }
.calc h3 {
    margin: 0 0 0.75rem;
    font-size: 1.15rem;
}
.calc p.calc-note {
    font-size: 0.85rem;
    color: #555;
    margin: 0.5rem 0 0;
}
.calc label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #445;
    margin-bottom: 0.25rem;
}
.calc input[type="text"],
.calc input[type="number"],
.calc select {
    width: 100%;
    font: inherit;
    padding: 0.45rem 0.6rem;
    border: 1px solid #cdd5df;
    border-radius: 6px;
    background: #fff;
}
.calc input:focus,
.calc select:focus {
    outline: 2px solid #007bff33;
    border-color: #007bff;
}
.calc input.invalid { border-color: #d33; background: #fff5f5; }
.calc .calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem 1rem;
}
/* Keep inputs in a row aligned when some labels wrap to two lines */
.calc .calc-grid > div {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
/* .container .calc beats the site's ".container table td" padding and borders */
.container .calc table {
    width: 100%;
    table-layout: fixed;
    border: 0;
    border-collapse: collapse;
    font-size: inherit;
    margin: 0 0 0.75rem;
}
.container .calc table tr { border: 0 !important; }
.container .calc table th {
    background: none;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    color: #445;
    text-align: left;
    vertical-align: bottom;
    padding: 0 0.3rem 0.35rem;
}
.container .calc table td {
    padding: 0.25rem 0.3rem;
    vertical-align: middle;
}
.container .calc table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.calc table input { min-width: 0; }
.calc button {
    font: inherit;
    font-size: 0.9rem;
    border: 1px solid #cdd5df;
    background: #fff;
    color: #333;
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    cursor: pointer;
}
.calc button:hover { border-color: #007bff; color: #007bff; }
.calc button.calc-remove {
    border: 0;
    background: none;
    color: #999;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
}
.calc button.calc-remove:hover { color: #d33; }
.calc .calc-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.calc .calc-result {
    background: #fff;
    border: 1px solid #e3e9f0;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
}
.calc .calc-result span {
    display: block;
    font-size: 0.78rem;
    color: #556;
}
.calc .calc-result strong {
    display: block;
    font-size: 1.35rem;
    font-variant-numeric: tabular-nums;
}
.calc .calc-result.primary {
    border-color: #007bff;
    background: #f0f6ff;
}
.calc .calc-units {
    display: inline-flex;
    border: 1px solid #cdd5df;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.calc .calc-units button {
    border: 0;
    border-radius: 0;
    padding: 0.4rem 1rem;
}
.calc .calc-units button.active {
    background: #007bff;
    color: #fff;
}
@media (max-width: 620px) {
    .calc { padding: 0.9rem 0.7rem 1rem; }
    .container .calc table th,
    .container .calc table td { padding-left: 0.15rem; padding-right: 0.15rem; }
    .container .calc table th { font-size: 0.72rem; }
    .calc table input { padding: 0.4rem 0.35rem; font-size: 15px; }
    .calc .calc-hide-sm { display: none; }
}
