/* =========================
   АНИМАЦИИ И ВИЗУАЛЬНЫЕ ЭФФЕКТЫ

   Все анимации сайта собраны в этом файле.
   Используются только transform/opacity — без нагрузки на браузер.
   В конце файла — отключение анимаций при prefers-reduced-motion.
   ========================= */


/* =========================
   БОКОВОЕ МЕНЮ — ПОЯВЛЕНИЕ ПРИ ЗАГРУЗКЕ
   ========================= */

@keyframes nav-item-enter {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.sidebar h1 {
    animation: nav-item-enter 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s backwards;
}

.sidebar nav > * {
    animation: nav-item-enter 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.sidebar nav > *:nth-child(1) { animation-delay: 0.10s; }
.sidebar nav > *:nth-child(2) { animation-delay: 0.15s; }
.sidebar nav > *:nth-child(3) { animation-delay: 0.20s; }
.sidebar nav > *:nth-child(4) { animation-delay: 0.25s; }
.sidebar nav > *:nth-child(5) { animation-delay: 0.30s; }
.sidebar nav > *:nth-child(6) { animation-delay: 0.35s; }
.sidebar nav > *:nth-child(7) { animation-delay: 0.40s; }
.sidebar nav > *:nth-child(n + 8) { animation-delay: 0.45s; }


/* =========================
   БОКОВОЕ МЕНЮ — НАВЕДЕНИЕ И АКТИВНЫЙ РАЗДЕЛ
   ========================= */

.sidebar nav > button,
.menu-dropdown > button {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar nav > button > span,
.menu-dropdown > button > span {
    transition: transform 0.25s ease;
}

.sidebar nav > button:hover > span,
.menu-dropdown > button:hover > span {
    transform: translateX(3px);
}

/* Акцентная полоска слева */

.sidebar nav > button::before,
.menu-dropdown > button::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.75;
    transform: scaleY(0);
    transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.sidebar nav > button:hover::before,
.menu-dropdown > button:hover::before {
    transform: scaleY(0.55);
}

.sidebar nav button.is-active {
    background-color: var(--accent-soft);
    color: var(--accent-strong);
}

.sidebar nav button.is-active::before {
    transform: scaleY(1);
    opacity: 1;
}

.sidebar nav button.is-active:hover {
    background-color: var(--accent-soft);
    color: var(--accent-strong);
}


/* =========================
   ПОДМЕНЮ — ШЕВРОН
   ========================= */

.menu-dropdown > button::after {
    content: "";
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: 0.55;
    transform: rotate(45deg);
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease;
}

.menu-dropdown > button:hover::after {
    opacity: 0.9;
}

.menu-dropdown > button[aria-expanded="true"]::after {
    transform: rotate(225deg);
    opacity: 0.9;
}

.dropdown-content button {
    animation: nav-item-enter 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.dropdown-content button:nth-child(1) { animation-delay: 0.03s; }
.dropdown-content button:nth-child(2) { animation-delay: 0.08s; }
.dropdown-content button:nth-child(3) { animation-delay: 0.13s; }


/* =========================
   ПЕРЕХОД МЕЖДУ РАЗДЕЛАМИ
   ========================= */

@keyframes section-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
}

.content > section.section-enter {
    animation: section-enter 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}


/* =========================
   КАРТОЧКИ — ПОЯВЛЕНИЕ
   ========================= */

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
}

.wiki-cards > .wiki-card,
.belonging-list > .belonging-button,
.creature-category-list > .creature-category-button,
.god-buttons > .god-button {
    animation: card-enter 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.wiki-cards > .wiki-card:nth-child(2),
.belonging-list > .belonging-button:nth-child(2),
.creature-category-list > .creature-category-button:nth-child(2),
.god-buttons > .god-button:nth-child(2) { animation-delay: 0.05s; }

.wiki-cards > .wiki-card:nth-child(3),
.belonging-list > .belonging-button:nth-child(3),
.creature-category-list > .creature-category-button:nth-child(3),
.god-buttons > .god-button:nth-child(3) { animation-delay: 0.10s; }

.wiki-cards > .wiki-card:nth-child(4),
.belonging-list > .belonging-button:nth-child(4),
.creature-category-list > .creature-category-button:nth-child(4),
.god-buttons > .god-button:nth-child(4) { animation-delay: 0.15s; }

.wiki-cards > .wiki-card:nth-child(5),
.belonging-list > .belonging-button:nth-child(5),
.creature-category-list > .creature-category-button:nth-child(5),
.god-buttons > .god-button:nth-child(5) { animation-delay: 0.20s; }

.wiki-cards > .wiki-card:nth-child(n + 6),
.belonging-list > .belonging-button:nth-child(n + 6),
.creature-category-list > .creature-category-button:nth-child(n + 6),
.god-buttons > .god-button:nth-child(n + 6) { animation-delay: 0.25s; }


/* =========================
   КАРТОЧКИ — НАВЕДЕНИЕ (единый стиль)
   ========================= */

.content button:not(.search-result):not(.god-category-toggle):hover,
.content .wiki-card:hover,
.content .belonging-button:hover,
.content .creature-category-button:hover {
    transform: translateY(-3px);
    border-color: var(--accent-border);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
}

.content .god-button:hover {
    border-color: var(--accent-border);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.30);
}

.content button:not(.search-result):not(.god-category-toggle):focus-visible,
.content .wiki-card:focus-visible,
.content .belonging-button:focus-visible,
.content .creature-category-button:focus-visible {
    border-color: var(--accent-border);
}


/* =========================
   ЗАГОЛОВКИ РАЗДЕЛОВ — ОРНАМЕНТ

   Ромб в духе книжных манускриптов
   и тянущаяся от него золотая линия.
   ========================= */

.content > section > h2,
.content > section > .home-content > h2 {
    position: relative;
    padding-bottom: 16px;
}

.content > section > h2::before,
.content > section > .home-content > h2::before {
    content: "";
    position: absolute;
    left: 1px;
    bottom: 3px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    transform: rotate(45deg);
    box-shadow: 0 0 10px rgb(200 167 107 / 40%);
}

.content > section > h2::after,
.content > section > .home-content > h2::after {
    content: "";
    position: absolute;
    left: 17px;
    bottom: 6px;
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.85;
}


/* =========================
   ГЛАВНАЯ — ПОЯВЛЕНИЕ ЗАГОЛОВКА
   ========================= */

@keyframes home-title-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
        letter-spacing: 0.12em;
    }
}

