/* ============================================================
   ANNET-ROMAIN — TUTORIAL OVERLAY CSS
   DA : Brutalisme / Noir + #ccff00 + #4361ee
   Responsive : desktop (highlight) + mobile (centré, sans highlight)
   ============================================================ */

/* ---- Variables locales (reprennent la DA du site) ---- */
#annet-tutorial {
    --tuto-lime: #ccff00;
    --tuto-blue: #4361ee;
    --tuto-black: #1a1a1a;
    --tuto-white: #f2f2f0;
    --tuto-shadow: 8px 8px 0px 0px var(--tuto-black);
    --tuto-font-h: 'Space Grotesk', sans-serif;
    --tuto-font-m: 'Space Mono', monospace;
    --tuto-font-b: 'Inter', sans-serif;
}

/* ---- Couche principale
   z-index: 2147483644 = juste en dessous du max (2147483647)
   Passe au-dessus de : noise overlay, curseur inversé, header, TOUT.
   ---- */
#annet-tutorial {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#annet-tutorial.is-active {
    pointer-events: auto;
    opacity: 1;
}

/* ---- Backdrop : visible quand show-overlay, masqué sinon ---- */
.tuto-backdrop {
    position: absolute;
    inset: 0;
    /* Assombrissement (visible uniquement sur les étapes avec showOverlay:true) */
    background: rgba(10, 10, 10, 0.82);
    z-index: 1;
    transition: opacity 0.3s ease;
    opacity: 0;
    /* masqué par défaut */
    pointer-events: none;
}

/* Actif quand JS ajoute .show-overlay sur #annet-tutorial */
#annet-tutorial.show-overlay .tuto-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Quand le highlight gère lui-même l'assombrissement (box-shadow),
   le backdrop s'efface pour ne pas doubler l'effet. */
#annet-tutorial.has-highlight .tuto-backdrop {
    opacity: 0;
    pointer-events: none;
}

/* Mode sans overlay : les éléments de l'overlay pointeurs sont désactivés
   (sauf la carte qui reste cliquable) */
#annet-tutorial.no-overlay {
    /* L'overlay occupe toujours la scène mais est transparent */
    background: transparent;
    pointer-events: none;
    /* laisse passer les clics sur le site */
}

#annet-tutorial.no-overlay .tuto-card {
    pointer-events: auto;
    /* mais la carte reste interactive */
}

#annet-tutorial.no-overlay .tuto-card-header {
    cursor: default;
}

/* ---- Highlight desktop
   Approche : le highlight est VIDE et propre (z-index > backdrop).
   Son box-shadow géante assombrit TOUT le reste de l'écran sans blur.
   La zone à l'intérieur de la bordure reste parfaitement nette et lumineuse.
   ---- */
.tuto-highlight {
    position: fixed;
    /* fixed pour coller aux coords getBoundingClientRect */
    border: 3px solid var(--tuto-lime);
    /* box-shadow : couche sombre sur tout ce qui n'est pas la zone focus */
    box-shadow:
        0 0 0 9999px rgba(10, 10, 10, 0.82),
        /* assombrissement extérieur */
        0 0 0 5px var(--tuto-lime),
        /* halo lime autour du focus */
        inset 0 0 0 2px rgba(204, 255, 0, 0.4);
    /* liseré intérieur discret */
    z-index: 2;
    pointer-events: none;
    transition:
        top 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        left 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        width 0.35s ease,
        height 0.35s ease,
        opacity 0.3s ease;
    opacity: 0;
}

.tuto-highlight.is-visible {
    opacity: 1;
}

/* ---- Carte principale ---- */
.tuto-card {
    position: fixed;
    /* fixed pour ne pas dépendre du scroll */
    width: clamp(280px, 90vw, 460px);
    background: var(--tuto-white);
    border: 2px solid var(--tuto-black);
    box-shadow: var(--tuto-shadow);
    z-index: 3;
    /* au-dessus du highlight */
    display: flex;
    flex-direction: column;
    gap: 0;
    transition:
        top 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Position par défaut : centrée (overridée par JS sur desktop avec target) */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ---- En-tête de carte ---- */
.tuto-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--tuto-black);
    padding: 10px 14px;
    border-bottom: 2px solid var(--tuto-lime);
}

.tuto-badge {
    font-family: var(--tuto-font-m);
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 0.18em;
    color: var(--tuto-lime);
    text-transform: uppercase;
    white-space: nowrap;
}

