/* =========================================================
   CUBE SECTION — "Notre approche / Quatre piliers"
   GAUCHE : accordéon (un service ouvert à la fois, qui change en scrollant) avec
   icônes + CTA. DROITE : cube glacé dans un panneau lumineux raffiné.
   Pinned scroll (GSAP) · Three.js cube.
   ========================================================= */
.cube-section {
    position: relative;
    width: 100%;
    background: #f3f3f4;
}

.cube-pin {
    position: relative;
    z-index: 2;
    height: 100vh;
    overflow: hidden;
    --svc-accent: #1488E6;   /* accent du service ouvert (accordéon + lueur + cube) */
}

/* Lueur d'accent douce derrière l'accordéon (gauche), change avec le service ouvert */
.cube-pin::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(56% 64% at 24% 50%,
        color-mix(in srgb, var(--svc-accent, #1488E6) 16%, transparent),
        transparent 70%);
    opacity: 0;
    transition: background 0.7s ease, opacity 0.9s ease;
}
.cube-section.cube-entered .cube-pin::before { opacity: 0.7; }

/* Scène : en-tête centré (haut) + rangée services|cube. Padding-top dégage le header (~90px). */
.cube-stage {
    position: relative;
    z-index: 4;
    height: 100%;
    width: min(1240px, 92vw);
    margin: 0 auto;
    padding: clamp(84px, 11vh, 108px) 0 clamp(24px, 4vh, 40px);
    display: flex;
    flex-direction: column;
    --col-h: clamp(440px, 70vh, 560px);   /* hauteur du cube (stable) */
}

/* Rangée services (gauche) + cube (droite), centrés verticalement au même niveau */
.cube-row {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 64px);
}

/* ── Cube : panneau lumineux encadré (arrondi + ombre douce + reflet) ── */
/* Cube SANS panneau : canvas transparent, le cube flotte directement sur la page. */
.cube-canvas {
    position: relative;
    z-index: 2;
    width: 100%;
    height: var(--col-h);
    align-self: center;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 1.6s ease, transform 2s cubic-bezier(.16, 1, .3, 1);
}
.cube-section.cube-entered .cube-canvas {
    opacity: 1;
    transform: scale(1);
}
.cube-canvas canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Rail (gauche) : en-tête + accordéon, centré face au cube ── */
.cube-rail {
    position: relative;
    z-index: 4;
    max-width: 540px;
    align-self: center;
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 1.2s ease 0.1s, transform 1.3s cubic-bezier(.16, 1, .3, 1) 0.1s;
}
.cube-section.cube-entered .cube-rail {
    opacity: 1;
    transform: translateY(0);
}

/* En-tête centré pleine largeur (au centre de la page) */
.cube-rail__head {
    position: relative;
    z-index: 4;
    flex-shrink: 0;
    text-align: center;
    max-width: 760px;
    margin: 0 auto clamp(18px, 3vh, 34px);
}

.cube-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #0077b6;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.28);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.cube-eyebrow-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00b4d8;
    box-shadow: 0 0 10px rgba(0, 180, 216, 0.7);
    animation: cubeDotPulse 2.4s ease-in-out infinite;
}
@keyframes cubeDotPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.6); }
    50%      { box-shadow: 0 0 0 6px rgba(0, 180, 216, 0); }
}

