/* Интерактивный блок «Оксиды» на chemistry.html — стили согласованы с styles/site/ */

.chem-interactive-hub {
    margin: 1.75rem 0 2rem;
    padding: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.chem-hub-head {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem 1.35rem 1rem;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--accent-color) 12%, var(--bg-secondary)) 0%,
        var(--bg-secondary) 55%
    );
    border-bottom: 1px solid var(--border-color);
}

.chem-hub-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--border-radius);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.chem-hub-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--text-primary);
    line-height: 1.3;
}

.chem-hub-desc {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* Сегментированное переключение режимов */
.chem-hub-segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.85rem 1rem 0.65rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.chem-hub-seg-btn {
    flex: 1 1 140px;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.chem-hub-seg-btn:hover {
    border-color: color-mix(in srgb, var(--accent-color) 45%, var(--border-color));
    color: var(--text-primary);
}

.chem-hub-seg-btn.is-active {
    background: var(--primary-gradient);
    color: var(--header-text);
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

.chem-hub-pane {
    padding: 1.1rem 1.15rem 1.35rem;
    background: var(--bg-secondary);
}

.chem-hub-pane[hidden] {
    display: none !important;
}

/* Вложенные вкладки таблицы реакций */
#oxide-interactive-hub .chem-react-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

#oxide-interactive-hub .chem-react-tab-btn {
    font-size: 0.82rem;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

#oxide-interactive-hub .chem-react-tab-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-react-tab-btn.active {
    background: var(--text-primary);
    color: var(--bg-secondary);
    border-color: transparent;
}

body.dark-theme #oxide-interactive-hub .chem-react-tab-btn.active {
    background: var(--accent-color);
    color: #fff;
}

#oxide-interactive-hub .chem-react-panel {
    display: none;
}

#oxide-interactive-hub .chem-react-panel.active {
    display: block;
    animation: chem-hub-fade 0.2s ease;
}

@keyframes chem-hub-fade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

#oxide-interactive-hub .chem-react-panel h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-react-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0 0 0.85rem;
    line-height: 1.5;
}

#oxide-interactive-hub .chem-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

#oxide-interactive-hub .chem-tbl-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: auto;
    max-height: min(70vh, 520px);
    -webkit-overflow-scrolling: touch;
}

#oxide-interactive-hub .chem-tbl th {
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    padding: 0.65rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 var(--border-color);
}

#oxide-interactive-hub .chem-tbl td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
    vertical-align: top;
    line-height: 1.55;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-tbl tr:last-child td {
    border-bottom: none;
}

#oxide-interactive-hub .chem-tbl tbody tr:hover td {
    background: color-mix(in srgb, var(--accent-color) 6%, var(--bg-secondary));
}

#oxide-interactive-hub .chem-section-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0.45rem 0.75rem 0.35rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

#oxide-interactive-hub .chem-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
    font-weight: 600;
}

#oxide-interactive-hub .chem-b-green {
    background: color-mix(in srgb, #16a34a 18%, var(--bg-secondary));
    color: #166534;
}

#oxide-interactive-hub .chem-b-blue {
    background: color-mix(in srgb, var(--accent-color) 18%, var(--bg-secondary));
    color: var(--accent-hover);
}

#oxide-interactive-hub .chem-b-amber {
    background: color-mix(in srgb, #d97706 20%, var(--bg-secondary));
    color: #92400e;
}

#oxide-interactive-hub .chem-b-coral {
    background: color-mix(in srgb, #dc2626 16%, var(--bg-secondary));
    color: #991b1b;
}

#oxide-interactive-hub .chem-b-purple {
    background: color-mix(in srgb, #7c3aed 16%, var(--bg-secondary));
    color: #5b21b6;
}

#oxide-interactive-hub .chem-b-teal {
    background: color-mix(in srgb, #0d9488 18%, var(--bg-secondary));
    color: #0f766e;
}

#oxide-interactive-hub .chem-b-gray {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

body.dark-theme #oxide-interactive-hub .chem-b-green {
    background: color-mix(in srgb, #22c55e 22%, var(--bg-secondary));
    color: #bbf7d0;
}

body.dark-theme #oxide-interactive-hub .chem-b-blue {
    background: color-mix(in srgb, var(--accent-color) 25%, var(--bg-secondary));
    color: #bfdbfe;
}