/* Points de progression */
.tuto-progress-dots {
    display: flex;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.tuto-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.tuto-dot.is-done {
    background: rgba(204, 255, 0, 0.5);
}

.tuto-dot.is-current {
    background: var(--tuto-lime);
    transform: scale(1.35);
}

/* Bouton Passer */
.tuto-skip {
    font-family: var(--tuto-font-m);
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    padding: 2px 4px;
    transition: color 0.2s ease;
    text-transform: uppercase;
}

.tuto-skip:hover {
    color: white;
}

/* ---- Corps (icône + titre) ---- */
.tuto-card-body {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 18px 10px;
    border-bottom: 2px dashed rgba(26, 26, 26, 0.12);
}

.tuto-icon {
    width: 48px;
    height: 48px;
    background: var(--tuto-lime);
    border: 2px solid var(--tuto-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    box-shadow: 3px 3px 0px var(--tuto-black);
}

.tuto-title {
    font-family: var(--tuto-font-h);
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--tuto-black);
    line-height: 1.15;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ---- Sous-titres ---- */
.tuto-subtitle-wrap {
    padding: 14px 18px;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.tuto-subtitle {
    font-family: var(--tuto-font-b);
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--tuto-black);
    margin: 0;
}

.tuto-subtitle strong {
    background: linear-gradient(104deg, transparent 0.9%, var(--tuto-lime) 2.4%, var(--tuto-lime) 98%, transparent 99%);
    padding: 0 0.15em;
    color: var(--tuto-black);
    font-weight: 800;
}

/* ---- Indicateur audio ---- */
.tuto-audio-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tuto-audio-indicator.has-audio {
    opacity: 1;
}

.tuto-audio-dot {
    width: 8px;
    height: 8px;
    background: var(--tuto-blue);
    border-radius: 50%;
    animation: pulse-audio 1.4s infinite ease-in-out;
    flex-shrink: 0;
}

@keyframes pulse-audio {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.6;
    }
}

.tuto-audio-label {
    font-family: var(--tuto-font-m);
    font-size: 0.6rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: var(--tuto-blue);
    text-transform: uppercase;
}

/* ---- Actions ---- */
.tuto-actions {
    display: flex;
    gap: 10px;
    padding: 14px 18px 18px;
    border-top: 2px solid rgba(26, 26, 26, 0.1);
    justify-content: flex-end;
    align-items: center;
}

.tuto-btn {
    font-family: var(--tuto-font-m);
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 2px solid var(--tuto-black);
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.tuto-btn:active {
    transform: translate(3px, 3px) !important;
    box-shadow: 0 0 0 transparent !important;
}

/* Retour */
.tuto-btn-prev {
    background: var(--tuto-white);
    color: var(--tuto-black);
    box-shadow: 4px 4px 0px var(--tuto-black);
    margin-right: auto;
}

.tuto-btn-prev:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--tuto-black);
}

.tuto-btn-prev:disabled {
    opacity: 0.3;
    cursor: default;
    transform: none;
    box-shadow: 2px 2px 0px var(--tuto-black);
}

/* Suivant */
.tuto-btn-next {
    background: var(--tuto-black);
    color: var(--tuto-lime);
    box-shadow: 4px 4px 0px var(--tuto-lime);
}

.tuto-btn-next:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--tuto-lime);
}

/* Terminer */
.tuto-btn-done {
    background: var(--tuto-lime);
    color: var(--tuto-black);
    box-shadow: 4px 4px 0px var(--tuto-black);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.tuto-btn-done:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px var(--tuto-black);
}

/* ---- Bouton Replay (Information / Aide) ---- */
.tuto-replay-btn {
    position: fixed;
    bottom: 24px;
    /* Correspond à bottom-6 du bouton CV */
    left: 24px;
    z-index: 2147483640;
    width: 56px;
    /* Correspond à w-14 du bouton CV */
    height: 56px;
    /* Correspond à h-14 du bouton CV */
    border-radius: 0;
    background: #ffffff;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 4px 4px 0px 0px #1a1a1a;
    /* Même ombre que le bouton CV */
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 1.5rem;
    /* Icone plus large */
}

.tuto-replay-btn i {
    font-weight: 900 !important;
    /* Force l'épaisseur maximale pour le 'i' */
}

.tuto-replay-btn:hover {
    transform: translate(-3px, -3px);
    box-shadow: 6px 6px 0px 0px #ccff00;
    background: #ffffff;
    color: #1a1a1a;
    /* Garde la couleur mais change l'effet d'ombre */
    border-color: #1a1a1a;
}

/* On assure l'adaptation aux zones sûres mobile (envsafe-area) */
@media (max-width: 768px) {
    .tuto-replay-btn {
        bottom: 24px;
        left: 24px;
        width: 48px;
        /* Un peu plus compact sur mobile */
        height: 48px;
    }
}

/* ================================
   VERSION MOBILE  (≤767px)
   Pas de highlight — carte centrée
   ================================ */
@media (max-width: 767px) {
    .tuto-card {
        max-height: 82vh;
        overflow-y: auto;
        width: min(90vw, 420px);
    }

    .tuto-subtitle-wrap {
        min-height: 60px;
    }

    .tuto-title {
        font-size: 1rem;
    }

    .tuto-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .tuto-replay-btn {
        bottom: 24px;
        left: 24px;
        font-size: 0.6rem;
        padding: 6px 10px;
    }
}

/* ================================
   ANIMATION D'ENTRÉE
   ================================ */
@keyframes tuto-slide-in {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 24px));
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

#annet-tutorial.is-active .tuto-card {
    animation: tuto-slide-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Stoppe l'animation quand JS repositionne la carte (desktop + target) */
#annet-tutorial.is-active .tuto-card.is-positioned {
    animation: none;
}