/* ══════════════════════════════════════════
   NOTRE HISTOIRE — Animations & Effets
   ══════════════════════════════════════════ */

/* Curseur typewriter */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── Hero photo ── */
.hero-photo {
    position: relative;
    height: clamp(400px, 55vw, 745px);
    overflow: hidden;
}

@media (max-width: 768px) {
    #hero-title { white-space: normal !important; }
}

/* ── Fix : md:order-* manquants dans output.css ── */
@media (min-width: 768px) {
    .md\:order-1 { order: 1; }
    .md\:order-2 { order: 2; }
}

/* ── Scroll reveal (bidirectionnel) ── */
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
    will-change: opacity, transform;
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal        { opacity: 0; transform: translateY(44px); }
.reveal-left   { opacity: 0; transform: translateX(-56px); }
.reveal-right  { opacity: 0; transform: translateX(56px); }
.reveal-scale  { opacity: 0; transform: scale(0.92); }

.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible {
    opacity: 1;
    transform: none;
}

/* Cascade — delay uniquement à l'entrée */
.stagger-1.visible { transition-delay: 0.08s; }
.stagger-2.visible { transition-delay: 0.16s; }
.stagger-3.visible { transition-delay: 0.24s; }
.stagger-4.visible { transition-delay: 0.32s; }
.stagger-5.visible { transition-delay: 0.48s; }
/* Reset immédiat à la sortie */
.stagger-1:not(.visible),
.stagger-2:not(.visible),
.stagger-3:not(.visible),
.stagger-4:not(.visible),
.stagger-5:not(.visible) { transition-delay: 0s; }

/* ── Hero keyframes ── */
@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(36px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroLineGrow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}
@keyframes heroPulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}
@keyframes softFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10%  { transform: translate(-1%, -1%); }
    30%  { transform: translate(1%, 1%); }
    50%  { transform: translate(-1%, 0); }
    70%  { transform: translate(1%, -1%); }
    90%  { transform: translate(0, 1%); }
}

.hero-anim-1 { animation: heroFadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.15s both; }
.hero-anim-2 { animation: heroFadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.35s both; }
.hero-anim-3 { animation: heroFadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.55s both; }
.hero-anim-4 { animation: heroFadeUp 0.9s cubic-bezier(0.22,1,0.36,1) 0.75s both; }
.hero-line   { animation: heroLineGrow 0.7s cubic-bezier(0.22,1,0.36,1) 0.95s both; transform-origin: left; }
.hero-late   { animation: heroFadeUp 1s ease 1.2s both; }

/* ── Grain overlay ── */
.grain::after {
    content: '';
    position: absolute; inset: -50%;
    width: 200%; height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    opacity: 0.035;
    animation: grain 0.4s steps(1) infinite;
    pointer-events: none; z-index: 1;
}

