/* ==========================================================================
   Motion design Nytotik
   - Courbes : --ease-out (entrées), --ease-in-out (déplacements), --ease-in (sorties).
   - Immobile au repos : les rares boucles n'animent que transform / opacity
     et se mettent en pause hors de l'écran (.is-paused, posée par motion.js).
   - Tout est coupé si le visiteur demande moins d'animations.
   ========================================================================== */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
}

@property --angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

/* Ambiance en pause hors de l'écran */
.is-paused,
.is-paused *,
.is-paused *::before,
.is-paused *::after {
  animation-play-state: paused !important;
}

/* ---------- Titres : mots masqués qui montent (motion.js) ---------- */
.w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  /* Accents et jambages ne sont pas coupés par le masque */
  padding-block: 0.12em;
  margin-block: -0.12em;
}

.wi {
  display: inline-block;
  will-change: transform;
}

/* Mot mis en avant : un unique reflet lumineux quand le titre est écrit */
.accent-text .wi {
  background: linear-gradient(100deg, var(--brand) 0 42%, #d6ebff 50%, var(--brand) 58% 100%);
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (prefers-reduced-motion: no-preference) {
  .accent-text.is-shine .wi {
    animation: shimmer-once 1.4s var(--ease-in-out) 1 both;
  }
}

/* ---------- Ventilateur du hero : « mise sous tension » ---------- */
/* Lueur statique (le flou animé coûtait trop cher), anneau en rotation lente, plus de cycle de couleurs */
.fan::before {
  animation: none;
  transition: opacity 0.8s var(--ease-out);
}

.fan .ring {
  animation-duration: 12s;
  transition: opacity 0.7s var(--ease-out);
}

.fan .blades {
  animation: spin 9s linear infinite;
  transition: opacity 0.6s var(--ease-out);
}

.fan .hub span {
  display: inline-block;
  transition: opacity 0.5s var(--ease-out);
}

/* Éteint dès le premier affichage (classe posée dans fan.ejs) ; sans JavaScript ou sans animation : allumé */
@media (prefers-reduced-motion: no-preference) {
  .js .fan.is-off::before,
  .js .fan.is-off .ring {
    opacity: 0;
  }

  .js .fan.is-off .blades {
    opacity: 0.45;
  }

  .js .fan.is-off .hub span {
    opacity: 0.3;
  }
}

/* ---------- Orbes lumineuses (2, lentes, transform uniquement) ---------- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
}

.orb-a {
  width: 520px;
  height: 520px;
  left: -140px;
  top: 5%;
  background: radial-gradient(circle, rgba(31, 111, 235, 0.55), transparent 65%);
  opacity: 0.45;
}

.orb-b {
  width: 460px;
  height: 460px;
  right: 8%;
  top: -12%;
  background: radial-gradient(circle, rgba(47, 155, 227, 0.5), transparent 65%);
  opacity: 0.4;
}

.orb-c {
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  .orb-a {
    animation: orb-a 34s var(--ease-in-out) infinite alternate;
  }

  .orb-b {
    animation: orb-b 40s var(--ease-in-out) infinite alternate;
  }
}

/* Téléphone : un simple dégradé fixe suffit */
@media (max-width: 640px) {
  .orb {
    display: none;
  }
}

/* ---------- Cartes ---------- */
.offer-item,
.extras > li {
  display: flex;
}

.offers .offer,
.extras .extra {
  flex: 1;
}

.extras .extra {
  position: relative;
}

/* Le transform est piloté par Motion (inclinaison + relèvement) : pas de saut CSS au survol */
@media (hover: hover) {
  .js .services .service:hover,
  .js .offers .offer:hover {
    transform: none;
  }
}

/* Bordure « projecteur » : un éclat de lumière suit le curseur le long du contour */
.service::before,
.offer:not(.featured)::before,
.extra::before {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 1.5px;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--sx, 50%) var(--sy, 50%), rgba(121, 184, 255, 0.95), transparent 70%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

/* Halo doux qui suit le curseur à l'intérieur de la carte */
.service::after,
.offer::after,
.extra::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(420px circle at var(--sx, 50%) var(--sy, 50%), rgba(88, 166, 255, 0.13), transparent 60%);
}

@media (hover: hover) {
  .service:hover::before,
  .offer:not(.featured):hover::before,
  .extra:hover::before,
  .service:hover::after,
  .offer:hover::after,
  .extra:hover::after {
    opacity: 1;
  }
}

/* Offre mise en avant : bordure lumineuse qui fait UN tour quand son prix s'arrête */
.offers .offer.featured::before {
  content: '';
  position: absolute;
  inset: -1px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from var(--angle), transparent 0 50%, #1f6feb 68%, #a5d6ff 82%, transparent 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box exclude,
    linear-gradient(#000 0 0);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .offers .offer.featured.is-turn::before {
    animation: spin-angle 1.2s var(--ease-in-out) 1;
  }
}

/* ---------- Compteurs « odomètre » (client/motion-kit.js) ---------- */
.odo-host {
  font-variant-numeric: tabular-nums;
}

.odo {
  display: inline-block;
  height: 1.1em;
  height: 1lh;
  overflow: hidden;
  vertical-align: top;
}

/* Prix à largeur réservée (posée par motion-kit.js) : les colonnes repliées s'ouvrent sans rien décaler autour */
.odo-vis {
  display: inline-block;
  white-space: nowrap;
}

/* Prix calés à droite (panneau « En bref ») : le nombre grandit vers la gauche */
.page-hero .fact .odo-vis {
  text-align: right;
}

.odo.is-folded {
  width: 0;
}

.odo-strip {
  display: block;
  will-change: transform;
}

.odo-strip > span {
  display: block;
  height: 1.1em;
  height: 1lh;
}

/* Effet tambour pendant le roulement : les chiffres s'estompent en haut et en bas */
.odo-host.is-rolling .odo {
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}

/* Reflet unique sur le prix de l'offre mise en avant */
.offers .amount {
  position: relative;
  overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .offers .amount.is-shine::after {
    content: '';
    position: absolute;
    inset: 0 -30%;
    background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
    transform: translateX(-120%);
    animation: shine 0.7s var(--ease-in-out) 1 forwards;
    pointer-events: none;
  }
}

/* ---------- Boutons : reflet qui traverse au survol ---------- */
.btn-primary:not(.fab) {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.btn-primary:not(.fab)::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  transform: translateX(-120%);
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .btn-primary:not(.fab):hover::after {
    transform: translateX(120%);
    transition: transform 0.8s var(--ease-in-out);
  }
}

/* ---------- Navigation : pastille qui glisse sous le lien survolé ---------- */
@media (min-width: 901px) {
  .site-header .nav.has-indicator {
    position: relative;
  }

  .site-header .nav-list {
    position: relative;
    z-index: 1;
  }

  .site-header .has-indicator .nav-link:hover {
    background: transparent;
  }
}

.nav-indicator {
  position: absolute;
  left: 0;
  top: 50%;
  height: 2.45rem;
  margin-top: -1.225rem;
  width: 0;
  border-radius: 999px;
  background: rgba(240, 246, 252, 0.08);
  box-shadow: inset 0 0 0 1px rgba(240, 246, 252, 0.06);
  opacity: 0;
  pointer-events: none;
}

/* ---------- FAQ ---------- */
.faq details p {
  overflow: hidden;
}

.faq .toggle {
  transition:
    transform 0.45s var(--ease-out),
    background-color 0.2s ease,
    color 0.2s ease;
}

.faq details.is-closing .toggle {
  transform: none;
  background: var(--paper);
  color: inherit;
}

/* ---------- Formulaire : le message glisse au lieu de surgir ---------- */
.contact .status:not([hidden]) {
  animation: status-in 0.35s var(--ease-out);
}

/* ---------- Pied de page : soulignement qui se dévoile ---------- */
.site-footer .col a,
.site-footer .legal a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 7px;
  transition:
    color 0.2s ease,
    text-decoration-color 0.3s ease,
    text-underline-offset 0.3s var(--ease-out);
}

