/*
 * contact.css — carte recto/verso avec slide animé entre 2 onglets
 *
 * Chargé UNIQUEMENT dans contact.html via {% block extra_head %}.
 *
 * Principe :
 *   - Une seule "carte" qui occupe le même espace physique
 *   - Recto = formulaire (atmosphère papier clair)
 *   - Verso = coordonnées (atmosphère ardoise sombre — "verso de carte de visite")
 *   - Variable CSS --reveal pilote la transition (0 = verso visible, 100 = recto visible)
 *   - Clic sur un onglet → animation GSAP de --reveal vers 0 ou 100
 *   - Effet visuel : le verso glisse de la gauche vers la droite (ou inverse) pour
 *     recouvrir le recto, avec une "lame lumineuse" qui suit le front d'avancement
 *   - Pas de drag manuel — seulement les onglets contrôlent la bascule
 *
 * Variable CSS clé :
 *   --reveal : position du front d'animation en % (0 = verso pleinement visible,
 *              100 = recto pleinement visible). Default 100%.
 *
 * Tokens couleurs (cf. tailwind.config.js) :
 *   primary-700  #5a1224 (bordeaux)
 *   secondary-900 #13234f (marine)
 *   accent-600   #556954 (sauge foncée)
 *   cream-100    #f5efe0 (paper)
 *   ink-950      #0c0f1a (texte sombre / verso bg)
 *   muted-600    #6b6557 (gris chaud)
 *   #e2a8a0      (rose saumon, accent verso sombre — utilisé sur la home)
 */


/* ============================================================
 * STAGE — full viewport (-72px navbar)
 * ============================================================ */
.contact-stage {
    min-height: calc(100svh - var(--navbar-h));
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    --reveal: 100%;
}

/* Décor coins type carnet */
.contact-stage::before,
.contact-stage::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border: 1px solid rgba(12, 15, 26, 0.18);
    pointer-events: none;
    z-index: 1;
}

.contact-stage::before {
    top: 24px;
    left: 24px;
    border-right: none;
    border-bottom: none;
}

.contact-stage::after {
    bottom: 24px;
    right: 24px;
    border-left: none;
    border-top: none;
}


/* ============================================================
 * HEADER — eyebrow + H1 + tab nav
 * ============================================================ */
.contact-stage-header {
    position: relative;
    z-index: 3;
    padding: 24px 0 0;
    flex: none;
}

@media (min-width: 1024px) {
    .contact-stage-header {
        padding: 32px 0 0;
    }
}

.contact-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.contact-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b6557;
}

.contact-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #556954;
    box-shadow: 0 0 0 4px rgba(85, 105, 84, 0.12);
    animation: contact-dot-pulse 1.8s ease-in-out infinite;
}

@keyframes contact-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}


/* ============================================================
 * H1 — morph du mot italique entre faces
 * ============================================================ */
.contact-title {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1.75rem, 4.2vw, 3rem);
    line-height: 1.02;
    letter-spacing: -0.018em;
    color: #13234f;
    margin: 0 0 18px;
    max-width: 22ch;
}

.contact-title em {
    display: inline-block;
    font-style: italic;
    color: #5a1224;
    min-width: 6ch;
}

.contact-title-morph {
    display: inline-block;
    will-change: transform, opacity;
}


/* ============================================================
 * TAB NAV — boutons numérotés
 * ============================================================ */
.contact-tabs-nav {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    border-bottom: 1px solid rgba(12, 15, 26, 0.12);
}

.contact-tab {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px 22px 14px;
    display: inline-flex;
    align-items: baseline;
    gap: 14px;
    color: rgba(12, 15, 26, 0.45);
    transition: color 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    border-radius: 0;
    position: relative;
    font-family: inherit;
}

.contact-tab:hover {
    color: rgba(12, 15, 26, 0.78);
}

.contact-tab.is-active {
    color: #0c0f1a;
}