.cube-title {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(1.55rem, 2.6vw, 2.1rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin: 0;
    color: #14233a;
}
.cube-title em {
    font-style: normal;
    background: linear-gradient(135deg, #0077b6 0%, #00b4d8 55%, #5dd3e8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Accordéon ─────────────────────────────────────────────────────────── */
.cube-acc {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.cube-acc__item {
    position: relative;
    border-radius: 18px;
    transition: background 0.6s cubic-bezier(.22, 1, .32, 1),
                box-shadow 0.6s cubic-bezier(.22, 1, .32, 1),
                margin 0.6s cubic-bezier(.22, 1, .32, 1);
}
/* Filet fin entre les lignes repliées (façon référence) */
.cube-acc__item:not(.is-open)::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 1px;
    background: rgba(20, 35, 58, 0.12);
}
.cube-acc__item:last-child:not(.is-open)::after { display: none; }

/* Carte OUVERTE : teintée dans la couleur du service, relevée */
.cube-acc__item.is-open {
    margin: 8px 0;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent, #1488E6) 22%, #ffffff) 0%,
        color-mix(in srgb, var(--accent, #1488E6) 7%, #ffffff) 100%);
    box-shadow: 0 18px 44px -10px color-mix(in srgb, var(--accent, #1488E6) 30%, transparent),
                inset 0 0 0 1px color-mix(in srgb, var(--accent, #1488E6) 22%, transparent);
}

.cube-acc__head {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 14px;
    transition: padding 0.6s cubic-bezier(.22, 1, .32, 1);
}
.cube-acc__item.is-open .cube-acc__head { padding: 22px 24px 8px; }

/* Icône du service (lucide) — pastille teintée, devient pleine quand ouvert */
.cube-acc__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent, #1488E6) 14%, #ffffff);
    color: var(--accent, #1488E6);
    transition: background 0.4s ease, color 0.4s ease, transform 0.45s cubic-bezier(.16, 1, .3, 1), box-shadow 0.4s ease;
}
.cube-acc__item.is-open .cube-acc__icon {
    background: linear-gradient(140deg, color-mix(in srgb, var(--accent, #1488E6) 70%, #ffffff), var(--accent, #1488E6));
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--accent, #1488E6) 42%, transparent);
}
.cube-acc__icon svg { width: 21px; height: 21px; }

.cube-acc__title {
    flex: 1;
    min-width: 0;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: clamp(1.12rem, 1.7vw, 1.42rem);
    letter-spacing: -0.01em;
    color: #14233a;
    transition: color 0.4s ease;
}
.cube-acc__item.is-open .cube-acc__title { color: color-mix(in srgb, var(--accent, #1488E6) 70%, #0a1f33); }

/* Bouton « + » (lignes repliées) — disparaît quand l'item s'ouvre */
.cube-acc__plus {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(20, 35, 58, 0.22);
    color: #3f5a6e;
    transition: opacity 0.35s ease, transform 0.45s cubic-bezier(.16, 1, .3, 1), border-color 0.3s ease;
}
.cube-acc__plus svg { width: 16px; height: 16px; }
.cube-acc__item.is-open .cube-acc__plus { opacity: 0; transform: rotate(45deg) scale(0.5); }

/* Panneau dépliant : description + CTA.
   Technique grid 0fr → 1fr : anime vers la hauteur RÉELLE du contenu (pas de
   « zone morte » comme max-height) → ouverture/fermeture parfaitement fluides.
   Mêmes durées à l'ouverture et à la fermeture → la liste ne sautille pas quand
   un service se ferme pendant que le suivant s'ouvre. */
.cube-acc__panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.6s cubic-bezier(.22, 1, .32, 1),
                opacity 0.4s ease;
    will-change: grid-template-rows;
}
.cube-acc__item.is-open .cube-acc__panel {
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 0.6s cubic-bezier(.22, 1, .32, 1),
                opacity 0.55s ease 0.1s;
}
.cube-acc__inner { overflow: hidden; min-height: 0; padding: 0 24px 22px; }

.cube-acc__desc {
    margin: 0 0 16px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #3f5a6e;
}

.cube-acc__cta {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 0.84rem;
    letter-spacing: 0.02em;
    color: #14233a;
    text-decoration: none;
}
.cube-acc__cta-ic {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0e2a3f;
    color: #fff;
    transition: transform 0.3s ease, background 0.3s ease;
}
.cube-acc__cta-ic svg { width: 16px; height: 16px; }
.cube-acc__cta:hover .cube-acc__cta-ic {
    transform: translate(2px, -2px);
    background: var(--accent, #1488E6);
}

/* ── Écrans peu hauts : on compacte pour tout faire tenir ── */
@media (max-height: 760px) {
    .cube-stage { --col-h: clamp(380px, 76vh, 520px); }
    .cube-title { font-size: clamp(1.4rem, 2.3vw, 1.85rem); }
    .cube-acc__item.is-open .cube-acc__head { padding: 18px 22px 6px; }
    .cube-acc__head { padding: 14px 14px; }
    .cube-acc__desc { font-size: 0.9rem; margin-bottom: 13px; }
}
@media (max-height: 660px) {
    .cube-rail__head { margin-bottom: 12px; }
    .cube-acc__icon { width: 38px; height: 38px; }
    .cube-acc__title { font-size: 1.06rem; }
    .cube-acc__desc { font-size: 0.86rem; }
}

/* ── Responsive largeur ── */
@media (max-width: 900px) {
    .cube-stage {
        width: min(560px, 92vw);
        padding-top: clamp(78px, 12vh, 100px);
    }
    .cube-row { grid-template-columns: 1fr; }
    .cube-canvas {
        position: absolute;
        inset: 0;
        height: auto;
        z-index: 1;
        border-radius: 0;
        box-shadow: none;
        opacity: 0;
        transform: scale(1.02);
    }
    .cube-canvas::after { display: none; }
    .cube-section.cube-entered .cube-canvas { opacity: 0.32; transform: scale(1.04); }
    .cube-rail { max-width: none; z-index: 4; align-self: stretch; }
    /* Lisibilité au-dessus du cube : lignes repliées sur un voile blanc */
    .cube-acc__item:not(.is-open) { background: rgba(255, 255, 255, 0.6); border-radius: 14px; margin: 3px 0; }
    .cube-acc__item:not(.is-open)::after { display: none; }
}

@media (max-width: 768px) {
    .cube-acc__head { padding: 14px 14px; }
    .cube-acc__icon { width: 40px; height: 40px; }
    .cube-acc__title { font-size: 1.08rem; }
}

@media (prefers-reduced-motion: reduce) {
    .cube-eyebrow-dot { animation: none; }
    .cube-canvas { opacity: 1; transform: none; transition: none; }
    .cube-rail { opacity: 1; transform: none; transition: none; }
    .cube-acc__item,
    .cube-acc__head,
    .cube-acc__icon,
    .cube-acc__plus { transition: background 0.3s ease, color 0.3s ease; }
    .cube-acc__panel { transition: grid-template-rows 0.3s ease, opacity 0.3s ease; }
}
