/* CureSafe — Equilibrium Curing Salt & FSIS Nitrite Safety Calculator */
/* Bespoke Charcuterie Wine Burgundy / Stainless Steel Palette */

:root {
    --bg-primary: #12090d;
    --bg-surface: #1d0e17;
    --bg-hover: #2b1522;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent: #e11d48;
    --accent-hover: #f43f5e;
    --accent-glow: rgba(225, 29, 72, 0.18);
    --border: #3d1c2e;
    --border-light: #52253e;

    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --success-border: rgba(34, 197, 94, 0.35);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.35);

    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.15);
    --error-border: rgba(239, 68, 68, 0.4);

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-0: 0;
}

/* Header */
.app-header {
    background: linear-gradient(180deg, #240e1b 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 1rem;
    text-align: center;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(225, 29, 72, 0.12);
    border: 1px solid rgba(225, 29, 72, 0.3);
    color: var(--accent);
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.app-header .subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* Layout Main */
.app-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 992px) {
    .calculator-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Card System */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Preset Buttons */
.preset-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.preset-btn:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.preset-btn.active {
    background: rgba(225, 29, 72, 0.12);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 12px var(--accent-glow);
}

.preset-icon {
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
}

.preset-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.preset-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-section-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 576px) {
    .form-row.split-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.form-control {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.65rem 0.85rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-with-unit {
    display: flex;
    align-items: center;
}

.input-with-unit .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.unit-select, .static-unit {
    background-color: var(--bg-hover);
    border: 1px solid var(--border);
    border-left: none;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.65rem 0.75rem;
    height: 100%;
}

.field-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Custom Slider */
.slider-group {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.slider-value-display {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--accent);
}

.custom-range {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--text-primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.tick-recommended {
    color: var(--success);
    font-weight: 600;
}

/* Food Safety Badge */
.safety-badge {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    transition: all 0.3s ease;
}

.badge-icon-wrap {
    font-size: 1.75rem;
    line-height: 1;
}

.badge-content h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.badge-content p {
    font-size: 0.85rem;
    line-height: 1.4;
}

.badge-safe {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #4ade80;
}

.badge-safe h3 { color: #4ade80; }

.badge-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: #fbbf24;
}

.badge-warning h3 { color: #fbbf24; }

.badge-danger {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #f87171;
}

.badge-danger h3 { color: #f87171; }

/* Recipe Grid */
.recipe-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.recipe-metric {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.recipe-metric.metric-primary {
    border-color: var(--accent);
    background: rgba(225, 29, 72, 0.08);
}

.metric-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.metric-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.metric-unit {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Composition Bar */
.composition-wrapper {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.comp-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.6rem;
}

.composition-bar {
    display: flex;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 0.75rem;
}

.bar-segment {
    height: 100%;
    transition: width 0.3s ease;
}

.seg-meat { background: #991b1b; }
.seg-water { background: #0284c7; }
.seg-salt { background: #e2e8f0; }
.seg-cure { background: #e11d48; }
.seg-sugar { background: #f59e0b; }

.composition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-meat { background: #991b1b; }
.dot-water { background: #0284c7; }
.dot-salt { background: #e2e8f0; }
.dot-cure { background: #e11d48; }
.dot-sugar { background: #f59e0b; }

/* Cure Time & Canvas */
.cure-time-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
}

.cure-time-header {
    margin-bottom: 1rem;
}

.time-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.time-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.time-value-display {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.time-number {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}

.time-unit {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-muted);
}

.time-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.canvas-simulator-wrap {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.sim-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sim-day-tag {
    font-family: var(--font-mono);
    color: var(--accent);
}

#cureCanvas {
    width: 100%;
    height: auto;
    background: #090407;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: block;
    margin-bottom: 0.75rem;
}

.sim-controls label {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.3rem;
}

/* Deep Article Section */
.content-depth-section {
    margin-top: 2rem;
}

.article-body h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 1.5rem 0 0.6rem;
}

.article-body p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.article-body ul {
    margin: 0 0 1.25rem 1.5rem;
    color: var(--text-secondary);
}

.article-body li {
    margin-bottom: 0.5rem;
}

.comparison-table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
}

.data-table th {
    background-color: var(--bg-primary);
    font-family: var(--font-heading);
    color: var(--text-primary);
    font-weight: 700;
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.formula-box {
    background: var(--bg-primary);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 1rem 0 1.5rem;
    overflow-x: auto;
}