.contact-tab-number {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.2vw, 2rem);
    line-height: 1;
    color: rgba(90, 18, 36, 0.35);
    transition: color 0.35s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.contact-tab.is-active .contact-tab-number {
    color: #5a1224;
}

.contact-tab-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.contact-tab-label-main {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.1;
    color: inherit;
}

.contact-tab-label-sub {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b6557;
    line-height: 1;
}

/* Indicator underline bordeaux */
.contact-tabs-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    height: 2px;
    background: #5a1224;
    pointer-events: none;
}

.contact-tabs-indicator::after {
    content: "";
    position: absolute;
    right: -3px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5a1224;
}

/* Compteur 01 / 02 static à droite */
.contact-tabs-counter {
    margin-left: auto;
    align-self: center;
    padding-right: 8px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: #6b6557;
    text-transform: uppercase;
    display: none;
    align-items: center;
    gap: 6px;
}

@media (min-width: 768px) {
    .contact-tabs-counter {
        display: inline-flex;
    }
}

.contact-tabs-counter-current {
    color: #5a1224;
    font-weight: 500;
    font-size: 14px;
    line-height: 1;
    min-width: 1.5ch;
    text-align: right;
    display: inline-block;
    will-change: transform, opacity;
}

.contact-tabs-counter-sep {
    opacity: 0.4;
}


/* ============================================================
 * CARTE — wrapper de la scène recto/verso
 * ============================================================ */
.contact-card {
    position: relative;
    flex: 1;
    min-height: 0; /* permet à flex-1 de ne pas dépasser le parent */
    margin-top: 20px;
    overflow: hidden;
    isolation: isolate;
    border-radius: 14px;
    box-shadow: 0 8px 24px -8px rgba(12, 15, 26, 0.18);
}

@media (max-width: 1023px) {
    .contact-card {
        border-radius: 10px;
        margin-top: 16px;
    }
}


/* ============================================================
 * CARD SIDES — recto / verso superposés
 * ============================================================ */
.card-side {
    position: absolute;
    inset: 0;
    overflow: hidden; /* clip les filigranes ::after qui débordent */
    z-index: 1;
}

/* Wrapper interne qui porte le scroll réel (séparé du décor) */
.card-content {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 24px 24px;
    z-index: 2;
    scrollbar-width: thin;
    scrollbar-color: rgba(12, 15, 26, 0.18) transparent;
}

.card-content::-webkit-scrollbar {
    width: 5px;
}
.card-content::-webkit-scrollbar-track {
    background: transparent;
}
.card-content::-webkit-scrollbar-thumb {
    background: rgba(12, 15, 26, 0.18);
    border-radius: 3px;
}

.card-side-verso .card-content {
    scrollbar-color: rgba(245, 239, 224, 0.22) transparent;
}
.card-side-verso .card-content::-webkit-scrollbar-thumb {
    background: rgba(245, 239, 224, 0.22);
}

@media (min-width: 1024px) {
    .card-content {
        padding: 36px 48px 32px;
    }
}


/* ────────────────────────────────────────────────────────────
 * RECTO — formulaire (ambiance "papier clair" / atelier)
 * Bg crème + dot-grid, texte sombre, accents bordeaux
 * ──────────────────────────────────────────────────────────── */
.card-side-recto {
    background-color: #ece5d6;
    background-image: radial-gradient(circle at 1px 1px, rgba(12, 15, 26, 0.06) 1px, transparent 0);
    background-size: 18px 18px;
    z-index: 1;
}

/* Filigrane "C" décoratif sur le recto uniquement */
.card-side-recto::after {
    content: "C";
    position: absolute;
    bottom: -80px;
    right: -40px;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: 460px;
    line-height: 0.8;
    color: rgba(90, 18, 36, 0.04);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}


/* ────────────────────────────────────────────────────────────
 * VERSO — coordonnées (ambiance "ardoise / verso premium")
 * Bg ink-950 + dot-grid-ink, texte cream, accents saumon #e2a8a0
 * Clippé selon --reveal (clic onglet uniquement)
 * ──────────────────────────────────────────────────────────── */
