/* ==========================================================================
   pAIsteque : la scène
   Fond rose vivant (pépins sur canvas), chapitres en cartes 3D qui arrivent
   par la droite au défilement, navigation par chapitres.
   Deux modes :
   - html.immersive : scène fixe, défilement vertical converti en coverflow
   - sinon (mobile, écran bas, mouvement réduit) : chapitres empilés
   ========================================================================== */

@property --bg-a { syntax: '<color>'; inherits: true; initial-value: #FF9A76; }
@property --bg-b { syntax: '<color>'; inherits: true; initial-value: #C9B6F2; }

:root {
  --header-h: 80px;
  --bg-a: #FF9A76;
  --bg-b: #C9B6F2;
}

html { scroll-snap-type: y proximity; }
html:not(.immersive) { scroll-snap-type: none; }

body {
  background: var(--pink);
}

/* ----- en-tête fixé --------------------------------------------------- */
.site-header { position: fixed; top: 0; left: 0; right: 0; }
.site-header.is-scrolled { box-shadow: 0 6px 0 rgba(58, 46, 57, .12); }

/* ----- fond : canvas de pépins + dégradés de chapitre ------------------- */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  width: 100%; height: 100%;
}
.bg-tint {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 70% at 18% 12%, var(--bg-a) 0%, transparent 70%),
    radial-gradient(55% 65% at 85% 88%, var(--bg-b) 0%, transparent 70%),
    var(--pink);
  transition: --bg-a 1.1s ease, --bg-b 1.1s ease;
}

/* ----- piste et scène ---------------------------------------------------- */
.stage-track { position: relative; z-index: 1; }
.snaps { position: relative; }
.snaps { pointer-events: none; }
.snap { height: 100vh; scroll-snap-align: start; }

.stage {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  margin-bottom: -100vh;
}
.deck {
  position: absolute; inset: 0;
  perspective: 1700px; perspective-origin: 50% 45%;
}

/* ----- chapitres --------------------------------------------------------- */
.chapter {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--header-h) + 18px) clamp(14px, 3vw, 40px) 70px;
  will-change: transform, opacity;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.chapter:not(.is-near) { pointer-events: none; }

.chapter__card {
  position: relative; width: min(1180px, 100%);
  max-height: calc(100vh - var(--header-h) - 88px);
  overflow: auto; overscroll-behavior: auto;
  background: var(--paper); border: var(--stroke); border-radius: 34px;
  box-shadow: 12px 12px 0 var(--ink);
  padding: clamp(22px, 3vw, 36px) clamp(20px, 3.4vw, 44px);
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
}
.chapter__card--blue { background: var(--blue-pale); }
.chapter__card--green { background: var(--green-pale); }
.chapter__card--pink { background: var(--pink-pale); }

.chapter__card .container { padding: 0; max-width: none; }
.chapter__card .section { padding: 0; background: transparent; }
/* le corps de la carte est réduit (zoom) par stage.js quand il dépasse la hauteur disponible */
.chapter__body { zoom: var(--fit, 1); }

/* contenu plus dense à l'intérieur des cartes : tout doit tenir dans un écran
   (cible : 1280 x 800 sans réduction, ou presque) */

/* en-tête sur une ligne : titre à gauche, accroche à droite ; le badge est
   remplacé par le numéro de chapitre */
html.immersive .chapter__card .section-head {
  flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  text-align: left; max-width: none; margin: 0 0 0 64px; gap: 8px 32px;
}
html.immersive .chapter__card .section-head .badge { display: none; }
html.immersive .chapter__card .section-title { font-size: clamp(26px, 2.8vw, 38px); line-height: 1.06; }
html.immersive .chapter__card .section-lead { font-size: 15.5px; line-height: 1.45; }
html.immersive .chapter__card .section-head > .section-title { flex: 1 1 380px; }
html.immersive .chapter__card .section-head > .section-lead { flex: 1 1 340px; max-width: 520px; }