body.dark-theme #oxide-interactive-hub .chem-b-amber {
    background: color-mix(in srgb, #f59e0b 22%, var(--bg-secondary));
    color: #fde68a;
}

body.dark-theme #oxide-interactive-hub .chem-b-coral {
    background: color-mix(in srgb, #f87171 18%, var(--bg-secondary));
    color: #fecaca;
}

body.dark-theme #oxide-interactive-hub .chem-b-purple {
    background: color-mix(in srgb, #a78bfa 20%, var(--bg-secondary));
    color: #e9d5ff;
}

body.dark-theme #oxide-interactive-hub .chem-b-teal {
    background: color-mix(in srgb, #2dd4bf 18%, var(--bg-secondary));
    color: #ccfbf1;
}

#oxide-interactive-hub .chem-formula {
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

#oxide-interactive-hub .chem-foot {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0.65rem 0.1rem 0;
    line-height: 1.45;
}

/* Шпаргалка: подписи и шаги */
#oxide-interactive-hub .chem-lbl {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin: 1.1rem 0 0.5rem;
}

#oxide-interactive-hub .chem-lbl:first-child {
    margin-top: 0.2rem;
}

#oxide-interactive-hub .chem-step {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    font-size: 0.86rem;
    line-height: 1.65;
    background: var(--bg-primary);
}

#oxide-interactive-hub .chem-num {
    min-width: 1.45rem;
    height: 1.45rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

#oxide-interactive-hub .chem-nt {
    background: color-mix(in srgb, #0d9488 22%, var(--bg-secondary));
    color: #0f766e;
}

#oxide-interactive-hub .chem-na {
    background: color-mix(in srgb, #d97706 22%, var(--bg-secondary));
    color: #92400e;
}

#oxide-interactive-hub .chem-nc {
    background: color-mix(in srgb, #dc2626 18%, var(--bg-secondary));
    color: #991b1b;
}

#oxide-interactive-hub .chem-np {
    background: color-mix(in srgb, #7c3aed 18%, var(--bg-secondary));
    color: #5b21b6;
}

body.dark-theme #oxide-interactive-hub .chem-nt {
    background: color-mix(in srgb, #14b8a6 35%, var(--bg-secondary));
    color: #ccfbf1;
}

body.dark-theme #oxide-interactive-hub .chem-na {
    background: color-mix(in srgb, #f59e0b 30%, var(--bg-secondary));
    color: #fef3c7;
}

body.dark-theme #oxide-interactive-hub .chem-nc {
    background: color-mix(in srgb, #f87171 28%, var(--bg-secondary));
    color: #fee2e2;
}

body.dark-theme #oxide-interactive-hub .chem-np {
    background: color-mix(in srgb, #a78bfa 30%, var(--bg-secondary));
    color: #f3e8ff;
}

#oxide-interactive-hub .chem-tag {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

#oxide-interactive-hub .chem-tg-t {
    background: color-mix(in srgb, #0d9488 22%, var(--bg-secondary));
    color: #0f766e;
}

#oxide-interactive-hub .chem-tg-a {
    background: color-mix(in srgb, #d97706 22%, var(--bg-secondary));
    color: #92400e;
}

#oxide-interactive-hub .chem-tg-c {
    background: color-mix(in srgb, #dc2626 18%, var(--bg-secondary));
    color: #991b1b;
}

body.dark-theme #oxide-interactive-hub .chem-tg-t {
    color: #ccfbf1;
}

body.dark-theme #oxide-interactive-hub .chem-tg-a {
    color: #fef3c7;
}

body.dark-theme #oxide-interactive-hub .chem-tg-c {
    color: #fee2e2;
}

#oxide-interactive-hub .chem-scale {
    display: flex;
    border-radius: var(--border-radius);
    overflow: hidden;
    min-height: 2.5rem;
    margin: 0.4rem 0 0.2rem;
    border: 1px solid var(--border-color);
}

#oxide-interactive-hub .chem-sc {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    padding: 0.35rem;
}

#oxide-interactive-hub .chem-sc-t {
    flex: 2;
    background: color-mix(in srgb, #0d9488 24%, var(--bg-secondary));
    color: #0f766e;
}

#oxide-interactive-hub .chem-sc-a {
    flex: 2;
    background: color-mix(in srgb, #d97706 22%, var(--bg-secondary));
    color: #92400e;
}

