/* =========================================
   VISITE GUIDÉE : spotlight interactif
========================================= */

.tour {
    --tour-terra: #c0592f;
    --tour-terra-dark: #a44a25;
    --tour-ocre: #e3a33b;
    --tour-ink: #2a1f17;
    --tour-muted: #6f6155;
    --tour-paper: #fff9ef;
    --tour-line: rgba(42, 31, 23, 0.12);
    --tour-ease: cubic-bezier(0.22, 1, 0.36, 1);

    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: "DM Sans", system-ui, sans-serif;
}

.tour.is-open {
    opacity: 1;
}

.tour [hidden],
.tour[hidden] {
    display: none !important;
}

/* ---------- Fond (invitation) ---------- */

.tour-dim {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 40%, rgba(192, 89, 47, 0.28), rgba(30, 19, 12, 0.74));
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tour-dim.is-on {
    opacity: 1;
}

/* ---------- Spotlight ---------- */

.tour-spot {
    position: fixed;
    border-radius: 18px;
    box-shadow: 0 0 0 9999px rgba(30, 19, 12, 0.68);
    transition:
        top 0.6s var(--tour-ease),
        left 0.6s var(--tour-ease),
        width 0.6s var(--tour-ease),
        height 0.6s var(--tour-ease),
        opacity 0.4s ease;
}

.tour-spot.is-instant {
    transition: opacity 0.4s ease;
}

.tour-spot.is-off {
    opacity: 0;
}

.tour-spot::before,
.tour-spot::after {
    content: "";
    position: absolute;
    border-radius: inherit;
    pointer-events: none;
}

.tour-spot::before {
    inset: 0;
    border: 2px solid rgba(227, 163, 59, 0.95);
}

.tour-spot::after {
    inset: -5px;
    border: 2px solid var(--tour-ocre);
    opacity: 0;
    animation: tour-ring 1.9s ease-out infinite;
}

.tour-spot.is-closed::before,
.tour-spot.is-closed::after {
    opacity: 0;
    animation: none;
}

@keyframes tour-ring {
    0% {
        opacity: 0.9;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(1.05);
    }
}

/* ---------- Bulle ---------- */

.tour-card {
    position: fixed;
    box-sizing: border-box;
    width: min(360px, calc(100vw - 24px));
    padding: 1.35rem 1.4rem 1.15rem;
    border: 1px solid var(--tour-line);
    border-radius: 22px;
    background: var(--tour-paper);
    color: var(--tour-ink);
    box-shadow: 0 24px 60px rgba(30, 19, 12, 0.35), 0 4px 12px rgba(30, 19, 12, 0.12);
    pointer-events: auto;
    transition:
        top 0.6s var(--tour-ease),
        left 0.6s var(--tour-ease),
        opacity 0.35s ease,
        translate 0.35s var(--tour-ease);
}

.tour-card.is-instant {
    transition: opacity 0.35s ease, translate 0.35s var(--tour-ease);
}

.tour-card.is-away {
    opacity: 0;
    translate: 0 14px;
    pointer-events: none;
}

.tour-card.is-intro {
    width: min(420px, calc(100vw - 24px));
    padding: 1.9rem 1.8rem 1.5rem;
}

.tour-card.is-docked {
    top: auto !important;
    left: 12px !important;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 60vh;
    overflow-y: auto;
}

/* Barre colorée en haut de la bulle */
.tour-deco {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}

.tour-deco::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--tour-terra), var(--tour-ocre));
}

.tour-sun {
    position: absolute;
    top: -46px;
    right: -46px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffd59a, #d65a40);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.4s ease, transform 0.6s var(--tour-ease);
}

.tour-card.is-intro .tour-sun {
    opacity: 0.9;
    transform: scale(1);
}

/* Petite flèche vers l'élément éclairé */
.tour-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--tour-line);
    background: var(--tour-paper);
    rotate: 45deg;
    display: none;
}

.tour-arrow[data-side="top"] {
    display: block;
    top: -8px;
    left: var(--ax);
    margin-left: -7px;
    border-right: 0;
    border-bottom: 0;
}