.card-side-verso {
    background-color: #0c0f1a;
    background-image: radial-gradient(circle at 1px 1px, rgba(245, 239, 224, 0.08) 1px, transparent 0);
    background-size: 18px 18px;
    color: #f5efe0;
    z-index: 2;
    /* Clip à droite : --reveal=100% → entièrement clippé (invisible)
                       --reveal=0% → non clippé (entièrement visible) */
    clip-path: inset(0 var(--reveal) 0 0);
}

/* Filigrane "C" sur le verso aussi mais en cream très soft */
.card-side-verso::after {
    content: "M";
    position: absolute;
    top: -60px;
    left: -30px;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: 380px;
    line-height: 0.8;
    color: rgba(226, 168, 160, 0.06);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}


/* ────────────────────────────────────────────────────────────
 * WIPE-EDGE — bande lumineuse qui suit le front du clip
 * Position pilotée par --reveal, opacity boostée pendant l'anim
 * ──────────────────────────────────────────────────────────── */
.card-wipe-edge {
    position: absolute;
    top: 0;
    bottom: 0;
    /* Le front du clip est à la position (100% - --reveal) depuis la gauche */
    left: calc(100% - var(--reveal));
    width: 2px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(226, 168, 160, 0.85) 30%,
        rgba(226, 168, 160, 0.85) 70%,
        transparent 100%);
    box-shadow:
        0 0 18px rgba(226, 168, 160, 0.55),
        0 0 36px rgba(226, 168, 160, 0.25);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-1px);
}

.contact-stage.is-animating .card-wipe-edge {
    opacity: 1;
}

/* Quand on est à un état "résolu" (100% ou 0%), le wipe est invisible */
.contact-stage[data-active="0"] .card-wipe-edge,
.contact-stage[data-active="1"] .card-wipe-edge {
    /* géré par le JS via .is-animating */
}


/* ============================================================
 * REDUCED MOTION — pas d'animation, juste un swap show/hide
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .card-side-verso {
        clip-path: none;
        display: none;
    }
    .contact-stage[data-active="1"] .card-side-verso {
        display: block;
    }
    .contact-stage[data-active="1"] .card-side-recto {
        display: none;
    }
    .contact-live-dot {
        animation: none;
    }
    .card-wipe-edge {
        display: none;
    }
}


/* ============================================================
 * RECTO CONTENT — grid form / aside meta-blocks
 * ============================================================ */
.card-recto-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    position: relative;
    z-index: 1;
}

@media (min-width: 1024px) {
    .card-recto-grid {
        grid-template-columns: 1.35fr 0.65fr;
        gap: 40px;
    }
}

.card-recto-intro {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1b1e2a;
    max-width: 44ch;
    margin: 0 0 4px;
}

.card-recto-aside {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 2px;
}

.card-recto-meta {
    border-left: 1px solid rgba(12, 15, 26, 0.15);
    padding-left: 16px;
}

.card-recto-meta dt {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6b6557;
    margin-bottom: 4px;
}

.card-recto-meta dd {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: 20px;
    color: #5a1224;
    line-height: 1;
    margin: 0;
}

.card-recto-meta-sub {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 11px;
    color: #1b1e2a;
    font-style: normal;
    margin-top: 3px;
    line-height: 1.4;
    display: block;
}

.card-side-recto .form-editorial {
    gap: 16px;
}

.card-side-recto .input-editorial,
.card-side-recto .textarea-editorial,
.card-side-recto .select-editorial {
    padding: 8px 0 8px;
    font-size: 14px;
}

.card-side-recto .label-editorial {
    margin-bottom: 5px;
}

.card-side-recto .textarea-editorial {
    min-height: 70px;
}

.card-side-recto .form-grid-2 {
    gap: 18px;
}

