/* ─── Pourquoi Axydiag : film « un seul interlocuteur » + liste compacte ─── */
.axd-why {
  --axd-gold-ink: #9c7a33;
  --axd-stage: #fbfaf6;
  --axd-out: cubic-bezier(.2, .8, .2, 1);
  --axd-io: cubic-bezier(.6, 0, .2, 1);
  --axd-pop: cubic-bezier(.3, 1.6, .5, 1);
}
.axd-why-ico { display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Lignes de texte qui montent (titre et phrases du film) */
.axd-why-ln { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.axd-why-ln > span { display: block; }
.axd-why-acc { color: var(--axd-gold-ink); }

/* Scène animée */
.axd-why-stage { position: relative; overflow: hidden; isolation: isolate; margin-top: 2.25rem; height: clamp(400px, 40vw, 420px); border-radius: 1.4rem; border: 1px solid var(--line-soft); background: var(--axd-stage); }
.axd-why-stage::before, .axd-why-stage::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; filter: blur(54px); }
.axd-why-stage::before { width: 46%; aspect-ratio: 1; left: -12%; top: -34%; background: rgba(201, 163, 90, .42); }
.axd-why-stage::after { width: 54%; aspect-ratio: 1; right: -14%; bottom: -46%; background: rgba(195, 217, 168, .8); }
.axd-why-scene { position: absolute; inset: 0; padding: clamp(1rem, 3vw, 2.25rem); opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; }
.axd-why-scene.is-on { opacity: 1; visibility: visible; transition: opacity .4s; }

/* Scène 1 : la question tapée */
.axd-why-q { display: grid; place-items: center; }
.axd-why-ask { width: min(100%, 640px); display: flex; align-items: center; gap: .75rem; background: #fff; border: 2.5px solid var(--gold-500); border-radius: 18px; padding: clamp(.8rem, 2vw, 1.2rem) clamp(.9rem, 2.2vw, 1.4rem); box-shadow: 0 0 0 7px rgba(201, 163, 90, .16), 0 26px 44px -26px rgba(20, 30, 10, .45); }
.axd-why-ask-txt { flex: 1; min-width: 0; display: flex; align-items: center; white-space: nowrap; overflow: hidden; font-size: clamp(1rem, 3.3vw, 1.9rem); font-weight: 600; line-height: 1.3; color: var(--ink-900); }
.axd-why-caret { flex: none; width: 2.5px; height: 1.15em; margin-left: 3px; border-radius: 2px; background: var(--pine-600); }
.axd-why-send { flex: none; width: clamp(34px, 5vw, 46px); aspect-ratio: 1; border-radius: 50%; background: var(--pine-800); color: #fff; display: grid; place-items: center; }
.axd-why-send .axd-why-ico { width: 46%; height: 46%; stroke-width: 2.4; }

/* Scènes 2 et 3 : phrase + visuel */
.axd-why-split { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: .75rem; align-items: center; }
@media (min-width: 720px) {
  .axd-why-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 2rem; }
}
.axd-why-say { margin: 0; font-size: clamp(1.35rem, 3.4vw, 2.3rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; color: var(--pine-900); }
.axd-why-vis { position: relative; display: grid; place-items: center; min-height: 0; height: 100%; }
@media (min-width: 900px) {
  .axd-why-hub, .axd-why-tree { scale: 1.3; }
}

/* Scène 2 : les trois rôles convergent vers une seule personne */
.axd-why-hub { position: relative; width: 220px; height: 220px; }
.axd-why-core { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 18px; background: var(--pine-800); color: #fff; display: grid; place-items: center; box-shadow: 0 18px 30px -16px rgba(20, 30, 10, .6); }
.axd-why-core .axd-why-ico { width: 30px; height: 30px; }
.axd-why-core::after { content: ""; position: absolute; inset: -6px; border-radius: 23px; border: 2px solid var(--gold-500); opacity: 0; }
.axd-why-ring { position: absolute; inset: 0; }
.axd-why-arm { --a: 0deg; position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform: rotate(var(--a)) translateY(-84px); }
.axd-why-arm:nth-child(2) { --a: 120deg; }
.axd-why-arm:nth-child(3) { --a: 240deg; }
.axd-why-tile { position: absolute; left: -25px; top: -25px; width: 50px; height: 50px; border-radius: 14px; background: #fff; color: var(--pine-800); display: grid; place-items: center; box-shadow: 0 14px 24px -14px rgba(20, 30, 10, .5), 0 0 0 1px rgba(35, 56, 13, .07); transform: rotate(calc(-1 * var(--a))); }
.axd-why-tile .axd-why-ico { width: 24px; height: 24px; }

/* Scène 3 : l'arborescence */
.axd-why-tree { position: relative; width: 252px; height: 196px; }
.axd-why-root { position: absolute; z-index: 1; left: 0; top: 0; width: 48px; height: 48px; border-radius: 14px; background: var(--pine-800); color: #fff; display: grid; place-items: center; box-shadow: 0 14px 24px -14px rgba(20, 30, 10, .6); }
.axd-why-root .axd-why-ico { width: 23px; height: 23px; }
.axd-why-trunk { position: absolute; left: 23px; top: 48px; width: 2px; height: 124px; border-radius: 2px; background: var(--brand-200); transform-origin: top; }
.axd-why-branch, .axd-why-row { --k: 0; }
.axd-why-branch:nth-of-type(3), .axd-why-row:nth-of-type(2) { --k: 1; }
.axd-why-branch:nth-of-type(4), .axd-why-row:nth-of-type(3) { --k: 2; }
.axd-why-branch { position: absolute; left: 24px; width: 20px; height: 2px; top: calc(75px + var(--k) * 48px); background: var(--brand-200); transform-origin: left; }
.axd-why-row { position: absolute; left: 44px; right: 0; top: calc(56px + var(--k) * 48px); height: 40px; display: flex; align-items: center; gap: .55rem; padding: 0 .7rem 0 .4rem; white-space: nowrap; background: #fff; border-radius: 11px; font-size: .82rem; font-weight: 700; color: var(--pine-800); box-shadow: 0 12px 22px -14px rgba(20, 30, 10, .45), 0 0 0 1px rgba(35, 56, 13, .07); }
.axd-why-row > span { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--pine-800); color: #fff; display: grid; place-items: center; }
.axd-why-row .axd-why-ico { width: 15px; height: 15px; }

/* Les six arguments : liste compacte */
.axd-why-list { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 2rem; border-top: 1px solid var(--line-soft); }
@media (min-width: 520px) { .axd-why-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .axd-why-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.axd-why-item { --d: 0; display: flex; gap: .65rem; align-items: flex-start; min-width: 0; padding: .65rem 0; border-bottom: 1px solid var(--line-soft); }
.axd-why-item:nth-child(2) { --d: 1; }
.axd-why-item:nth-child(3) { --d: 2; }
.axd-why-item:nth-child(4) { --d: 3; }
.axd-why-item:nth-child(5) { --d: 4; }
.axd-why-item:nth-child(6) { --d: 5; }
.axd-why-item > span { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--mint-100); color: var(--pine-700); display: grid; place-items: center; transition: background .3s, color .3s; }
.axd-why-item:hover > span { background: var(--pine-800); color: #fff; }
.axd-why-item .axd-why-ico { width: 15px; height: 15px; }
.axd-why-item p { margin: .1rem 0 0; font-size: .86rem; line-height: 1.4; color: var(--ink-500); }
.axd-why-item strong { font-weight: 800; font-size: .92rem; color: var(--pine-800); }
.axd-why-item strong::after { content: " ·"; color: var(--gold-600); }

/* Animations */
@keyframes axd-why-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes axd-why-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes axd-why-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes axd-why-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes axd-why-line { from { transform: translateY(110%); } to { transform: none; } }
@keyframes axd-why-drift { to { transform: translate(9%, 14%) scale(1.18); } }
@keyframes axd-why-ask { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes axd-why-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes axd-why-press { 0%, 100% { transform: scale(1); } 50% { transform: scale(.82); } }
@keyframes axd-why-arm {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(-210px) scale(.6); animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  24% { opacity: 1; transform: rotate(var(--a)) translateY(-84px) scale(1); }
  58% { opacity: 1; transform: rotate(var(--a)) translateY(-84px) scale(1); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  79% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(.25); }
  81%, 100% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(.2); }
}
@keyframes axd-why-spin {
  0%, 24% { transform: rotate(0); animation-timing-function: linear; }
  58% { transform: rotate(55deg); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  81%, 100% { transform: rotate(260deg); }
}
@keyframes axd-why-unspin {
  0%, 24% { transform: rotate(calc(-1 * var(--a))); animation-timing-function: linear; }
  58% { transform: rotate(calc(-1 * var(--a) - 55deg)); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  81%, 100% { transform: rotate(calc(-1 * var(--a) - 260deg)); }
}
@keyframes axd-why-pulse { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.2); } }
@keyframes axd-why-ripple { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
@keyframes axd-why-root { from { transform: translate(102px, 74px) scale(1.33); } to { transform: none; } }
@keyframes axd-why-row { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes axd-why-light { from { background: var(--mint-100); color: var(--pine-700); } to { background: var(--pine-800); color: #fff; } }
@keyframes axd-why-wave { 0%, 100% { background: var(--mint-100); color: var(--pine-700); transform: scale(1); } 45% { background: var(--pine-800); color: #fff; transform: scale(1.14); } }

/* Titre et liste : une seule fois, à l'arrivée à l'écran (classe .is-in posée par pourquoi.js) */
.axd-why-title.is-in .axd-why-ln > span { animation: axd-why-line .8s var(--axd-out) both .1s; }
.axd-why-title.is-in .axd-why-ln + .axd-why-ln > span { animation-delay: .28s; }
.axd-why-title.is-in + .h-lead-text { animation: axd-why-rise .7s var(--axd-out) both .5s; }
.axd-why-list.is-in .axd-why-item { animation: axd-why-rise .5s var(--axd-out) backwards; animation-delay: calc(var(--d) * .07s); }
.axd-why-list.is-in .axd-why-item > span { animation: axd-why-wave .9s ease; animation-delay: calc(.55s + var(--d) * .13s); }

/* Film : uniquement quand .axd-why porte .is-playing (scène à l'écran) */
.axd-why.is-playing .axd-why-stage::before { animation: axd-why-drift 9s ease-in-out infinite alternate; }
.axd-why.is-playing .axd-why-stage::after { animation: axd-why-drift 11s ease-in-out infinite alternate-reverse; }
.axd-why.is-playing .is-on .axd-why-ask { animation: axd-why-ask .6s var(--axd-out) both; }
.axd-why.is-playing .is-on .axd-why-caret { animation: axd-why-blink .9s steps(1) infinite; }
.axd-why.is-playing .is-on .axd-why-send { animation: axd-why-press .35s ease 2.5s; }
.axd-why.is-playing .is-on .axd-why-say .axd-why-ln > span { animation: axd-why-line .7s var(--axd-out) both .3s; }
.axd-why.is-playing .is-on .axd-why-say .axd-why-ln + .axd-why-ln > span { animation-delay: .55s; }
.axd-why.is-playing .is-on .axd-why-core { animation: axd-why-pop .5s var(--axd-pop) both .15s, axd-why-pulse .6s ease 4.35s; }
.axd-why.is-playing .is-on .axd-why-core::after { animation: axd-why-ripple .8s ease-out 4.4s; }
.axd-why.is-playing .is-on .axd-why-arm { animation: axd-why-arm 5.2s both .3s; }
.axd-why.is-playing .is-on .axd-why-ring { animation: axd-why-spin 5.2s both .3s; }
.axd-why.is-playing .is-on .axd-why-tile { animation: axd-why-unspin 5.2s both .3s; }
.axd-why.is-playing .is-on .axd-why-root { animation: axd-why-root .8s var(--axd-io) both .1s; }
.axd-why.is-playing .is-on .axd-why-trunk { animation: axd-why-grow-y .7s var(--axd-io) both .8s; }
.axd-why.is-playing .is-on .axd-why-branch { animation: axd-why-grow .3s ease both; animation-delay: calc(1s + var(--k) * .35s); }
.axd-why.is-playing .is-on .axd-why-row { animation: axd-why-row .45s var(--axd-out) both; animation-delay: calc(1.15s + var(--k) * .35s); }
.axd-why.is-playing .is-on .axd-why-row > span { animation: axd-why-light .35s ease both; animation-delay: calc(2.5s + var(--k) * .22s); }

@media (prefers-reduced-motion: reduce) {
  .axd-why *, .axd-why *::before, .axd-why *::after { animation: none !important; transition: none !important; }
}
