/* Section 07-faq — fichier propre à la section (base commune : ../styles.css).
   Une constellation de questions : trois groupes (la bêta, l'écriture, la transparence),
   chacun avec sa teinte ; ouvrir une question allume son étoile dans le ciel de gauche. */

.faq {
  --hue-a: 26 255 234;   /* --brand-bright */
  --hue-b: 167 139 250;  /* --violet */
  --hue-c: 255 136 79;   /* --warm */
  position: relative; overflow: clip; isolation: isolate;
  background:
    linear-gradient(var(--canvas), transparent 160px), /* fondu depuis la bêta : pas de marche de couleur */
    radial-gradient(40% 45% at 92% 6%, rgb(0 194 180 / 10%), transparent 70%),
    radial-gradient(38% 40% at 4% 58%, rgb(167 139 250 / 9%), transparent 70%),
    radial-gradient(35% 30% at 70% 102%, rgb(255 136 79 / 6%), transparent 70%),
    linear-gradient(180deg, var(--canvas) 0%, var(--canvas-deep) 55%, var(--canvas) 100%);
}
.faq-stars { z-index: -1; opacity: .45; }
.faq-aura { position: absolute; z-index: -1; pointer-events: none; left: -10%; top: 18%; width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(from 210deg, rgb(0 194 180 / 0%), rgb(0 194 180 / 9%), rgb(167 139 250 / 9%), rgb(255 136 79 / 6%), rgb(0 194 180 / 0%));
  filter: blur(70px); opacity: .9; animation: faq-aura 40s linear infinite; }
@keyframes faq-aura { to { transform: rotate(1turn); } }

/* ------------------------------------------------------------------ mise en page */
.faq-grid { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .faq-grid { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: clamp(48px, 6vw, 88px); align-items: start; }
  .faq-intro { align-self: stretch; }
  .faq-intro-inner { position: sticky; top: 96px; }
}
.faq h2 { max-width: 14ch; }
.faq .section-lead { max-width: 40ch; }

