/* Кнопка «Назад в прошлое» и выдвижная панель (только главная) */

.time-portal-trigger-wrap {
    position: fixed;
    right: 0;
    top: 50%;
    z-index: 110;
    padding: 20px 16px 20px 18px;
    overflow: visible;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
    background-color: var(--grad-main-from);
    background-image: var(--grad-main);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    box-shadow:
        -6px 0 28px rgba(124, 92, 255, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%);
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.time-portal-trigger-wrap:has(.time-portal-trigger[aria-expanded="true"]) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.time-portal-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0;
    overflow: visible;
    border: none;
    border-radius: 0;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    letter-spacing: 0.04em;
    color: #fff;
}

.time-portal-trigger::before {
    display: none;
}

.time-portal-trigger__motion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    overflow: visible;
    animation: timePortalNudge 2.6s ease-in-out infinite;
}

@keyframes timePortalNudge {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-11px);
    }
}

.time-portal-trigger__label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 13px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: visible;
}

.time-portal-trigger__icon {
    flex-shrink: 0;
    transform: rotate(-90deg);
}

.time-portal-trigger:hover .time-portal-trigger__motion {
    animation: none;
    transform: translateX(-12px);
}

.time-portal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    pointer-events: none;
    visibility: hidden;
}

.time-portal.is-open {
    pointer-events: auto;
    visibility: visible;
}

.time-portal__panel {
    position: absolute;
    inset: 0;
    background: #070b18;
    transform: translateX(100%);
    transition: transform 0.55s cubic-bezier(0.22, 0.85, 0.25, 1);
    will-change: transform;
}

.time-portal.is-open .time-portal__panel {
    transform: translateX(0);
}

.time-portal__close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px) + 8px);
    right: max(12px, env(safe-area-inset-right, 0px) + 8px);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #e8ecf4;
    background: rgba(20, 28, 55, 0.75);
    border: 1px solid rgba(140, 180, 255, 0.35);
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.time-portal__close:hover {
    background: rgba(124, 92, 255, 0.45);
    border-color: rgba(160, 200, 255, 0.55);
    transform: scale(1.05);
}

.time-portal__frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #070b18;
}

body.is-time-portal-open {
    overflow: hidden;
}

/* Только десктоп: на планшетах и телефонах кнопку не показываем */
@media (max-width: 1024px) {
    .time-portal-trigger-wrap {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .time-portal-trigger__motion {
        animation: none;
    }

    .time-portal-trigger:hover .time-portal-trigger__motion {
        transform: translateX(-6px);
    }

    .time-portal__panel {
        transition: none;
    }

    .time-portal.is-open .time-portal__panel {
        transform: translateX(0);
    }
}
