/* Page « Comment ca marche » (templates/howto.html) : parcours du visiteur et de l'hote aux symboles inspires du BPMN :
   cercle fin = depart, carte arrondie = etape, losange = controle du QR code,
   cercle epais = arrivee. Onglets et trace : static/js/pages/howto.js */

:root {
    --howto-gold: #ba9966;
    --howto-gold-dark: #8a6d3b;
    --howto-ink: #3a3a3a;
    --howto-paper: #fbf8f3;
    --howto-gap: 44px;
}

/* --- Comment ca marche ---------------------------------------------------------------- */

.howto {
    max-width: 1080px;
    margin: 36px auto 24px;
    padding: 30px 28px 18px;
    border-radius: 18px;
    background: var(--howto-paper);
    text-align: left;
}

.howto-page {
    padding: 0 16px 40px;
}

.howto__title {
    margin: 0 0 8px;
    color: var(--howto-ink);
    font-size: 30px;
    text-align: center;
}

.howto__lead {
    margin: 0 0 20px;
    color: #666;
    font-size: 17px;
    text-align: center;
}

.howto__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin: 30px 0 0;
}

.howto__btn {
    padding: 9px 28px;
    border: 2px solid var(--howto-gold);
    border-radius: 24px;
    background: var(--howto-gold);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.howto__btn:hover {
    border-color: var(--howto-gold-dark);
    background: var(--howto-gold-dark);
    color: #fff;
}

.howto__btn--secondary {
    background: #fff;
    color: var(--howto-gold-dark);
}

.howto__tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.howto__tab {
    padding: 8px 22px;
    border: 2px solid var(--howto-gold);
    border-radius: 24px;
    background: #fff;
    color: var(--howto-gold-dark);
    font-weight: 600;
    text-decoration: none;
}

.howto__tab:hover,
.howto__tab[aria-selected="true"] {
    background: var(--howto-gold);
    color: #fff;
}

/* Sans script, les deux parcours se suivent : titre implicite par l'onglet */
.howto__panel + .howto__panel {
    margin-top: 36px;
}

.howto.is-tabbed .howto__panel + .howto__panel {
    margin-top: 0;
}

/* Chemin en serpentin : rangee 1 de gauche a droite, rangee 2 de droite a gauche */
.flow {
    position: relative;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--howto-gap);
    margin: 0;
    padding: 0 0 0 30px;
    list-style: none;
    counter-reset: flow;
}

.flow__step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 132px;
    padding: 16px 12px 14px;
    border: 2px solid var(--howto-gold);
    border-radius: 16px;
    background: #fff;
    color: var(--howto-ink);
    font-size: 15px;
    line-height: 1.35;
    text-align: center;
    box-shadow: 0 3px 0 rgba(186, 153, 102, 0.25);
    counter-increment: flow;
}

/* Numero de l'etape */
.flow__step::after {
    content: counter(flow);
    position: absolute;
    top: -11px;
    right: 12px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: var(--howto-gold);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    line-height: 22px;
    text-align: center;
}

.flow__icon {
    font-size: 30px;
    line-height: 1;
}

/* Depart : cercle fin avant la premiere etape */
.flow__step:first-child::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -32px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    border: 2px solid var(--howto-gold-dark);
    border-radius: 50%;
    background: #fff;
}

.flow__step:nth-child(1) { grid-area: 1 / 1; }
.flow__step:nth-child(2) { grid-area: 1 / 2; }
.flow__step:nth-child(3) { grid-area: 1 / 3; }
.flow__step:nth-child(4) { grid-area: 1 / 4; }
.flow__step:nth-child(5) { grid-area: 2 / 4; }
.flow__step:nth-child(6) { grid-area: 2 / 3; }
.flow__step:nth-child(7) { grid-area: 2 / 2; }
.flow__step:nth-child(8) { grid-area: 2 / 1; }

/* Fleches (flux de sequence) : trait plein et pointe */
.flow__arrow {
    position: absolute;
    top: 50%;
    left: 100%;
    width: var(--howto-gap);
    height: 2px;
    background: var(--howto-gold-dark);
    transform-origin: left center;
}

