/* ══════════════════════════════════════════════════════════
   NOTRE HISTOIRE — récit animé
   - un « fil » vertical aux couleurs du logo se remplit
     au fil de la lecture (progression posée par enhance.js) ;
   - chaque paragraphe apparaît à son tour ;
   - les 4 piliers sont soulignés dans leur couleur ;
   - les phrases clés sont surlignées comme au marqueur.
   La typographie de la page n'est pas modifiée.
   ══════════════════════════════════════════════════════════ */

.histoire-card.story {
  --story-pad: 4.5rem; /* marge gauche réservée au fil */
  --thread-x: 1.9rem; /* axe du fil */
  --dot: 16px;
  --thread-top: 2.5rem; /* posés par enhance.js : du 1er au dernier point */
  --thread-height: calc(100% - 5rem);
  --fill: 0px; /* longueur lue, posée par enhance.js */
  --head-color: var(--turquoise);
  position: relative;
  padding-left: var(--story-pad);
}

/* ── Fil de lecture (injecté par enhance.js) ───
   Les couleurs restent fixes sur toute la hauteur et sont
   dévoilées par le haut : chaque teinte garde sa place. */
.story-thread {
  position: absolute;
  top: var(--thread-top);
  left: var(--thread-x);
  width: 4px;
  height: var(--thread-height);
  margin-left: -2px;
  border-radius: 4px;
  background: var(--bordure);
  pointer-events: none;
}
.story-thread-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    to bottom,
    var(--turquoise),
    var(--vert) 25%,
    var(--jaune) 50%,
    var(--bordeaux) 75%,
    var(--violet)
  );
  clip-path: inset(0 0 calc(100% - var(--fill)) 0 round 4px);
}
/* Halo diffus sous le trait coloré */
.story-thread-fill::after {
  content: "";
  position: absolute;
  inset: 0 -4px;
  background: inherit;
  filter: blur(8px);
  opacity: 0.35;
}
/* Tête lumineuse : la position de lecture */
.story-thread-head {
  position: absolute;
  z-index: 2;
  top: var(--fill);
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 3px var(--head-color),
    0 0 18px 4px color-mix(in srgb, var(--head-color) 55%, transparent);
  opacity: 0;
  transition:
    opacity 0.3s,
    box-shadow 0.4s;
}
.story-thread.is-started .story-thread-head {
  opacity: 1;
}
.story-thread.is-finished .story-thread-head,
.story-thread.is-near-dot .story-thread-head {
  opacity: 0;
}

/* ── Pastilles : une par paragraphe ──────────
   Couleur = teinte du fil à cet endroit (--dot-color, posée par JS).
   À lire : anneau vide · lue : pleine · en cours : halo qui pulse. */
.story > p {
  position: relative;
}
.story > p::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0.5em;
  left: calc(var(--thread-x) - var(--story-pad) - var(--dot) / 2);
  width: var(--dot);
  height: var(--dot);
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2.5px solid var(--bordure);
  transition:
    background 0.35s,
    border-color 0.35s,
    box-shadow 0.4s,
    transform 0.45s var(--ease-spring, ease);
}
.story > p.is-read::before {
  background: var(--dot-color, var(--jaune));
  border-color: var(--dot-color, var(--jaune));
}
.story > p.is-current::before {
  background: var(--card-bg);
  border-width: 4px;
  transform: scale(1.2);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--dot-color, var(--jaune)) 22%, transparent);
  animation: story-dot-pulse 2s ease-in-out infinite;
}
@keyframes story-dot-pulse {
  50% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--dot-color, var(--jaune)) 8%, transparent);
  }
}
/* Sans JS : pas de fil, donc pas de pastilles */
html:not(.js) .story > p::before {
  display: none;
}

/* Les paragraphes apparaissent un par un, sans décalage cumulé */
.js .story > p.reveal {
  --reveal-index: 0 !important;
}

