/* =============================================
   Chemistry Fundamentals — clean single-column
   ============================================= */

html { scroll-behavior: smooth; }

body.fundamentals-page {
    margin: 0;
    min-height: 100vh;
    color: #10243a;
    background: #f0f4f8;
    font-family: "Segoe UI", system-ui, sans-serif;
}

.fundamentals-page .chem-header {
    position: sticky; top: 0; z-index: 40;
    backdrop-filter: blur(12px);
}

.fundamentals-page .nav-btn.active {
    background: rgba(255,255,255,0.12);
}

/* ---- Main content ---- */
.fund-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.75rem 0.75rem 3rem;
}

/* ---- Accordion ---- */
.fund-accordion {
    display: grid;
    gap: 0.45rem;
}

.acc-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.acc-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.97rem;
    font-weight: 700;
    color: #10243a;
    text-align: left;
}

.acc-trigger:hover { background: #f8fafc; }

.acc-trigger[aria-expanded="true"] {
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.acc-label { flex: 1; }

.acc-arrow {
    font-size: 0.85rem;
    color: #64748b;
    transition: transform 0.2s;
}

.acc-trigger[aria-expanded="true"] .acc-arrow {
    transform: rotate(180deg);
}

.card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border-radius: 7px;
    background: #0f766e;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

.acc-body {
    padding: 1rem;
}

.acc-body > p {
    margin: 0 0 0.75rem;
    color: #475569;
    line-height: 1.55;
    font-size: 0.92rem;
}

/* ---- Tool grids ---- */
.tool-grid {
    display: grid;
    gap: 0.6rem;
}

.tool-grid.two-col { grid-template-columns: 1fr 1fr; }
.tool-grid.three-col { grid-template-columns: 1fr 1fr 1fr; }

.tool-grid label {
    display: grid;
    gap: 0.2rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
}

.tool-grid input {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #10243a;
    font: inherit;
    font-size: 0.92rem;
}

.tool-grid input:focus {
    outline: 2px solid rgba(15,118,110,0.22);
    border-color: #0f766e;
}

/* ---- Buttons ---- */
.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.tool-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.55rem 0.85rem;
    min-height: 40px;
}

.tool-button.primary {
    background: #0f766e;
    color: #fff;
}

.tool-button.primary:hover { background: #115e59; }

.tool-button.subtle {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.tool-button.subtle:hover { background: #e2e8f0; }

/* ---- Output ---- */
.tool-output {
    margin-top: 0.65rem;
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #14532d;
}

/* ---- Reaction tool ---- */
.reaction-tool { margin-top: 0.5rem; }
.reaction-equation {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ---- Thermo pair ---- */
.thermo-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.thermo-box {
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.thermo-box.cool {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e3a5f;
}

.thermo-box.warm {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #78350f;
}

.thermo-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.concept-toggle.is-active {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

/* ---- Scenario chips ---- */
.scenario-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.scenario-chip {
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.scenario-chip:hover { background: #f1f5f9; }
.scenario-chip.is-active {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

/* ---- Responsive ---- */
/* ---- Preset select ---- */
.preset-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.7rem;
    margin-bottom: 0.65rem;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #10243a;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.preset-select:focus {
    outline: 2px solid rgba(15,118,110,0.22);
    border-color: #0f766e;
}

/* ---- Field flash animation ---- */
@keyframes field-flash {
    0%   { background: #fef9c3; }
    100% { background: #f8fafc; }
}

.fund-accordion input.field-updated {
    animation: field-flash 0.9s ease-out forwards;
}

/* ---- Beaker & gas sim wrappers ---- */
.beaker-wrap,
.gas-sim-wrap {
    display: none;
    justify-content: center;
    margin-top: 0.75rem;
}

.beaker-svg {
    width: 200px;
    height: auto;
    overflow: visible;
}

.gas-svg {
    width: 185px;
    height: auto;
    overflow: visible;
}

@media (max-width: 640px) {
    .fund-main { padding: 0.5rem 0.4rem 2rem; }
    .acc-trigger { font-size: 0.92rem; padding: 0.75rem 0.85rem; }
    .acc-body { padding: 0.85rem; }
    .tool-grid.two-col,
    .tool-grid.three-col { grid-template-columns: 1fr; }
    .thermo-pair { grid-template-columns: 1fr; }
    .tool-actions { flex-direction: column; }
    .tool-button { width: 100%; }
    .beaker-svg { width: 160px; }
    .gas-svg { width: 150px; }
}