/* ══════════════════════════════════════════════════════════
   Interactive Guided Tour — Premium Edition (Mobile-Ready)
   ══════════════════════════════════════════════════════════ */

/* ── Overlay ─────────────────────────────────────────────── */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    transition: background 0.6s, backdrop-filter 0.6s, opacity 0.6s, visibility 0.6s;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}
.tour-overlay--dimmed {
    background: rgba(8, 10, 16, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.tour-overlay--active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Spotlight (hole in the overlay) ─────────────────────── */
.tour-spotlight {
    position: fixed;
    z-index: 10001;
    border-radius: 10px;
    box-shadow:
        0 0 0 9999px rgba(8, 10, 16, 0.82),
        0 0 0 3px rgba(200, 168, 84, 0.5),
        0 0 30px rgba(200, 168, 84, 0.15),
        0 0 60px rgba(200, 168, 84, 0.08);
    transition: all 0.55s cubic-bezier(0.34, 1.15, 0.64, 1);
    pointer-events: none;
    opacity: 0;
}
.tour-spotlight--active {
    opacity: 1;
}
.tour-spotlight--active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid rgba(200, 168, 84, 0.3);
    animation: tourSpotlightPulse 2s ease-in-out infinite;
}
@keyframes tourSpotlightPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* ── Card ────────────────────────────────────────────────── */
.tour-card {
    position: fixed;
    z-index: 10002;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: linear-gradient(165deg, rgba(26, 30, 44, 0.97), rgba(18, 21, 30, 0.98));
    backdrop-filter: blur(30px) saturate(1.3);
    -webkit-backdrop-filter: blur(30px) saturate(1.3);
    border: 1px solid rgba(200, 168, 84, 0.25);
    border-radius: 16px;
    padding: 20px;
    color: #fff;
    box-shadow:
        0 24px 48px rgba(0,0,0,0.5),
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 1px 0 rgba(255,255,255,0.06) inset;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    transition: all 0.55s cubic-bezier(0.34, 1.15, 0.64, 1);
    pointer-events: none;
    font-family: var(--font);
    overflow: hidden;
    box-sizing: border-box;
}
.tour-card--active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.tour-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.7;
}

/* ── Close button (X) — always visible ───────────────────── */
.tour-card__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 1;
}
.tour-card__close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ── Card inner elements ─────────────────────────────────── */
.tour-card__counter {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(200, 168, 84, 0.6);
    margin-bottom: 8px;
}
.tour-card__icon {
    font-size: 28px;
    margin-bottom: 10px;
    display: inline-block;
    filter: drop-shadow(0 2px 8px rgba(200, 168, 84, 0.3));
}
.tour-card__title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.25;
    padding-right: 28px; /* space for close btn */
}
.tour-card__text {
    font-size: 13px;
    color: rgba(226, 230, 239, 0.7);
    line-height: 1.55;
    margin-bottom: 16px;
}
.tour-card__kbd-hint {
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.tour-card__kbd-hint kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 4px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 9px;
    color: rgba(255,255,255,0.35);
}

/* ── Footer ──────────────────────────────────────────────── */
.tour-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Progress Bar ────────────────────────────────────────── */
.tour-progress {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-shrink: 0;
}
.tour-progress__bar {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.12);
    transition: all 0.4s cubic-bezier(0.34, 1.15, 0.64, 1);
}
.tour-progress__bar--active {
    width: 22px;
    background: var(--gold);
    box-shadow: 0 0 6px rgba(200, 168, 84, 0.4);
}
.tour-progress__bar--done {
    background: rgba(200, 168, 84, 0.4);
}