/* ── Les 4 piliers soulignés dans leur couleur ── */
.story .pillar {
  background: linear-gradient(var(--pillar), var(--pillar)) left bottom / 0% 3px no-repeat;
  padding-bottom: 2px;
  transition: background-size 0.9s var(--ease-out, ease);
}
.story .pillar:nth-of-type(2) { transition-delay: 0.15s; }
.story .pillar:nth-of-type(3) { transition-delay: 0.3s; }
.story .pillar:nth-of-type(4) { transition-delay: 0.45s; }
.js .story p.is-visible .pillar,
html:not(.js) .story .pillar {
  background-size: 100% 3px;
}

/* ── Phrases clés : surlignage au marqueur ── */
.story-key {
  color: var(--texte) !important;
}
.story-mark {
  background: linear-gradient(100deg, rgba(230, 176, 32, 0.34), rgba(230, 176, 32, 0.2))
    left 75% / 0% 45% no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 1s 0.3s var(--ease-out, ease);
}
.js .story-key.is-visible .story-mark,
html:not(.js) .story-mark {
  background-size: 100% 45%;
}

/* Dernière phrase : « ensemble » aux couleurs du logo */
.story-together {
  background: linear-gradient(
    90deg,
    var(--turquoise),
    var(--vert),
    var(--jaune),
    var(--bordeaux),
    var(--violet)
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: story-together 6s linear infinite;
}
@keyframes story-together {
  to {
    background-position: 200% 0;
  }
}

/* ── Téléphone ─────────────────────────────── */
@media (max-width: 600px) {
  .histoire-card.story {
    --story-pad: 2.75rem;
    --thread-x: 1.1rem;
    --dot: 14px;
    padding: 1.75rem 1.25rem 1.75rem var(--story-pad);
  }
}

@media (prefers-reduced-motion: reduce) {
  .story > p.is-current::before {
    animation: none;
  }
  .story-together {
    animation: none;
  }
}

/* ══════════════════════════════════════════════════════════
   EN-TÊTE « HERO 07 » — Notre histoire
   Image panoramique pleine largeur (fondu en bas), puis grille :
   phrase d'accroche à gauche ; titre serif, texte et boutons à droite.
   Sans photo : visuel aux couleurs du logo. Avec img/histoire.jpg :
   la photo s'affiche automatiquement par-dessus.
   ══════════════════════════════════════════════════════════ */

.h07 {
  position: relative;
  isolation: isolate;
}

/* ── Image panoramique ── */
.h07-media {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 4;
  max-height: 72vh;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 96%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 96%);
  animation: h07-media-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* voile léger (comme le composant) + lisibilité du menu en haut */
.h07-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--bg) 55%, transparent) 0%, transparent 22%),
    color-mix(in srgb, var(--bg) 15%, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
body.dark .h07-media::after {
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--bg) 70%, transparent) 0%, transparent 25%),
    color-mix(in srgb, var(--bg) 30%, transparent);
}

/* Vraie photo (apparaît seule si img/histoire.jpg existe) */
.h07-photo {
  position: absolute;
  inset: 0;
  z-index: 2;
  /* cadrage sur la kakémono, la banderole et la table du stand */
  background: url("../img/histoire.jpg") center 42% / cover no-repeat;
  transform-origin: 38% 55%;
  animation: h07-kenburns 22s ease-in-out infinite alternate;
}
@keyframes h07-kenburns {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.09) translate3d(-1%, -1%, 0);
  }
}
body.dark .h07-photo {
  filter: brightness(0.97) saturate(0.92);
}

/* Visuel aux couleurs du logo : gouttes floutées + emblème */
.h07-art {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 120%, color-mix(in srgb, var(--violet) 18%, transparent), transparent 60%),
    var(--bg-alt);
}
.h07-art::after {
  /* grain */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}
