/**
 * Periodic Table Infographic
 * Page-specific styles (base styles in _base.css)
 */

/* Page-specific body style */
body.periodic-table-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.periodic-table-page .dict-page-title {
    text-align: center;
}

/* Intro text */
.periodic-table-intro {
    margin: 0;
    font-size: 1rem;
    color: var(--text-color, #222);
}

/* Legend grid */
.periodic-table-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    font-size: 0.85rem;
}

.periodic-table-legend .legend-item {
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Main periodic table grid */
.periodic-table-grid {
    display: grid;
    grid-template-columns: 2rem repeat(18, minmax(3.4rem, 1fr));
    gap: 0.35rem;
    align-items: stretch;
}

.table-corner {
    background: transparent;
}

.group-label,
.period-label {
    font-size: 0.75rem;
    text-align: center;
    color: #333;
    align-self: center;
}

/* Element cards */
.element-card,
.element-empty {
    min-height: 4.2rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.4rem;
    padding: 0.3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
}

.element-empty {
    background: transparent;
    border: 1px dashed rgba(0, 0, 0, 0.08);
}

.element-number {
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.65);
}

.element-symbol {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.element-name {
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}

.element-link {
    text-decoration: none;
    color: inherit;
}

.element-link:hover,
.element-link:focus {
    border-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Lanthanide/Actinide series */
.periodic-table-series {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.series-row {
    display: grid;
    grid-template-columns: 6rem repeat(15, minmax(3.4rem, 1fr));
    gap: 0.35rem;
    align-items: stretch;
}

.series-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Element category colors */
.alkali { background: #fde4d4; }
.alkaline-earth { background: #fbe9c5; }
.transition { background: #f4d3d9; }
.post-transition { background: #f9d6b6; }
.metalloid { background: #d7ead6; }
.nonmetal { background: #d8ecf7; }
.halogen { background: #d4e2f4; }
.noble-gas { background: #e6dcf5; }
.lanthanide { background: #f7f2c5; }
.actinide { background: #f0cfe0; }

/* Responsive */
@media (max-width: 900px) {
    .periodic-table-fullwidth {
        padding: 1.2rem 1.4rem;
    }

    .periodic-table-grid {
        grid-template-columns: 2rem repeat(18, minmax(2.6rem, 1fr));
    }

    .series-row {
        grid-template-columns: 4.5rem repeat(15, minmax(2.6rem, 1fr));
    }

    .element-card,
    .element-empty {
        min-height: 3.6rem;
    }
}

@media (max-width: 700px) {
    .periodic-table-fullwidth {
        padding: 1rem;
    }

    .periodic-table-grid,
    .series-row {
        overflow-x: auto;
    }

    .periodic-table-grid {
        grid-template-columns: 2rem repeat(18, minmax(3rem, 1fr));
    }
}