/* ========== МЕРКУРИЙ - КАЛЕНДАРЬ ========== */

.mercury-wheel {
    margin: 1.5rem 0;
}

.mercury-wheel * {
    transition: background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* ========== ГОДЫ ========== */

.mercury-years {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.25rem;
    justify-content: flex-start;
}

.year-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-family: Arial, sans-serif;
    font-size: 1rem;
}

.year-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.year-btn.active {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
}

.year-btn.year-with-selected {
    border-color: var(--gold);
    border-width: 2px;
    box-shadow: 0 0 0.625rem rgba(198, 164, 63, 0.3);
    position: relative;
}

/* ========== ПЕРИОДЫ ========== */

.mercury-periods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9375rem;
    margin-bottom: 1.25rem;
    width: 100%;
}

.mercury-periods:has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(4, 1fr);
}

.period-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.25rem 0.9375rem;
    cursor: pointer;
    text-align: center;
    width: 100%;
    min-height: 7.5rem;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.period-card:hover {
    border-color: var(--gold);
    background: var(--card-hover);
}

.period-card.active {
    border-color: var(--gold);
    background: var(--card-hover);
}

.period-card.active .period-sign {
    color: var(--gold);
}

.period-dates {
    font-family: Arial, sans-serif;
    font-size: 0.8rem;
    color: var(--secondary);
    margin-bottom: 0.625rem;
    line-height: 1.4;
    width: 100%;
}

.period-sign {
    font-family: "Times New Roman", Georgia, serif;
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 0.3125rem;
    line-height: 1.4;
    font-weight: 600;
    width: 100%;
}

.period-year {
    font-family: Arial, sans-serif;
    font-size: 0.8rem;
    color: var(--secondary);
    line-height: 1.4;
    width: 100%;
}

/* ========== ПОДСВЕТКА ТЕКУЩЕГО ПЕРИОДА ========== */

.period-card.current-period {
    border-color: var(--gold);
    border-width: 2px;
    background: var(--card-hover);
    box-shadow: 0 0 0.9375rem rgba(198, 164, 63, 0.3);
    position: relative;
}

.period-card.current-period::after {
    content: "Rx";
    position: absolute;
    top: -0.625rem;
    right: 0.625rem;
    background: var(--gold);
    color: var(--bg);
    font-family: Arial, sans-serif;
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0;
    font-weight: bold;
    letter-spacing: 0.5px;
    animation: gentlePulse 2s infinite;
}

@keyframes gentlePulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 1;
    }
}

/* ========== ОПИСАНИЕ ========== */

.mercury-desc {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 1.25rem;
    margin-top: 1.25rem;
}

.desc-title {
    font-family: "Times New Roman", Georgia, serif;
    font-size: 1.25rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.desc-text {
    font-family: Arial, sans-serif;
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--text);
}

/* ========== МОБИЛЬНЫЕ (до 480px) ========== */

@media (max-width: 30rem) {
    .years-dropdown-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.9375rem 0;
        cursor: pointer;
        color: var(--gold);
        font-weight: 500;
        border-bottom: 1px solid var(--border);
        margin-bottom: 0.9375rem;
        -webkit-tap-highlight-color: transparent;
        outline: none;
        user-select: none;
        font-family: Arial, sans-serif;
    }

    .years-dropdown-header.open .dropdown-arrow {
        transform: rotate(180deg);
    }

    .dropdown-arrow {
        transition: transform 0.3s ease;
    }

    .mercury-years {
        display: none;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
        border-bottom: none;
        padding-bottom: 0;
    }

    .mercury-years.visible {
        display: flex;
    }

    .year-btn {
        width: calc(33.33% - 0.375rem);
        text-align: center;
        padding: 0.5rem 0;
        font-size: 1rem;
    }

    .mercury-periods {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .period-card {
        padding: 1rem;
        min-height: auto;
    }

    .period-dates {
        font-size: 1rem;
        white-space: normal;
    }

    .period-sign {
        font-family: "Times New Roman", Georgia, serif;
        font-size: 1.3rem;
    }

    .period-year {
        font-size: 0.9rem;
    }

    .desc-text {
        font-size: 1rem;
        line-height: 1.4;
    }
}

/* ========== ПЛАНШЕТЫ И ВЫШЕ ========== */
/* (min-width: 481px) */
@media (min-width: 30.0625rem) {
    .years-dropdown-header {
        display: none;
    }

    .mercury-years {
        display: grid;
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }

    .year-btn {
        width: 100%;
        padding: 0.5rem 0;
        font-size: 1rem;
        text-align: center;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .mercury-years {
        grid-template-columns: repeat(6, 1fr);
    }

    .mercury-periods {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .period-card {
        padding: 0.9375rem 0.625rem;
        min-height: 7.5rem;
    }

    .period-dates {
        font-size: 0.9rem;
        margin-bottom: 0.3125rem;
    }

    .period-sign {
        font-size: 1.1rem;
        margin-bottom: 0.1875rem;
    }

    .period-year {
        font-size: 0.8rem;
    }

    .mercury-periods:has(> :nth-child(4):last-child) {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 769px) and (max-width: 960px) {
    .mercury-years {
        grid-template-columns: repeat(6, 1fr);
    }

    .mercury-periods {
        grid-template-columns: repeat(3, 1fr);
    }

    .period-card {
        padding: 0.9375rem 0.625rem;
        min-height: 7.5rem;
    }

    .mercury-periods:has(> :nth-child(4):last-child) {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 961px) {
    .mercury-years {
        grid-template-columns: repeat(10, 1fr);
        max-width: 75rem;
    }

    .mercury-periods {
        justify-content: center;
    }

    .period-card {
        min-height: 7.5rem;
        padding: 0.9375rem 0.75rem;
    }
}

/* ========== СВЕТЛАЯ ТЕМА ========== */

:root.light-mode .period-card {
    background: #fcfaf8;
}

:root.light-mode .period-card:hover,
:root.light-mode .period-card.active {
    background: #f0e9dd;
}

:root.light-mode .year-btn.active {
    background: #b89b5e;
    color: #ffffff;
}

:root.light-mode .period-card.current-period::after {
    background: #b89b5e;
    color: #ffffff;
}