/* ── Timeline ── */
.tl-spine {
    position: absolute; left: 50%; top: 0; bottom: 0;
    width: 0;
    border-left: 2px dashed var(--color-vert);
    transform: translateX(-50%);
    opacity: 0.55;
    mask-image: linear-gradient(180deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 6%, #000 94%, transparent 100%);
}

/* Traînée du chemin parcouru (plein, rouge) */
.tl-trail {
    position: absolute; left: 50%; top: 0;
    width: 2px;
    height: 0;
    background: linear-gradient(180deg, var(--color-rouge) 0%, var(--color-rouge-clair, var(--color-rouge)) 100%);
    transform: translateX(-50%);
    z-index: 1;
    border-radius: 2px;
    transition: height 0.15s linear;
    box-shadow: 0 0 8px rgba(198, 54, 40, 0.25);
}

/* Nœud coccinelle */
.tl-node {
    width: 26px; height: 26px;
    flex-shrink: 0;
    z-index: 2;
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}
.tl-node svg { width: 100%; height: 100%; display: block; }
.tl-node .cn-body { fill: var(--color-rouge); transition: fill 0.3s ease; }
.tl-node .cn-head { fill: #1a1a1a; }
.tl-node .cn-line,
.tl-node .cn-dot { fill: #1a1a1a; }
.tl-step:hover .tl-node { transform: scale(1.25) rotate(-8deg); }
.tl-step.in-view .tl-node .cn-body { fill: #e04a37; }

/* Coccinelle qui suit le scroll */
.tl-crawler {
    position: absolute;
    left: 50%;
    top: 0;
    width: 32px; height: 32px;
    transform: translate(-50%, 0) rotate(90deg);
    z-index: 3;
    pointer-events: none;
    transition: top 0.1s linear;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.18));
}
.tl-crawler svg { width: 100%; height: 100%; display: block; }
.tl-crawler .cn-body { fill: var(--color-rouge); }
.tl-crawler .cn-head,
.tl-crawler .cn-line,
.tl-crawler .cn-dot { fill: #1a1a1a; }

@keyframes crawlWiggle {
    0%, 100% { transform: translate(-50%, 0) rotate(90deg); }
    50%      { transform: translate(-50%, 0) rotate(95deg); }
}
.tl-crawler.is-moving { animation: crawlWiggle 0.35s ease-in-out infinite; }
.tl-year {
    font-family: var(--font-serif);
    font-size: clamp(3rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    color: var(--color-vert);
    opacity: 0.12;
    transition: opacity 0.3s ease;
}
.tl-step:hover .tl-year { opacity: 0.25; }

/* ── Valeur card ── */
.val-card {
    position: relative; overflow: hidden;
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1), box-shadow 0.45s ease;
}

.val-card:hover,
.val-card.visible:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px -14px rgba(26,26,26,0.18);
}

/* Image uniforme en bas de chaque carte cause */
.val-card-img {
    height: 220px;
    width: 100%;
    object-fit: cover;
    object-position: center 30%;
    display: block;
    transition: transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
@media (max-width: 767px) {
    .val-card-img { height: 260px; object-position: center 25%; }
}

/* Logo Guirec — teinte verte propre, taille contenue */
.val-logo-guirec {
    max-height: 5rem;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(38%) sepia(67%) saturate(420%) hue-rotate(74deg) brightness(92%) contrast(88%);
}

.val-num {
    font-family: var(--font-serif);
    font-size: clamp(5rem, 8vw, 7rem);
    font-weight: 700; line-height: 1;
    -webkit-text-stroke: 1.5px var(--color-gris-clair);
    color: transparent;
    position: absolute; top: -8px; right: 14px;
    pointer-events: none;
    transition: -webkit-text-stroke-color 0.4s ease, opacity 0.4s ease;
    opacity: 0.6;
}
.val-card:hover .val-num {
    -webkit-text-stroke-color: var(--color-vert);
    opacity: 0.2;
}

/* ── Scroll indicator ── */
.scroll-hint { animation: softFloat 2.8s ease-in-out infinite; }

/* ── Équipe card ── */
.team-card { transition: transform 0.4s cubic-bezier(0.22,1,0.36,1); }
.team-card:hover { transform: translateY(-5px); }
.team-tag {
    transition: background 0.3s ease, color 0.3s ease;
}
.team-card:hover .team-tag {
    background: var(--color-vert) !important;
    color: #fff !important;
}

/* ── Pull-quote bar ── */
.pull-bar {
    position: relative; padding-left: 1.75rem;
}
.pull-bar::before {
    content: ''; position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: linear-gradient(180deg, var(--color-vert), var(--color-rouge));
    border-radius: 3px;
}

/* ── Ornament ── */
.orn { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; }
.orn .dash { width: 32px; height: 1px; background: var(--color-vert); flex-shrink: 0; }


/* ── Timeline : espacement texte/image ── */
@media (min-width: 768px) {
    .tl-step { column-gap: 5rem; }
    .tl-step .md\:pr-12 { padding-right: 3rem; }
    .tl-step .md\:pl-12 { padding-left: 3rem; }
    .tl-step .photo-frame { max-width: 460px; }
    .tl-step .reveal-right.md\:pl-12 .photo-frame { margin-right: auto; }
    .tl-step .reveal-right.md\:order-1 .photo-frame { margin-left: auto; }
}
.tl-step { margin-bottom: 4rem !important; }

@media (max-width: 767px) {
    .tl-step { margin-bottom: 2.5rem !important; }
}

/* ── Photo overlay shimmer ── */
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.photo-frame {
    position: relative; overflow: hidden;
}
.photo-frame::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.06) 50%, transparent 60%);
    transform: translateX(-100%);
}
.photo-frame:hover::after {
    animation: shimmer 0.8s ease forwards;
}

/* ── Mécénat du patrimoine : plaque 3D ── */
.plaque-3d {
    position: relative;
    width: 100%;
    height: clamp(400px, 52vw, 640px);
    background: transparent;
}
.plaque-3d model-viewer {
    width: 100%;
    height: 100%;
    --poster-color: transparent;
    background-color: transparent;
}
.plaque-3d-poster {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 1.5rem;
    font-family: var(--font-serif);
    color: var(--color-charcoal-light);
    font-size: 1.1rem;
}

/* ── Compteur dons de fleurs + pétales ── */
.don-compteur {
    position: relative;
    display: inline-block;
}
#don-counter {
    position: relative;
    z-index: 1;
    display: inline-block;
}
.petals {
    position: absolute;
    top: -28px; left: -10px; right: -10px;
    height: 220px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.petal {
    position: absolute;
    top: -24px;
    width: 12px; height: 12px;
    border-radius: 0 100% 0 100%;
    background: linear-gradient(135deg, #f7b8c4 0%, #e98aa0 100%);
    opacity: 0;
    transform: scale(var(--scale, 1));
    animation-name: petalFall;
    animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
    animation-iteration-count: 1;
    animation-fill-mode: forwards;
    will-change: transform, opacity;
}
.petal-alt {
    background: linear-gradient(135deg, #f6c7a8 0%, #e89a6a 100%);
    border-radius: 100% 0 100% 0;
}
@keyframes petalFall {
    0%   { transform: translateY(-24px) translateX(0) rotate(0deg) scale(var(--scale, 1)); opacity: 0; }
    12%  { opacity: 0.95; }
    85%  { opacity: 0.85; }
    100% { transform: translateY(210px) translateX(var(--drift, 0)) rotate(340deg) scale(var(--scale, 1)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .petal { display: none; }
}