/* ------------------------------------------------------------------ le ciel */
.faq-sky { position: relative; isolation: isolate; margin: 28px 0 0 -24px; max-width: 500px; }
.faq-sky svg { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
/* Fenêtre sur le ciel de l'en-tête : la Voie lactée, fondue en disque derrière la constellation. */
.faq-sky::before { content: ""; position: absolute; z-index: -1; inset: 2% 4%; border-radius: 50%; pointer-events: none;
  background: image-set(url("../assets/media/hero-universe.avif") type("image/avif"),
                        url("../assets/media/hero-universe.webp") type("image/webp"),
                        url("../assets/media/hero-universe.jpg") type("image/jpeg")) 42% 55% / 260% auto no-repeat;
  -webkit-mask-image: radial-gradient(closest-side, #000 25%, rgb(0 0 0 / 45%) 62%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 25%, rgb(0 0 0 / 45%) 62%, transparent 100%);
  opacity: .34; filter: saturate(.85) hue-rotate(-12deg); transition: opacity 1.2s; }
.faq-sky.is-complete::before { opacity: .55; }
@media (max-width: 959px) {
  .faq-sky { max-width: 400px; margin: 20px auto 0; }
}

.sky-orbit { fill: none; stroke: rgb(168 176 189 / 13%); stroke-width: .8; stroke-dasharray: 2 6;
  transform-box: fill-box; transform-origin: center; animation: sky-orbit 90s linear infinite; }
.sky-orbit-2 { stroke: rgb(167 139 250 / 12%); animation-duration: 130s; animation-direction: reverse; }
@keyframes sky-orbit { to { transform: rotate(1turn); } }
.sky-nebula { transform-box: fill-box; transform-origin: center; transition: opacity 1.2s; opacity: .8; }
.sky-dust circle { fill: #dff; opacity: .55; }
.sky-dust circle:nth-child(3n) { animation: sky-twinkle 4s ease-in-out infinite alternate; }
.sky-dust circle:nth-child(3n+1) { animation: sky-twinkle 6s ease-in-out -2s infinite alternate; }
@keyframes sky-twinkle { from { opacity: .15; } to { opacity: .85; } }

.sky-line { stroke: rgb(168 176 189 / 22%); stroke-width: 1; stroke-linecap: round; }
.sky-bridge { stroke-dasharray: 1 5; stroke: rgb(168 176 189 / 26%); }
.sky-line-lit { stroke: rgb(var(--lit, var(--hue-a)) / 90%); stroke-width: 1.4; stroke-linecap: round; fill: none;
  stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; filter: drop-shadow(0 0 3px rgb(var(--lit, var(--hue-a)) / 80%));
  transition: stroke-dashoffset 1.1s cubic-bezier(.6,.05,.2,1), opacity .3s; }
.sky-line-lit.is-on { stroke-dashoffset: 0; opacity: 1; }

.sky-label { font: 600 10px Inter, sans-serif; letter-spacing: .16em; text-transform: uppercase; fill: var(--subtle); transition: fill .6s; }
.faq-sky.has-a .sky-label-a { fill: rgb(var(--hue-a)); }
.faq-sky.has-b .sky-label-b { fill: rgb(var(--hue-b)); }
.faq-sky.has-c .sky-label-c { fill: rgb(var(--hue-c)); }

.sky-shoot { stroke-width: 1.2; stroke-linecap: round; opacity: 0; transform: translate(40px, 30px) rotate(28deg); animation: sky-shoot 13s ease-in 4s infinite; }
@keyframes sky-shoot {
  0% { opacity: 0; transform: translate(40px, 20px) rotate(28deg); }
  2% { opacity: 1; }
  7% { opacity: 0; transform: translate(260px, 137px) rotate(28deg); }
  100% { opacity: 0; transform: translate(260px, 137px) rotate(28deg); }
}

.sky-star { --c: var(--hue-a); cursor: pointer; }
.sky-b { --c: var(--hue-b); }
.sky-c { --c: var(--hue-c); }
.sky-star > * { transform-box: fill-box; transform-origin: center; }
.sky-star .halo { opacity: .35; transform: scale(.55); transition: opacity .6s, transform .8s cubic-bezier(.2,.7,.2,1); }
.sky-star .core { fill: #e9fbff; transition: fill .4s, transform .5s cubic-bezier(.3,1.6,.5,1); }
.sky-star .spark { fill: rgb(var(--c)); opacity: 0; transform: scale(0) rotate(-45deg); transition: opacity .4s, transform .7s cubic-bezier(.3,1.5,.5,1); }
.sky-star .ripple { fill: none; stroke: rgb(var(--c)); stroke-width: 1; opacity: 0; }
.sky-star .hit { fill: transparent; }
.sky-star .num { font: 600 9px Inter, sans-serif; letter-spacing: .06em; fill: var(--subtle); opacity: .7; transition: fill .4s, opacity .4s; transform-box: view-box; }
.sky-star:nth-of-type(2n) .halo { animation: sky-breathe 5s ease-in-out infinite alternate; }
.sky-star:nth-of-type(2n+1) .halo { animation: sky-breathe 7s ease-in-out -2s infinite alternate; }
@keyframes sky-breathe { from { opacity: .18; } to { opacity: .45; } }

.sky-star.is-hover .halo { opacity: .8; transform: scale(.9); animation: none; }
.sky-star.is-hover .core { transform: scale(1.5); }
.sky-star.is-hover .num { fill: var(--fg); opacity: 1; }
.sky-star.is-lit .halo { opacity: 1; transform: scale(1.25); animation: none; }
.sky-star.is-lit .core { fill: #fff; transform: scale(1.3); }
.sky-star.is-lit .spark { opacity: 1; transform: scale(1) rotate(0); filter: drop-shadow(0 0 4px rgb(var(--c))); }
.sky-star.is-lit .num { fill: rgb(var(--c)); opacity: 1; }
.sky-star.is-burst .ripple { animation: sky-ripple 1.1s ease-out; }
@keyframes sky-ripple { from { opacity: .9; transform: scale(.6); } to { opacity: 0; transform: scale(4.2); } }

/* Toutes les questions ouvertes : le ciel entier s'illumine. */
.faq-sky.is-complete .sky-nebula { opacity: 1; animation: sky-complete 3s ease-in-out infinite alternate; }
@keyframes sky-complete { from { transform: scale(1); } to { transform: scale(1.08); } }

/* ------------------------------------------------------------------ groupes */
.faq-list { display: grid; gap: 40px; }
.faq-group { --c: var(--hue-a); display: grid; gap: 10px; }
.faq-group-b { --c: var(--hue-b); }
.faq-group-c { --c: var(--hue-c); }
.faq-group-label { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: rgb(var(--c)); }
.faq-group-label span { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; font-size: 11px; letter-spacing: .04em;
  border: 1px solid rgb(var(--c) / 40%); background: rgb(var(--c) / 8%); box-shadow: 0 0 18px rgb(var(--c) / 18%); }
.faq-group-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgb(var(--c) / 45%), rgb(var(--c) / 0%)); }

/* ------------------------------------------------------------------ questions */
.faq-item { border: 1px solid rgb(42 49 61 / 85%); border-radius: 16px;
  background: linear-gradient(135deg, rgb(21 25 32 / 82%), rgb(13 16 20 / 70%));
  transition: border-color .35s, background .35s, box-shadow .35s; }
/* Fil lumineux à gauche, tissé à l'ouverture */
.faq-item > summary::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 2px; border-radius: 2px;
  background: linear-gradient(rgb(var(--c)), rgb(var(--c) / 0%)); box-shadow: 0 0 12px rgb(var(--c) / 70%);
  transform: scaleY(0); transform-origin: top; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.faq-item[open]:not(.is-closing) > summary::before { transform: scaleY(1); }

.faq-item > summary { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) 34px; align-items: center; gap: 14px;
  padding: 18px 18px 18px 18px; list-style: none; cursor: pointer; border-radius: 16px; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:focus-visible { outline: 2px solid var(--brand-bright); outline-offset: -2px; border-radius: 16px; }

.faq-num { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  color: transparent; -webkit-text-stroke: 1px rgb(var(--c) / 55%); transition: color .4s, text-shadow .4s, -webkit-text-stroke-color .4s; }
.faq-q { font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--fg); transition: color .25s; text-wrap: pretty; }

.faq-icon { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong);
  transition: border-color .35s, background .35s, transform .5s cubic-bezier(.3,1.4,.5,1), box-shadow .35s; }
.faq-icon::before, .faq-icon::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.6px; margin: -.8px 0 0 -6px; border-radius: 2px;
  background: rgb(var(--c)); transition: transform .45s cubic-bezier(.3,1.4,.5,1), background .3s; }