.h07-drop {
  position: absolute;
  border-radius: 62% 38% 55% 45% / 55% 45% 55% 45%;
  filter: blur(42px);
  opacity: 0.75;
  animation: h07-float 14s ease-in-out infinite alternate;
}
.h07-drop-1 { width: 34%; height: 70%; left: 6%; top: -12%; background: var(--turquoise); }
.h07-drop-2 { width: 20%; height: 42%; left: 2%; top: 46%; background: var(--vert); animation-delay: -3s; }
.h07-drop-3 { width: 26%; height: 52%; left: 37%; top: 22%; background: var(--jaune); opacity: 0.55; animation-delay: -6s; }
.h07-drop-4 { width: 18%; height: 40%; right: 18%; top: 4%; background: var(--bordeaux); opacity: 0.6; animation-delay: -9s; }
.h07-drop-5 { width: 36%; height: 72%; right: -4%; top: 34%; background: var(--violet); animation-delay: -12s; }
@keyframes h07-float {
  to {
    transform: translate(4%, 6%) rotate(8deg) scale(1.08);
  }
}
/* Emblème : le logo sur un disque clair (lisible dans les deux thèmes) */
.h07-logo {
  position: absolute;
  left: 50%;
  top: 48%;
  width: clamp(84px, 13%, 168px);
  height: auto;
  padding: clamp(14px, 2.2%, 26px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.35), 0 0 0 10px rgba(255, 255, 255, 0.25);
  transform: translate(-50%, -50%);
  animation: h07-logo-in 1s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── Texte en grille ── */
.h07-copy {
  display: grid;
  gap: 2.5rem;
  max-width: 80rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 2rem;
}
@media (min-width: 1024px) {
  .h07-copy {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    padding: 3rem 2rem 2.5rem;
  }
  .h07-tagline {
    grid-column: 1 / span 4;
  }
  .h07-main {
    grid-column: 7 / span 6;
  }
}
.h07-tagline {
  max-width: 20rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: -0.01em;
  color: var(--texte-soft);
  text-wrap: balance;
}
.h07-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}
.h07-main .section-tag {
  margin: 0 0 -0.5rem;
}
.h07-title {
  margin: 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 6vw, 4.25rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.015em;
  color: var(--texte);
  text-wrap: balance;
}
.h07-desc {
  max-width: 36rem;
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--texte-soft);
  text-wrap: balance;
}
.h07-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.h07-btn {
  padding: 0.75rem 1.25rem;
  border-radius: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.h07-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--texte);
  text-decoration: none;
  text-underline-offset: 5px;
}
.h07-link::after {
  content: " ↓";
  display: inline-block;
  transition: transform var(--dur, 320ms) var(--ease-out, ease);
}
.h07-link:hover {
  text-decoration: underline;
}
.h07-link:hover::after {
  transform: translateY(3px);
}

/* Le récit commence juste sous l'en-tête */
#recit {
  padding-top: 0;
}

/* ── Apparition : flou → net, en cascade (comme le composant) ── */
.h07-tagline,
.h07-main > * {
  animation: h07-item-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.h07-tagline { animation-delay: 0.25s; }
.h07-main > :nth-child(1) { animation-delay: 0.3s; }
.h07-main > :nth-child(2) { animation-delay: 0.38s; }
.h07-main > :nth-child(3) { animation-delay: 0.46s; }
.h07-main > :nth-child(4) { animation-delay: 0.54s; }
@keyframes h07-item-in {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(6px);
  }
}
@keyframes h07-media-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
    filter: blur(8px);
  }
}
@keyframes h07-logo-in {
  from {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.85);
  }
}

@media (max-width: 640px) {
  .h07-media {
    aspect-ratio: 4 / 3;
  }
  .h07-copy {
    gap: 1.25rem;
    padding-top: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .h07-media,
  .h07-photo,
  .h07-logo,
  .h07-drop,
  .h07-tagline,
  .h07-main > * {
    animation: none;
  }
}

/* Carte du récit : sans bordure (l'ombre légère suffit à la détacher) */
.histoire-card.story {
  border: none;
}