.flow__arrow::after {
    content: "";
    position: absolute;
    top: -5px;
    right: 0;
    border-left: 9px solid var(--howto-gold-dark);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Fin de la rangee 1 : vers le bas */
.flow__step:nth-child(4) .flow__arrow {
    top: 100%;
    left: 50%;
    width: 2px;
    height: var(--howto-gap);
    transform-origin: center top;
}

.flow__step:nth-child(4) .flow__arrow::after {
    top: auto;
    right: -5px;
    bottom: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 9px solid var(--howto-gold-dark);
    border-bottom: 0;
}

/* Rangee 2 : vers la gauche */
.flow__step:nth-child(n+5) .flow__arrow {
    left: auto;
    right: 100%;
    transform-origin: right center;
}

.flow__step:nth-child(n+5) .flow__arrow::after {
    right: auto;
    left: 0;
    border-left: 0;
    border-right: 9px solid var(--howto-gold-dark);
}

/* Controle du QR code : losange, puis arrivee (cercle epais) */
.flow__step--gateway {
    border-style: dashed;
}

.flow__diamond {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 4px 0;
    border: 2px solid var(--howto-gold-dark);
    background: #fff6e4;
    transform: rotate(45deg);
}

.flow__diamond span {
    color: var(--howto-gold-dark);
    font-size: 12px;
    font-weight: bold;
    transform: rotate(-45deg);
}

.flow__end {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #2f6b2f;
    font-weight: bold;
}

.flow__endcircle {
    flex: none;
    width: 18px;
    height: 18px;
    border: 4px solid var(--howto-gold-dark);
    border-radius: 50%;
}

.flow__no {
    color: #8a8a8a;
    font-size: 13px;
}

/* En resume : visiteurs, hotes, serenite */
.howto-summary {
    max-width: 1080px;
    margin: 36px auto 0;
    text-align: center;
}

.howto-summary__title {
    margin: 0 0 8px;
    color: var(--howto-ink);
    font-size: 25px;
}

.howto-summary__lead {
    margin: 0 auto 18px;
    max-width: 760px;
    color: #555;
    font-size: 17px;
    line-height: 1.5;
}

.howto-points {
    display: grid !important;              /* navbar.css met toutes les listes en colonne flex */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.howto-points li {
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--howto-paper);
    color: #555;
    font-size: 15px;
    line-height: 1.5;
}

.howto-points strong {
    display: block;
    margin-bottom: 4px;
    color: var(--howto-gold-dark);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Legende des symboles */
.howto__legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 22px;
    margin: 26px 0 0;
    color: #8a8a8a;
    font-size: 13px;
}

.howto__legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.howto__sym {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--howto-gold-dark);
}

.howto__sym--start { border-radius: 50%; }
.howto__sym--task { width: 20px; border-radius: 4px; }
.howto__sym--gate { width: 11px; height: 11px; margin: 0 2px; transform: rotate(45deg); }
.howto__sym--end { border-width: 4px; border-radius: 50%; }

/* --- Trace progressif (classe posee par le script, sauf mouvement reduit) ------------- */