/* cockpits */
html.immersive .chapter__card .tabs { margin-top: 16px; }
html.immersive .chapter__card .tablist { justify-content: flex-start; gap: 10px; }
html.immersive .chapter__card .tab { min-height: 44px; padding: 0 16px; font-size: 14.5px; }
html.immersive .chapter__card .panel.is-active { margin-top: 14px; gap: 26px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
html.immersive .chapter__card .panel__copy { gap: 9px; }
html.immersive .chapter__card .panel__title { font-size: clamp(20px, 2.1vw, 26px); }
html.immersive .chapter__card .panel__lead { font-size: 14.5px; line-height: 1.45; }
html.immersive .chapter__card .agents { gap: 6px; }
html.immersive .chapter__card .agents li { padding: 5px 10px; font-size: 13.5px; border-radius: 12px; box-shadow: 2px 2px 0 var(--ink); gap: 9px; }
html.immersive .chapter__card .agents__ic { width: 28px; height: 28px; border-radius: 9px; }
html.immersive .chapter__card .agents__ic svg { width: 15px; height: 15px; }
html.immersive .chapter__card .agents__tag { font-size: 11px; }
html.immersive .chapter__card .panel .link-arrow { font-size: 15px; min-height: 34px; }
html.immersive .chapter__card .cockpit { font-size: 12px; }
html.immersive .chapter__card .cockpit__body { padding: 10px; gap: 10px; }
html.immersive .chapter__card .kpi { padding: 8px 10px; }
html.immersive .chapter__card .kpi__value { font-size: 18px; }
html.immersive .chapter__card .bars { height: 62px; }
html.immersive .chapter__card .feed li { font-size: 11.5px; }
html.immersive .chapter__card .cockpit__title { font-size: 14px; }
html.immersive .chapter__card .container > p.reveal { margin-top: 10px !important; font-size: 12px !important; }

/* méthode */
html.immersive .chapter__card .steps { margin-top: 22px; gap: 18px; }
html.immersive .chapter__card .steps__line { top: 44px; }
html.immersive .chapter__card .step { padding: 18px 18px 16px; gap: 8px; }
html.immersive .chapter__card .step__num { width: 44px; height: 44px; font-size: 20px; }
html.immersive .chapter__card .step__ico { width: 44px; height: 44px; top: 16px; right: 16px; }
html.immersive .chapter__card .step h3 { font-size: 22px; }
html.immersive .chapter__card .step p { font-size: 14.5px; line-height: 1.45; }
html.immersive .chapter__card .step ul { gap: 5px; }
html.immersive .chapter__card .step li { font-size: 13.5px; line-height: 1.35; }
html.immersive .chapter__card .step .chip { font-size: 12px; padding: 4px 10px; }
html.immersive .chapter__card .method-note { display: none; }

/* en pratique */
html.immersive .chapter__card .pratique { gap: 36px; }
html.immersive .chapter__card .pratique .section-head { margin-left: 0; }
html.immersive .chapter__card .pratique__copy { gap: 12px; }
html.immersive .chapter__card .pratique__copy .section-title { font-size: clamp(26px, 2.6vw, 36px); }
html.immersive .chapter__card .points { gap: 10px; }
html.immersive .chapter__card .points li { font-size: 15px; line-height: 1.45; }
html.immersive .chapter__card .pratique__copy .badge { display: inline-flex; }

/* tarifs */
html.immersive .chapter__card .pricing { margin-top: 16px; gap: 18px; }
html.immersive .chapter__card .price-card { gap: 12px; padding: clamp(20px, 2.4vw, 28px); }
html.immersive .chapter__card .price-card h3 { font-size: 24px; }
html.immersive .chapter__card .price-card__sub { font-size: 14.5px; }
html.immersive .chapter__card .price__amount { font-size: clamp(44px, 5vw, 60px); }
html.immersive .chapter__card .price__unit { font-size: 15px; }
html.immersive .chapter__card .includes { gap: 6px 14px; }
html.immersive .chapter__card .includes li { font-size: 14.5px; line-height: 1.3; }
html.immersive .chapter__card .includes li small { font-size: 12.5px; }
html.immersive .chapter__card .price-card .btn { min-height: 46px; font-size: 15px; }
html.immersive .chapter__card .no-hidden { gap: 10px; padding: clamp(20px, 2.4vw, 28px); }
html.immersive .chapter__card .no-hidden h3 { font-size: 22px; }
html.immersive .chapter__card .no-hidden p { font-size: 14.5px; line-height: 1.45; }
html.immersive .chapter__card .strikes { gap: 7px; }
html.immersive .chapter__card .strikes li { padding: 7px 10px; font-size: 14px; }
html.immersive .chapter__card .no-hidden__foot { padding: 10px 12px; font-size: 14px; }
html.immersive .chapter__card .price-row { gap: 10px 14px; }
html.immersive .chapter__card .forfait { padding: 8px 12px 8px 26px; }
html.immersive .chapter__card .forfait strong { font-size: 17px; }
html.immersive .chapter__card .forfait span { font-size: 12.5px; }
html.immersive .chapter__card .pricing__side { gap: 14px; }
/* la carte tarif doit tenir dans l'écran : détails secondaires réservés au mobile */
html.immersive .chapter__card .price-card__sub { display: none; }
html.immersive .chapter__card .includes li small { display: none; }
html.immersive .chapter__card .includes li.keep small { display: block; }
html.immersive .chapter__card .price__amount { font-size: clamp(42px, 4.6vw, 54px); }
html.immersive .chapter__card .pricing-note { margin-top: 10px; font-size: 12.5px; }

/* vidéos explicatives */
html.immersive .chapter__card .videos { margin: 16px auto 0; max-width: 720px; gap: 18px; }
html.immersive .chapter__card .vcard { gap: 8px; }
html.immersive .chapter__card .vcard figcaption strong { font-size: 14px; }
html.immersive .chapter__card .vcard figcaption span { font-size: 12.5px; }
html.immersive .chapter__card .vcard__avatar { width: 38px; height: 38px; font-size: 13px; }

/* faq */
html.immersive .chapter__card .faq { gap: 32px; }
html.immersive .chapter__card .faq .section-head { margin-left: 0; }
html.immersive .chapter__card .faq__intro .badge { display: inline-flex; }
html.immersive .chapter__card .faq__list { gap: 9px; }
html.immersive .chapter__card details { padding: 0 16px; }
html.immersive .chapter__card summary { min-height: 50px; font-size: 16px; }
html.immersive .chapter__card details p { font-size: 15px; margin-bottom: 14px; }
html.immersive .chapter__card .faq__bot { margin-top: 4px; }

/* numéro de chapitre, en haut à gauche de la carte */
.chapter__num {
  position: absolute; top: 18px; left: 18px; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 46px; padding: 0 12px;
  background: var(--yellow); border: var(--stroke); border-radius: 999px; box-shadow: var(--shadow-s);
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
}

/* --- chapitre d'accueil : pas de carte, directement sur le fond --- */
.chapter--hero { padding-bottom: 118px; align-items: center; }
.chapter--hero .hero__copy { gap: clamp(12px, 2vh, 22px); }
.chapter--hero .hero__title { font-size: clamp(30px, min(4.2vw, 6.4vh), 56px); }
.chapter--hero .hero__lead { font-size: clamp(15px, min(1.4vw, 2.3vh), 19px); max-width: 540px; }
.chapter--hero .hero__trust { font-size: 14px; }
.chapter--hero .hero__visual { padding: 0; }
.chapter--hero .hero__disc { width: min(420px, 100%, 52vh); }
.chapter--hero .toast { padding: 7px 12px 7px 7px; }
.chapter--hero .toast__text strong { font-size: 14px; }
.chapter--hero .hero {
  background: none; overflow: visible; width: min(1200px, 100%);
  zoom: var(--fit, 1);
}
.chapter--hero .hero__inner { min-height: 0; padding: 0; gap: 36px; }
.chapter--hero .hero__lead { color: var(--ink); font-weight: 600; }
.chapter--hero .hero__trust li { background: rgba(255, 255, 255, .55); padding: 4px 12px; border-radius: 999px; }
.chapter--hero .outline-word { color: var(--paper); }
.chapter--hero .hero__disc { box-shadow: 12px 12px 0 var(--ink); }

.chapter__tools {
  position: absolute; left: 0; right: 0; bottom: 18px;
}
.chapter__tools .tools { background: transparent; border: 0; padding: 0; }
.chapter__tools .tools__label { color: var(--ink); opacity: .85; }
.chapter__tools .marquee__track li { background: rgba(255, 255, 255, .92); }

/* invitation à défiler */
.scroll-hint {
  position: absolute; right: clamp(16px, 4vw, 48px); bottom: 92px;
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 900; font-size: 14px; letter-spacing: .04em; text-transform: uppercase;
}
.scroll-hint i {
  width: 38px; height: 38px; border-radius: 50%; background: var(--paper); border: var(--stroke);
  box-shadow: var(--shadow-s); display: flex; align-items: center; justify-content: center;
  animation: hint-bounce 1.6s ease-in-out infinite;
}
@keyframes hint-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* --- chapitre démo : la carte blanche existante devient la carte du chapitre --- */
.chapter--demo .chapter__card { background: transparent; border: 0; box-shadow: none; padding: 0; overflow: visible; max-height: none; width: min(820px, 100%); }
.chapter--demo .cta__card { margin-top: 120px; }
.chapter--demo .chapter__num { display: none; }

/* ----- contenu : apparition en cascade quand le chapitre devient actif ----- */
html.immersive .chapter .reveal { transition-delay: calc(var(--delay, 0ms) + 120ms); }

/* ----- navigation par chapitres (à droite) ------------------------------ */
.chapter-nav {
  position: fixed; right: clamp(10px, 1.6vw, 24px); top: 50%; z-index: 20;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.chapter-nav a {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 4px; border-radius: 999px; color: var(--ink);
}
.chapter-nav i {
  width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, .7);
  border: 2px solid var(--ink); transition: transform .25s var(--ease-pop), background .2s ease;
}
.chapter-nav span {
  font-weight: 900; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase;
  background: var(--paper); border: var(--stroke-thin); border-radius: 999px; padding: 3px 10px;
  opacity: 0; transform: translateX(8px); transition: opacity .2s ease, transform .25s var(--ease-pop);
  white-space: nowrap; box-shadow: var(--shadow-s);
}
.chapter-nav a:hover span, .chapter-nav a:focus-visible span, .chapter-nav a.is-active span { opacity: 1; transform: none; }
.chapter-nav a.is-active i { background: var(--yellow); transform: scale(1.35); }
.chapter-nav a { flex-direction: row-reverse; }

/* barre de progression en bas */
.stage-progress {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 8px;
  background: rgba(58, 46, 57, .18);
}
.stage-progress i {
  display: block; height: 100%; width: 0; background: var(--ink);
  transform-origin: left; transition: width .15s linear;
}

/* ----- pied de page après la scène ------------------------------------- */
.footer { position: relative; z-index: 2; }
.stripe { position: relative; z-index: 2; }

/* ==========================================================================
   Mode empilé (mobile, écran bas, mouvement réduit)
   ========================================================================== */
html:not(.immersive) .snaps { display: none; }
html:not(.immersive) .chapter__body, html:not(.immersive) .chapter--hero .hero { zoom: 1; }
html:not(.immersive) .stage { position: static; height: auto; overflow: visible; margin: 0; }
html:not(.immersive) .deck { position: static; perspective: none; }
html:not(.immersive) .chapter {
  position: relative; inset: auto; display: block;
  padding: 28px clamp(14px, 3vw, 40px); will-change: auto; pointer-events: auto;
  scroll-margin-top: calc(var(--header-h) + 8px);
}
html:not(.immersive) .chapter:first-child { padding-top: calc(var(--header-h) + 28px); }
html:not(.immersive) .chapter__card {
  max-height: none; overflow: visible; margin: 0 auto;
  opacity: 0; transform: perspective(1200px) translateX(70px) rotateY(-16deg);
  transition: opacity .7s ease, transform .8s var(--ease-pop);
}
html:not(.immersive) .chapter__card.is-in { opacity: 1; transform: none; }
html:not(.immersive) .chapter--hero { padding-bottom: 28px; }
html:not(.immersive) .chapter__tools { position: static; margin-top: 28px; }
html:not(.immersive) .scroll-hint, html:not(.immersive) .chapter-nav, html:not(.immersive) .stage-progress { display: none; }
html:not(.immersive) .chapter--demo .cta__card { margin-top: 150px; }

/* numéro de chapitre dans le flux : plus rien n'est recouvert, une seule marge gauche */
html:not(.immersive) .chapter__num {
  position: static; width: fit-content; margin: 0 auto 14px; box-shadow: var(--shadow-s);
}
html:not(.immersive) #pratique .chapter__num,
html:not(.immersive) #faq .chapter__num { margin-left: 0; }
html:not(.immersive) .chapter__card { padding: 24px clamp(18px, 4vw, 40px) 28px; }
html:not(.immersive) .section-head { gap: 12px; }
html:not(.immersive) .tabs { margin-top: 28px; }
html:not(.immersive) .panel.is-active { margin-top: 24px; }
html:not(.immersive) .steps { margin-top: 36px; }
html:not(.immersive) .pricing, html:not(.immersive) .videos { margin-top: 32px; }
html:not(.immersive) .method-note { margin-top: 28px; }

@media (max-width: 600px) {
  /* accueil */
  .hero .spark { display: none; }
  .chapter--hero .hero__title, .hero__title { font-size: clamp(30px, 8.6vw, 40px); }
  .badge .badge__long { display: none; }
  .badge .badge__short { display: inline; }
  .chapter--hero .hero__trust li { font-size: 13.5px; }
  .toast { max-width: 64%; }
  /* démo : la mascotte ne recouvre plus le titre */
  .cta__bot { width: 160px; top: -112px; }
  html:not(.immersive) .chapter--demo .cta__card { margin-top: 120px; padding-top: 68px; }
  /* tarifs : le ruban devient une pastille au-dessus du titre */
  .price-card__ribbon {
    position: static; transform: none; align-self: flex-start; width: fit-content;
    padding: 4px 12px; border: var(--stroke-thin); border-radius: 999px; margin-bottom: 2px;
  }
  .price-card { overflow: visible; }
  /* mini-cockpit : trois indicateurs serrés mais lisibles, le reste en une colonne */
  .kpis { gap: 6px; }
  .kpi { padding: 8px 8px; gap: 1px; }
  .kpi__label { font-size: 9.5px; letter-spacing: 0; }
  .kpi__value { font-size: 17px; }
  .kpi__delta { font-size: 10px; }
  .cockpit__title { font-size: 13px; }
  .cockpit__live { font-size: 10px; padding: 3px 8px; }
  .agents li { font-size: 14.5px; gap: 10px; padding: 9px 12px; }
  .agents__tag { display: none; }
  .tab { min-height: 46px; padding: 0 14px; font-size: 14.5px; }
  .tablist { gap: 8px; }
  .step__ico { width: 44px; height: 44px; top: 18px; right: 18px; }
  .sticker { right: 4px; font-size: 12.5px; padding: 8px 12px; }
  .fallback__tag { font-size: 11px; padding: 5px 10px; }
}
@media (min-width: 601px) {
  .badge .badge__short { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html:not(.immersive) .chapter__card { opacity: 1; transform: none; }
  .scroll-hint i { animation: none; }
}