.card-side-recto .form-actions {
    margin-top: 4px;
}


/* ============================================================
 * VERSO CONTENT — coordonnées + engagements (palette sombre)
 * Texte cream-100, accents saumon #e2a8a0, bloc engagements clair
 * ============================================================ */
.card-verso-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
    position: relative;
    z-index: 1;
}

@media (min-width: 1024px) {
    .card-verso-grid {
        grid-template-columns: 1fr 0.85fr;
        gap: 44px;
    }
}

/* Eyebrow override sur verso sombre */
.card-side-verso .eyebrow {
    color: rgba(245, 239, 224, 0.6);
}

.card-side-verso .eyebrow::before {
    color: #e2a8a0;
}

.card-verso-eyebrow {
    margin-bottom: 14px;
}

.card-verso-intro {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(245, 239, 224, 0.78);
    max-width: 44ch;
    margin: 0 0 20px;
}

.card-verso-grid .contact-coords-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 28px;
}

.card-verso-grid .contact-coords-list dt {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(245, 239, 224, 0.5);
    margin-bottom: 8px;
}

.card-verso-grid .contact-coords-list dd {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 15px;
    color: #f5efe0;
    margin: 0;
    line-height: 1.4;
}

.card-verso-grid .contact-coords-list dd a {
    color: inherit;
    text-decoration: none;
}

.card-verso-grid .contact-coords-list dd a.link-underline:hover {
    color: #e2a8a0;
}

.card-verso-grid .contact-coords-list .mono-meta {
    display: block;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(245, 239, 224, 0.5);
    margin-top: 6px;
}

.card-verso-grid .contact-coords-list .mono-meta-accent {
    color: #e2a8a0;
}

.contact-coords-quote {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    line-height: 1.35;
    color: #f5efe0;
    border-top: 1px solid rgba(245, 239, 224, 0.18);
    padding-top: 16px;
    margin-top: 20px;
    max-width: 42ch;
}

.contact-coords-quote strong {
    color: #e2a8a0;
    font-weight: 500;
}

/* Bloc engagements : carte CLAIRE imbriquée dans verso SOMBRE
   Effet : on dirait une petite carte papier posée sur l'ardoise sombre */
.contact-engagements {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f5efe0;
    border: 1px solid rgba(245, 239, 224, 0.15);
    border-radius: 14px;
    padding: 20px 22px 18px;
    position: relative;
    box-shadow:
        0 8px 24px -8px rgba(0, 0, 0, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.2);
    /* Légère rotation décalée pour effet "carte posée" */
    transform: rotate(-0.6deg);
}

.contact-engagements::before {
    content: "✦";
    position: absolute;
    top: -12px;
    right: 20px;
    background: #f5efe0;
    color: #5a1224;
    font-family: "Fraunces", Georgia, serif;
    font-size: 20px;
    padding: 0 8px;
    line-height: 1;
}

/* Eyebrow dans le bloc engagements : redevient claire (palette papier) */
.contact-engagements .eyebrow {
    color: #6b6557;
}

.contact-engagements .eyebrow::before {
    color: #5a1224;
}

.contact-engagement {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.contact-engagement-num {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: 26px;
    line-height: 1;
    color: #5a1224;
    flex: none;
    min-width: 30px;
}

.contact-engagement-body h3 {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: 15px;
    line-height: 1.2;
    color: #0c0f1a;
    margin: 0 0 3px;
}

.contact-engagement-body p {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
    font-size: 12.5px;
    line-height: 1.45;
    color: #1b1e2a;
    margin: 0;
}


/* ============================================================
 * MOBILE — simplifications
 * ============================================================ */
@media (max-width: 767px) {
    .card-side {
        padding: 28px 22px 24px;
    }
    .card-side-recto::after,
    .card-side-verso::after {
        font-size: 280px;
    }
    .card-verso-grid .contact-coords-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .contact-engagements {
        transform: none;
    }
}