.faq-icon::after { transform: rotate(90deg); }

.faq-item > summary:hover .faq-q { color: rgb(var(--c)); }
.faq-item > summary:hover .faq-icon { border-color: rgb(var(--c) / 70%); box-shadow: 0 0 16px rgb(var(--c) / 25%); }
.faq-item > summary:hover .faq-num { -webkit-text-stroke-color: rgb(var(--c)); }
.faq-item.is-pointed { border-color: rgb(var(--c) / 55%); }

.faq-item[open]:not(.is-closing) { border-color: rgb(var(--c) / 38%);
  background: radial-gradient(120% 90% at 0% 0%, rgb(var(--c) / 9%), transparent 60%), linear-gradient(135deg, rgb(26 31 40 / 92%), rgb(13 16 20 / 82%));
  box-shadow: 0 18px 50px rgb(0 0 0 / 40%), 0 0 0 1px rgb(var(--c) / 8%) inset; }
.faq-item[open]:not(.is-closing) .faq-num { color: rgb(var(--c)); -webkit-text-stroke-color: transparent; text-shadow: 0 0 18px rgb(var(--c) / 55%); }
.faq-item[open]:not(.is-closing) .faq-icon { transform: rotate(180deg); border-color: rgb(var(--c) / 60%); background: rgb(var(--c) / 14%); }
.faq-item[open]:not(.is-closing) .faq-icon::after { transform: rotate(0deg); }

.faq-body { overflow: hidden; }
.faq-body p { padding: 0 64px 22px 80px; color: var(--muted); font-size: 16px; line-height: 1.65; max-width: 68ch; }
.faq-body a { color: rgb(var(--c)); text-decoration-thickness: 1px; text-underline-offset: 3px; font-weight: 500; }
.faq-body a:hover { color: var(--fg); }
.faq-body a::after { content: " ↗"; }
.faq-item[open]:not(.is-closing) .faq-body p { animation: faq-text .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes faq-text { from { opacity: 0; transform: translateY(-6px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

@media (max-width: 600px) {
  .faq-list { gap: 32px; }
  .faq-item > summary { grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 10px; padding: 16px 14px; align-items: start; }
  .faq-num { font-size: 18px; margin-top: 2px; }
  .faq-q { font-size: 16px; }
  .faq-icon { width: 30px; height: 30px; margin-top: -3px; }
  .faq-body p { padding: 0 16px 20px 54px; font-size: 15px; }
}

/* ------------------------------------------------------------------ réduire les animations */
@media (prefers-reduced-motion: reduce) {
  .faq-aura, .sky-orbit, .sky-dust circle, .sky-shoot, .sky-star .halo, .faq-sky.is-complete .sky-nebula { animation: none !important; }
  .sky-shoot { display: none; }
  .sky-star.is-burst .ripple { animation: none; }
  .faq-item[open]:not(.is-closing) .faq-body p { animation: none; }
  .sky-line-lit, .sky-star > *, .faq-icon, .faq-icon::before, .faq-icon::after, .faq-item > summary::before { transition: none; }
}

/* Hérité de l'ancien fichier : utilisé par la section 08-final (à y déplacer). */