.site-footer .col a:hover,
.site-footer .legal a:hover {
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
}

/* ---------- Barre de progression : fine ---------- */
.scroll-progress {
  height: 2px;
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.6);
}

/* ---------- Transition entre pages : l'icône de la carte devient celle de l'en-tête ---------- */
::view-transition-group(svc-icon) {
  animation-duration: 0.45s;
  animation-timing-function: var(--ease-in-out);
}

[data-vt='svc'] .page-hero .panel {
  opacity: 1;
}

/* ---------- Keyframes ---------- */
@keyframes spin-angle {
  to {
    --angle: 360deg;
  }
}

@keyframes shimmer-once {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}

@keyframes shine {
  to {
    transform: translateX(120%);
  }
}

@keyframes orb-a {
  to {
    transform: translate(120px, 70px);
  }
}

@keyframes orb-b {
  to {
    transform: translate(-100px, 90px);
  }
}

@keyframes status-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* FAQ : la marge basse de la réponse fait partie de la hauteur animée (height: 0 = vraiment 0, aucun saut final) */
.faq details p {
  padding-bottom: 0;
}

.faq details p::after {
  content: '';
  display: block;
  height: 1.3rem;
}

/* ---------- Retour immédiat au toucher ----------
   Le surlignage natif est masqué (base.css) : chaque élément touchable réagit dès l'appui,
   via des propriétés indépendantes (filter / scale) qui ne gênent ni Motion ni les transitions existantes. */
:is(.faq summary, .showcase, [role='tab'], .room-back, .lb-btn, .thumb, .house-tag, .link-arrow, .site-footer a, .contact a, .switch a):active {
  filter: brightness(1.25);
}

:is([role='tab'], .room-back, .lb-btn, .thumb, .link-arrow):active {
  scale: 0.96;
}

:is(.faq summary, .showcase):active {
  scale: 0.985;
}

/* Carte de service : la bordure s'allume à l'instant de l'appui (et non après 0,3 s de transition) */
.service:active {
  transition-duration: 0s;
  scale: 0.985;
}

/* Pièce de la maison touchée : le sol s'éclaire tout de suite */
.house .device:active .room-floor {
  fill-opacity: 0.22;
  stroke-opacity: 1;
  transition-duration: 0s;
}

/* ---------- Premier affichage allégé : les sections hors écran ne sont mises en page qu'en approchant ----------
   (cv-all, posée par boot.js lors d'un saut d'ancre, les rend toutes pour arriver pile au bon endroit) */
main > section:not(:first-child),
.site-footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 900px;
}

.cv-all main > section,
.cv-all .site-footer {
  content-visibility: visible;
}