@keyframes home-subtitle-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.home-content h2 {
    animation: home-title-enter 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.25s backwards;
    letter-spacing: 0.03em;
}

.home-subtitle {
    animation: home-subtitle-enter 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) 0.5s backwards;
}


/* =========================
   ГЛАВНАЯ — ОРНАМЕНТ ПОД ЗАГОЛОВКОМ
   ========================= */

.home-ornament {
    display: flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    margin-top: 26px;
    animation: home-subtitle-enter 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.7s backwards;
}

.home-ornament-line {
    width: 90px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
}

.home-ornament-line:last-child {
    background: linear-gradient(90deg, var(--accent), transparent);
}

.home-ornament-diamond {
    flex: 0 0 auto;
    width: 5px;
    height: 5px;
    background: var(--accent);
    transform: rotate(45deg);
    opacity: 0.75;
}

.home-ornament-diamond-main {
    width: 9px;
    height: 9px;
    opacity: 1;
    box-shadow: 0 0 12px rgb(200 167 107 / 45%);
}


/* =========================
   ХЛЕБНЫЕ КРОШКИ
   ========================= */

@keyframes breadcrumb-enter {
    from {
        opacity: 0;
    }
}

.breadcrumbs a,
.breadcrumb-current {
    animation: breadcrumb-enter 0.35s ease backwards;
}


/* =========================
   КНОПКА ТЕМЫ — РОЗЫГРЫШ

   Светлой темы больше нет. Кнопка запускает полноэкранную
   надпись и синтезированный звук (scripts/prank.js: triggerPrank).
   ========================= */

#prank-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0505;
    cursor: pointer;
}

#prank-overlay[hidden] {
    display: none;
}

.prank-text {
    font-family: var(--font-heading);
    font-size: clamp(64px, 16vw, 240px);
    font-weight: 800;
    line-height: 1;
    color: #e01616;
    letter-spacing: 0.02em;
    text-shadow:
        0 0 18px rgb(224 22 22 / 55%),
        0 0 60px rgb(224 22 22 / 35%);
    user-select: none;
}

@keyframes prank-slam {
    0% {
        opacity: 0;
        transform: scale(2.6);
    }

    55% {
        opacity: 1;
        transform: scale(0.96);
    }

    70% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes prank-shake {
    0%, 100% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-3px, 2px);
    }

    40% {
        transform: translate(3px, -2px);
    }

    60% {
        transform: translate(-2px, -2px);
    }

    80% {
        transform: translate(2px, 2px);
    }
}

#prank-overlay.is-playing {
    animation: prank-shake 0.35s linear 0.25s 5;
}

#prank-overlay.is-playing .prank-text {
    animation: prank-slam 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}


/* =========================
   МЕЛКИЕ АКЦЕНТЫ
   ========================= */

.prank-button:hover,
.search-toggle:hover,
.language-button.is-active {
    border-color: var(--accent-border);
}

.language-button.is-active {
    color: var(--accent);
}

.breadcrumbs a:hover {
    color: var(--accent-strong);
}


/* =========================
   ОТКЛЮЧЕНИЕ АНИМАЦИЙ
   (настройка «уменьшить движение» в системе)
   ========================= */

@media (prefers-reduced-motion: reduce) {
    .sidebar h1,
    .sidebar nav > *,
    .dropdown-content button,
    .content > section.section-enter,
    .wiki-cards > .wiki-card,
    .belonging-list > .belonging-button,
    .creature-category-list > .creature-category-button,
    .god-buttons > .god-button,
    .home-content h2,
    .home-subtitle,
    .home-ornament,
    .breadcrumbs a,
    .breadcrumb-current {
        animation: none !important;
    }

    .sidebar nav > button::before,
    .menu-dropdown > button::after,
    .sidebar nav > button > span,
    .menu-dropdown > button > span {
        transition: none !important;
    }

    #prank-overlay.is-playing,
    #prank-overlay.is-playing .prank-text {
        animation: none !important;
    }
}
