/* Animations communes à toutes les pages. */
:root { --ease: cubic-bezier(0.2, 0.75, 0.2, 1); --rose: #ff9a9e; }

.theme-mix .btn { transition: transform 0.25s var(--ease), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.theme-mix .btn:hover { transform: translateY(-2px); }
.theme-mix .site-header { transition: box-shadow 0.3s ease; }
.theme-mix .site-header.is-stuck { box-shadow: 0 14px 30px -24px rgba(15, 32, 46, 0.55); }

/* Haut de page */
.hx { isolation: isolate; background: radial-gradient(110% 130% at 18% 0%, #d01e25 0%, #97121a 46%, #35070b 100%); }
.hx::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(70% 85% at 30% 18%, #000, transparent 76%);
  mask-image: radial-gradient(70% 85% at 30% 18%, #000, transparent 76%);
}
.hx-torch {
  --t: min(92vw, 820px);
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  width: var(--t);
  height: var(--t);
  margin: calc(var(--t) / -2) 0 0 calc(var(--t) / -2);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 214, 190, 0.3), rgba(255, 160, 140, 0.1) 46%, transparent 72%);
  pointer-events: none;
  will-change: transform;
  transform: translate3d(34vw, 30vh, 0);
}
.hx-ln { display: block; overflow: hidden; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.hx-ln > * { display: block; }
.hx-call { position: relative; }

/* Questions */
.theme-mix .faq summary::after { transition: transform 0.3s var(--ease); }
.theme-mix .faq details[open] summary::after { content: "+"; transform: rotate(45deg); }
@supports (interpolate-size: allow-keywords) {
  .theme-mix .faq details { interpolate-size: allow-keywords; }
  .theme-mix .faq details::details-content { height: 0; overflow: clip; transition: height 0.35s var(--ease), content-visibility 0.35s allow-discrete; }
  .theme-mix .faq details[open]::details-content { height: auto; }
}

/* Pages intérieures */
.mx-tile span { transition: translate 0.3s var(--ease); }
.mx-tile:hover span { translate: 5px 0; }
.page-grid .prose > h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 0.7rem;
  border-radius: 2px;
  background: var(--red);
  transform-origin: left;
  transition: transform 0.7s var(--ease) 0.15s;
}

@media (min-width: 1040px) {
  .mx-tiles:has(> :last-child:nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Apparitions au défilement : actives seulement si le script des animations est disponible */
.js-motion [data-rv] {
  transition:
    opacity 0.8s var(--ease) calc(var(--i, 0) * 70ms),
    transform 0.9s var(--ease) calc(var(--i, 0) * 70ms),
    clip-path 1.1s var(--ease) calc(var(--i, 0) * 70ms);
}
.js-motion [data-rv="up"]:not(.is-in) { opacity: 0; transform: translateY(28px); }
.js-motion [data-rv="pop"]:not(.is-in) { opacity: 0; transform: scale(0.82); }
.js-motion [data-rv="clip"]:not(.is-in) { clip-path: inset(14% 8% 14% 8% round 18px); opacity: 0.2; }
.js-motion [data-rv="clip"] { clip-path: inset(0 round 18px); }

.js-motion .page-grid .prose > * { transition: opacity 0.7s var(--ease), transform 0.8s var(--ease), clip-path 1s var(--ease); }
.js-motion .page-grid .prose > :not(.is-in):not(ul):not(img) { opacity: 0; transform: translateY(18px); }
.js-motion .page-grid .prose > h2:not(.is-in)::after { transform: scaleX(0); }
.js-motion .page-grid .prose > img { clip-path: inset(0 round 18px); }
.js-motion .page-grid .prose > img:not(.is-in) { opacity: 0.2; clip-path: inset(10% 6% 10% 6% round 18px); }
.js-motion .page-grid .prose > ul li { transition: opacity 0.55s var(--ease) calc(var(--l, 0) * 70ms), transform 0.6s var(--ease) calc(var(--l, 0) * 70ms); }
.js-motion .page-grid .prose > ul:not(.is-in) li { opacity: 0; transform: translateX(-12px); }
.prose > ul li:nth-child(2) { --l: 1; }
.prose > ul li:nth-child(3) { --l: 2; }
.prose > ul li:nth-child(4) { --l: 3; }
.prose > ul li:nth-child(5) { --l: 4; }
.prose > ul li:nth-child(n + 6) { --l: 5; }

/* Entrée du haut de page et animations continues */
@media (prefers-reduced-motion: no-preference) {
  .hx-torch { animation: sf-derive 18s ease-in-out infinite alternate; }
  .hx-torch.is-live { animation: none; }
  .hx-ln > * { animation: sf-ligne 0.95s var(--ease) both; }
  .hx-ln + .hx-ln > * { animation-delay: 0.1s; }
  .hx-in { animation: sf-monte 0.8s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms + 0.05s); }
  .hx .mx-subject img { animation: sf-leve 1.2s var(--ease) both 0.2s; }
  .hx .form-card { animation: sf-carte 1s var(--ease) both 0.12s; }
  .hx-call::after { content: ""; position: absolute; inset: -1px; border: 1px solid rgba(255, 255, 255, 0.75); border-radius: inherit; pointer-events: none; animation: sf-appel 2.6s var(--ease) infinite; }
}

@keyframes sf-derive {
  from { transform: translate3d(18vw, 12vh, 0); }
  50% { transform: translate3d(58vw, 34vh, 0); }
  to { transform: translate3d(34vw, 66vh, 0); }
}
@keyframes sf-ligne { from { transform: translateY(108%); } to { transform: none; } }
@keyframes sf-monte { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes sf-leve { from { opacity: 0; transform: translateY(70px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes sf-carte { from { opacity: 0; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes sf-appel { 0% { opacity: 0.8; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.07, 1.32); } }

@media print {
  .js-motion [data-rv], .js-motion [data-rv]:not(.is-in), .js-motion .page-grid .prose > *, .js-motion .page-grid .prose > ul li { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
