/* ============================================
   Milk Fat Calculator - Specific Styles
   shared.css carries no component classes, so panels, buttons and tables
   live here. Readable text uses --text-secondary, never --text-muted.
   ============================================ */

/* A display rule on a class would otherwise beat the hidden attribute. */
[hidden] {
    display: none !important;
}

.panel {
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    min-width: 0;
}

.panel-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    margin-bottom: 4px;
}

.panel-header p,
.hint {
    color: var(--text-secondary);
}

.hint {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.mix-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* Inputs */
.ingredient-list {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.ingredient {
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    min-width: 0;
}

.ingredient > legend {
    padding: 0 6px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ingredient-head {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.ingredient-head .grow {
    flex: 1;
    min-width: 0;
}

.ingredient-head .remove {
    margin-bottom: 12px;
}

.input-group {
    margin-bottom: 12px;
    min-width: 0;
}

/* shared.css styles every label as an uppercase monospace caption. */
.input-group label {
    display: block;
    margin-bottom: 4px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    color: var(--text-secondary);
}

.input-group input,
.input-group select {
    width: 100%;
    min-height: 40px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
}

.field-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.tool-btn {
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.tool-btn.small {
    padding: 8px 12px;
    font-size: 0.8125rem;
}

.tool-btn:hover {
    border-color: var(--accent-biochemical);
}

.tool-btn:focus-visible,
.usage-note > summary:focus-visible {
    outline: 2px solid var(--accent-biochemical);
    outline-offset: 2px;
}

/* Results */
.results {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    min-width: 0;
}

.results h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.big-number {
    margin: 0 0 8px;
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.big-number span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.answer {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
}

.notes {
    margin: 0 0 12px 18px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.stats {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 4px 16px;
    margin: 0 0 12px;
    font-size: 0.875rem;
}

.stats dt {
    color: var(--text-secondary);
}

.stats dd {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.table-scroll {
    position: relative;
    overflow-x: auto;
    margin-bottom: 12px;
}

.table-scroll table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.table-scroll th,
.table-scroll td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    white-space: nowrap;
}

.table-scroll th[scope="row"],
.table-scroll thead th:first-child {
    text-align: left;
}

.table-scroll thead th {
    color: var(--text-secondary);
    font-weight: 600;
}

.table-scroll td {
    font-family: 'JetBrains Mono', monospace;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.error {
    margin: 0;
    padding: 10px 12px;
    border-left: 3px solid var(--accent-error);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* How to use */
.usage-note {
    margin: 0 0 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
}

.usage-note > summary {
    min-height: 44px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
}

.usage-note[open] > summary {
    border-bottom: 1px solid var(--border-color);
}

.usage-body {
    padding: 14px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.usage-body ol {
    margin: 8px 0 8px 20px;
}

.usage-body li {
    margin-bottom: 6px;
}

.sources h2 {
    margin: 0 0 8px;
    font-size: 1.125rem;
}

.sources ul {
    margin: 0 0 0 18px;
    font-size: 0.875rem;
    line-height: 1.7;
}

.sources a {
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .mix-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .panel {
        padding: 16px;
    }

    .field-grid,
    .field-grid.three {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media print {
    header,
    #howTo,
    .disclaimer-card,
    .button-row,
    #addIngredient,
    .remove,
    footer {
        display: none !important;
    }
}