#oxide-interactive-hub .chem-sc-c {
    flex: 3;
    background: color-mix(in srgb, #dc2626 18%, var(--bg-secondary));
    color: #991b1b;
}

body.dark-theme #oxide-interactive-hub .chem-sc-t {
    color: #ccfbf1;
}

body.dark-theme #oxide-interactive-hub .chem-sc-a {
    color: #fef3c7;
}

body.dark-theme #oxide-interactive-hub .chem-sc-c {
    color: #fee2e2;
}

#oxide-interactive-hub .chem-deg-row {
    display: flex;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    gap: 0.25rem;
}

#oxide-interactive-hub .chem-deg-row span {
    flex: 1 1 30%;
    text-align: center;
    min-width: 5rem;
}

#oxide-interactive-hub .chem-amph-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.45rem;
    margin-bottom: 0.25rem;
}

#oxide-interactive-hub .chem-amph-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.45rem 0.35rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    color: inherit;
}

#oxide-interactive-hub .chem-amph-btn .chem-a-sym,
#oxide-interactive-hub .chem-amph-btn .chem-a-ox {
    display: block;
}

#oxide-interactive-hub .chem-amph-btn:hover,
#oxide-interactive-hub .chem-amph-btn:focus-visible {
    border-color: var(--accent-color);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 35%, transparent);
}

#oxide-interactive-hub .chem-a-sym {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-a-ox {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

#oxide-interactive-hub .chem-g2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

#oxide-interactive-hub .chem-el-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.65rem 0.85rem;
}

#oxide-interactive-hub .chem-el-card h5 {
    margin: 0 0 0.45rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-el-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color) 65%, transparent);
    font-size: 0.82rem;
}

#oxide-interactive-hub .chem-el-row:last-child {
    border-bottom: none;
}

#oxide-interactive-hub .chem-el-formula {
    font-family: ui-monospace, "Consolas", monospace;
    font-size: 0.78rem;
    min-width: 4.1rem;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-el-ox {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

#oxide-interactive-hub .chem-hub-note {
    font-size: 0.84rem;
    color: var(--text-secondary);
    margin: 0.85rem 0.1rem 0;
    line-height: 1.55;
}

/* SVG карта ПСХЭ */
#oxide-interactive-hub .chem-pt-map {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
}

#oxide-interactive-hub .chem-pt-map .c-teal rect {
    fill: color-mix(in srgb, #0d9488 18%, var(--bg-secondary));
}

#oxide-interactive-hub .chem-pt-map .c-purple rect {
    fill: color-mix(in srgb, #7c3aed 15%, var(--bg-secondary));
}

#oxide-interactive-hub .chem-pt-map .c-amber rect {
    fill: color-mix(in srgb, #d97706 18%, var(--bg-secondary));
}

#oxide-interactive-hub .chem-pt-map .c-coral rect {
    fill: color-mix(in srgb, #dc2626 14%, var(--bg-secondary));
}

#oxide-interactive-hub .chem-pt-map .c-gray rect {
    fill: var(--bg-tertiary);
}

#oxide-interactive-hub .chem-pt-map .ts {
    font-size: 11px;
    fill: var(--text-secondary);
}

#oxide-interactive-hub .chem-pt-map .th {
    font-size: 12px;
    font-weight: 600;
    fill: var(--text-primary);
}

#oxide-interactive-hub .chem-pt-map .pt-border {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 0.6;
}

#oxide-interactive-hub .chem-pt-map .pt-grid {
    stroke: var(--border-color);
    stroke-width: 0.4;
    opacity: 0.55;
}

#oxide-interactive-hub .chem-ec-h {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 0 0 0.45rem;
    color: var(--text-primary);
}

#oxide-interactive-hub .chem-pt-map .pt-axis {
    stroke: var(--text-secondary);
    stroke-width: 0.5;
    opacity: 0.85;
}

#oxide-interactive-hub .chem-pt-map marker path {
    stroke: var(--text-secondary);
    fill: none;
}

@media (max-width: 640px) {
    .chem-hub-head {
        flex-direction: column;
    }

    .chem-hub-icon {
        width: 2.5rem;
        height: 2.5rem;
    }

    #oxide-interactive-hub .chem-tbl {
        font-size: 0.78rem;
    }

    #oxide-interactive-hub .chem-tbl th,
    #oxide-interactive-hub .chem-tbl td {
        padding: 0.5rem;
    }
}