.flow.is-animated .flow__step {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.flow.is-animated .flow__arrow {
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.flow.is-animated .flow__step:nth-child(4) .flow__arrow {
    transform: scaleY(0);
}

.flow.is-animated.is-drawn .flow__step {
    opacity: 1;
    transform: none;
}

.flow.is-animated.is-drawn .flow__arrow,
.flow.is-animated.is-drawn .flow__step:nth-child(4) .flow__arrow {
    transform: none;
}

.flow.is-animated .flow__step:nth-child(2) { transition-delay: 0.25s; }
.flow.is-animated .flow__step:nth-child(3) { transition-delay: 0.5s; }
.flow.is-animated .flow__step:nth-child(4) { transition-delay: 0.75s; }
.flow.is-animated .flow__step:nth-child(5) { transition-delay: 1s; }
.flow.is-animated .flow__step:nth-child(6) { transition-delay: 1.25s; }
.flow.is-animated .flow__step:nth-child(7) { transition-delay: 1.5s; }
.flow.is-animated .flow__step:nth-child(8) { transition-delay: 1.75s; }
.flow.is-animated .flow__step:nth-child(1) .flow__arrow { transition-delay: 0.15s; }
.flow.is-animated .flow__step:nth-child(2) .flow__arrow { transition-delay: 0.4s; }
.flow.is-animated .flow__step:nth-child(3) .flow__arrow { transition-delay: 0.65s; }
.flow.is-animated .flow__step:nth-child(4) .flow__arrow { transition-delay: 0.9s; }
.flow.is-animated .flow__step:nth-child(5) .flow__arrow { transition-delay: 1.15s; }
.flow.is-animated .flow__step:nth-child(6) .flow__arrow { transition-delay: 1.4s; }
.flow.is-animated .flow__step:nth-child(7) .flow__arrow { transition-delay: 1.65s; }

/* --- Mobile : chemin vertical ----------------------------------------------------------- */

/* --- Jalons d'une reservation, dans la FAQ (templates/help/_milestones.html) ------------- */

.howto--faq {
    margin: 12px 0 8px;
    padding: 18px 16px 8px;
}

.howto__lane {
    margin: 4px 0 18px;
    color: var(--howto-gold-dark);
    font-size: 18px;
}

.howto--faq .flow {
    margin-bottom: 14px;
}

/* Echeance de l'etape (Reservation, J-14, J-7, Jour J...) */
.flow__when {
    padding: 2px 10px;
    border-radius: 10px;
    background: #fff6e4;
    color: var(--howto-gold-dark);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

.howto__note {
    margin: 0 0 22px;
    color: #6a6a6a;
    font-size: 14px;
}

@media (max-width: 820px) {
    .howto-points {
        grid-template-columns: 1fr;
    }

    .howto {
        margin-top: 40px;
        padding: 24px 16px 16px;
    }

    .howto__title {
        font-size: 25px;
    }

    .howto__tab {
        padding: 7px 14px;
        font-size: 14px;
        white-space: nowrap;
    }

    /* Deux colonnes en serpentin : 1 -> 2, descente, 3 <- 4... (meme lecture que sur ordinateur) */
    .flow {
        --howto-gap: 22px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 28px 0 0;
    }

    .flow__step:nth-child(n) {
        min-height: 0;
        padding: 18px 8px 12px;
        gap: 6px;
        font-size: 13.5px;
    }

    .flow__icon {
        font-size: 24px;
    }

    .flow__step:nth-child(1) { grid-area: 1 / 1; }
    .flow__step:nth-child(2) { grid-area: 1 / 2; }
    .flow__step:nth-child(3) { grid-area: 2 / 2; }
    .flow__step:nth-child(4) { grid-area: 2 / 1; }
    .flow__step:nth-child(5) { grid-area: 3 / 1; }
    .flow__step:nth-child(6) { grid-area: 3 / 2; }
    .flow__step:nth-child(7) { grid-area: 4 / 2; }
    .flow__step:nth-child(8) { grid-area: 4 / 1; }

    /* Depart : au-dessus de la premiere etape */
    .flow__step:first-child::before {
        top: -26px;
        left: 50%;
        margin: 0 0 0 -9px;
    }

    /* Vers la droite : etapes 1 et 5 */
    .flow__step:nth-child(4n+1) .flow__arrow {
        top: 50%;
        right: auto;
        left: 100%;
        width: var(--howto-gap);
        height: 2px;
        transform-origin: left center;
    }

    .flow__step:nth-child(4n+1) .flow__arrow::after {
        top: -5px;
        right: 0;
        bottom: auto;
        left: auto;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 9px solid var(--howto-gold-dark);
        border-right: 0;
    }

    /* Vers le bas : fin de chaque rangee (etapes 2, 4, 6) */
    .flow__step:nth-child(2n) .flow__arrow {
        top: 100%;
        right: auto;
        left: 50%;
        width: 2px;
        height: var(--howto-gap);
        transform-origin: center top;
    }

    .flow__step:nth-child(2n) .flow__arrow::after {
        top: auto;
        right: -5px;
        bottom: 0;
        left: auto;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-top: 9px solid var(--howto-gold-dark);
        border-bottom: 0;
    }

    /* Vers la gauche : etapes 3 et 7 */
    .flow__step:nth-child(4n+3) .flow__arrow {
        top: 50%;
        right: 100%;
        left: auto;
        width: var(--howto-gap);
        height: 2px;
        transform-origin: right center;
    }

    .flow__step:nth-child(4n+3) .flow__arrow::after {
        top: -5px;
        right: auto;
        bottom: auto;
        left: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-right: 9px solid var(--howto-gold-dark);
        border-left: 0;
    }

    .flow.is-animated .flow__step:nth-child(odd) .flow__arrow {
        transform: scaleX(0);
    }

    .flow.is-animated .flow__step:nth-child(2n) .flow__arrow {
        transform: scaleY(0);
    }

    .flow.is-animated.is-drawn .flow__step:nth-child(n) .flow__arrow {
        transform: none;
    }

    .flow__diamond {
        width: 34px;
        height: 34px;
    }

    .flow__end {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flow.is-animated .flow__step,
    .flow.is-animated .flow__arrow {
        transition: none;
    }
}