/* ── Buttons ─────────────────────────────────────────────── */
.tour-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.tour-btn {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.15, 0.64, 1);
    border: none;
    font-family: var(--font);
    white-space: nowrap;
}
.tour-btn--ghost {
    background: transparent;
    color: rgba(255,255,255,0.4);
    padding: 7px 8px;
}
.tour-btn--ghost:hover { color: #fff; background: rgba(255,255,255,0.08); }
.tour-btn--back {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 6px 10px;
}
.tour-btn--back:hover { background: rgba(255,255,255,0.1); color: #fff; }
.tour-btn--primary {
    background: linear-gradient(135deg, var(--gold), #b89530);
    color: #12151e;
    box-shadow: 0 3px 10px rgba(200, 168, 84, 0.25);
}
.tour-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(200, 168, 84, 0.4);
}

/* ── Welcome variant ─────────────────────────────────────── */
.tour-card--welcome { text-align: center; }
.tour-card--welcome .tour-card__icon { font-size: 40px; margin-bottom: 12px; }
.tour-card--welcome .tour-card__title { font-size: 22px; padding-right: 0; }

/* ══ MOBILE ══════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .tour-card {
        width: auto;
        max-width: none;
        left: 8px !important;
        right: 8px;
        bottom: 12px !important;
        top: auto !important;
        transform: translateY(0) scale(1) !important;
        border-radius: 14px;
        padding: 16px;
        max-height: 55vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tour-card--welcome {
        bottom: auto !important;
        top: 50% !important;
        left: 8px !important;
        right: 8px;
        transform: translate(0, -50%) scale(1) !important;
        max-height: 80vh;
    }
    .tour-card__counter { font-size: 9px; margin-bottom: 6px; }
    .tour-card__icon { font-size: 24px; margin-bottom: 8px; }
    .tour-card__title { font-size: 16px; margin-bottom: 6px; padding-right: 32px; }
    .tour-card--welcome .tour-card__title { font-size: 20px; padding-right: 0; }
    .tour-card--welcome .tour-card__icon { font-size: 32px; }
    .tour-card__text { font-size: 13px; margin-bottom: 12px; line-height: 1.5; }
    .tour-card__kbd-hint { display: none; } /* hide keyboard hints on mobile */
    .tour-card__footer {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .tour-progress__bar { width: 12px; }
    .tour-progress__bar--active { width: 18px; }
    .tour-btn { padding: 8px 10px; font-size: 12px; }
    .tour-btn--ghost { padding: 8px 6px; font-size: 11px; }

    .tour-spotlight {
        box-shadow:
            0 0 0 9999px rgba(8, 10, 16, 0.82),
            0 0 0 2px rgba(200, 168, 84, 0.4);
    }
    .tour-spotlight--active::after { display: none; } /* skip pulse on mobile for perf */
    .tour-particles { display: none; } /* skip particles on mobile for perf */
}

@media (max-width: 360px) {
    .tour-card { padding: 14px; }
    .tour-card__title { font-size: 15px; }
    .tour-card__text { font-size: 12px; }
    .tour-btn { padding: 7px 8px; font-size: 11px; }
    .tour-btn--back { display: none; } /* hide Back on very small screens */
}

/* ── Floating Tour Trigger Button ────────────────────────── */
.tour-trigger {
    position: fixed;
    bottom: 88px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(22, 26, 38, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 168, 84, 0.25);
    color: var(--gold);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transition: all 0.35s cubic-bezier(0.34, 1.15, 0.64, 1);
    z-index: 8999;
    animation: tourTriggerEntry 0.6s 2s cubic-bezier(0.34, 1.15, 0.64, 1) both;
}
@keyframes tourTriggerEntry {
    from { opacity: 0; transform: scale(0.5) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.tour-trigger:hover {
    transform: scale(1.12) translateY(-2px);
    background: rgba(30, 35, 50, 0.95);
    box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 20px rgba(200, 168, 84, 0.2);
    border-color: var(--gold);
}
.tour-trigger::after {
    content: "Экскурсия по сайту";
    position: absolute;
    right: 58px;
    background: rgba(22, 26, 38, 0.95);
    backdrop-filter: blur(8px);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gold);
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    border: 1px solid rgba(200, 168, 84, 0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.tour-trigger:hover::after { opacity: 1; transform: translateX(0); }

.tour-trigger--pulse {
    animation: tourTriggerEntry 0.6s 2s cubic-bezier(0.34, 1.15, 0.64, 1) both,
               tourTriggerPulse 2.5s 3s ease-in-out 3;
}
@keyframes tourTriggerPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
    50% { box-shadow: 0 8px 24px rgba(0,0,0,0.3), 0 0 0 8px rgba(200, 168, 84, 0.15); }
}

@media (max-width: 600px) {
    .tour-trigger {
        width: 42px;
        height: 42px;
        bottom: 78px;
        right: 16px;
        font-size: 18px;
    }
    .tour-trigger::after { display: none; }
}

/* ── Particle Canvas ─────────────────────────────────────── */
.tour-particles {
    position: fixed;
    inset: 0;
    z-index: 10001;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.tour-particles--active { opacity: 1; }