.tour-arrow[data-side="bottom"] {
    display: block;
    bottom: -8px;
    left: var(--ax);
    margin-left: -7px;
    border-left: 0;
    border-top: 0;
}

.tour-arrow[data-side="left"] {
    display: block;
    left: -8px;
    top: var(--ay);
    margin-top: -7px;
    border-right: 0;
    border-top: 0;
}

.tour-arrow[data-side="right"] {
    display: block;
    right: -8px;
    top: var(--ay);
    margin-top: -7px;
    border-left: 0;
    border-bottom: 0;
}

/* ---------- Contenu ---------- */

.tour-close {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--tour-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.tour-close:hover {
    background: rgba(42, 31, 23, 0.08);
    color: var(--tour-ink);
}

.tour-badge {
    display: inline-block;
    margin: 0 0 0.7rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    background: rgba(227, 163, 59, 0.22);
    color: var(--tour-terra-dark);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tour-title {
    margin: 0 0 0.45rem;
    padding-right: 1.6rem;
    font-family: "Fraunces", Georgia, serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--tour-ink);
}

.tour-card.is-intro .tour-title {
    font-size: 1.9rem;
}

.tour-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--tour-muted);
}

/* Invitation à agir (étapes interactives) */
.tour-hint {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.95rem 0 0;
    padding: 0.55rem 0.8rem;
    border-radius: 12px;
    background: rgba(192, 89, 47, 0.1);
    color: var(--tour-terra-dark);
    font-size: 0.88rem;
    font-weight: 600;
}

.tour-hint__dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--tour-terra);
    animation: tour-pulse 1.3s ease-in-out infinite;
}

.tour-hint.is-done {
    background: rgba(47, 125, 91, 0.12);
    color: #25694c;
    animation: tour-pop 0.5s var(--tour-ease);
}

.tour-hint.is-done .tour-hint__dot {
    background: #2f7d5b;
    animation: none;
}

@keyframes tour-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(192, 89, 47, 0.55);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(192, 89, 47, 0);
    }
}

@keyframes tour-pop {
    0% {
        transform: scale(0.92);
    }
    60% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ---------- Pied de bulle ---------- */

.tour-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1.1rem;
}

.tour-card.is-intro .tour-footer {
    justify-content: flex-end;
}

.tour-dots {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(42, 31, 23, 0.16);
    transition: width 0.4s var(--tour-ease), background 0.3s ease;
}

.tour-dot.is-done {
    background: var(--tour-ocre);
}

.tour-dot.is-active {
    width: 24px;
    background: var(--tour-terra);
}

.tour-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tour-btn {
    padding: 0.6rem 1.05rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tour-btn--primary {
    background: var(--tour-terra);
    color: #fff;
}

.tour-btn--primary:hover {
    background: var(--tour-terra-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(192, 89, 47, 0.35);
}

.tour-btn--ghost,
.tour-btn--primary.is-ghost {
    border-color: var(--tour-line);
    background: transparent;
    color: var(--tour-ink);
}

.tour-btn--ghost:hover,
.tour-btn--primary.is-ghost:hover {
    background: rgba(42, 31, 23, 0.07);
    box-shadow: none;
    transform: none;
}

.tour-btn:focus-visible,
.tour-close:focus-visible,
.tour-replay:focus-visible {
    outline: 3px solid var(--tour-ocre);
    outline-offset: 2px;
}

/* ---------- Confettis ---------- */

.tour-confetti {
    position: fixed;
    inset: 0;
    z-index: 10001;
    overflow: hidden;
    pointer-events: none;
}

.tour-confetti i {
    position: absolute;
    width: 9px;
    height: 14px;
    border-radius: 2px;
}

/* ---------- Lien « Revoir la visite guidée » ---------- */

.tour-replay {
    display: inline-block;
    margin: 0.9rem 0 0;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(42, 31, 23, 0.2);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.tour-replay:hover {
    opacity: 1;
    background: rgba(192, 89, 47, 0.12);
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
    .tour,
    .tour *,
    .tour *::before,
    .tour *::after {
        transition: none !important;
        animation: none !important;
    }
}