/*! OvaWeb FX — effets pour sites statiques, sans dépendance.
   Chaque effet s'active par un attribut data-fx… (voir kit/README.md).
   Sans JavaScript ou avec « réduire les animations », tout reste visible et utilisable. */

:root {
  --fx-ease: cubic-bezier(.2, .7, .2, 1);
  --fx-dur: .9s;
  --fx-dist: 28px;
  --fx-accent: currentColor;
}

/* Transitions douces entre les pages du site (Chrome, Edge, Safari 18.2+) */
@view-transition { navigation: auto; }

/* ---------- Apparition au défilement : data-fx="up|fade|left|right|zoom|mask" ---------- */
.fx-js [data-fx] {
  transition: opacity var(--fx-dur) var(--fx-ease), transform var(--fx-dur) var(--fx-ease), clip-path calc(var(--fx-dur) * 1.3) var(--fx-ease);
  transition-delay: var(--fx-delay, 0ms);
}
.fx-js [data-fx]:not(.fx-in) { opacity: 0; }
.fx-js [data-fx="up"]:not(.fx-in) { transform: translateY(var(--fx-dist)); }
.fx-js [data-fx="left"]:not(.fx-in) { transform: translateX(calc(var(--fx-dist) * -1)); }
.fx-js [data-fx="right"]:not(.fx-in) { transform: translateX(var(--fx-dist)); }
.fx-js [data-fx="zoom"]:not(.fx-in) { transform: scale(.94); }
.fx-js [data-fx="mask"] { opacity: 1; }
.fx-js [data-fx="mask"]:not(.fx-in) { opacity: 1; clip-path: inset(0 0 100% 0); }
.fx-js [data-fx="mask"].fx-in { clip-path: inset(0); }

/* ---------- Titre mot par mot : data-fx-split ---------- */
.fx-word { display: inline-block; }
.fx-js [data-fx-split] .fx-word {
  transition: opacity .8s var(--fx-ease), transform .8s var(--fx-ease);
  transition-delay: calc(var(--fx-i) * 70ms + var(--fx-delay, 0ms));
}
.fx-js [data-fx-split]:not(.fx-in) .fx-word { opacity: 0; transform: translateY(.45em); }

/* ---------- Parallaxe : data-fx-parallax="0.15" ---------- */
.fx-parallax-frame { overflow: hidden; }
[data-fx-parallax] { will-change: transform; }

/* ---------- En-tête : data-fx-header ---------- */
[data-fx-header] { transition: transform .45s var(--fx-ease), background-color .3s, box-shadow .3s, padding .3s; }
[data-fx-header].fx-hidden { transform: translateY(-100%); }

/* ---------- Barre de lecture : data-fx-progress ---------- */
[data-fx-progress] {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000;
  background: var(--fx-accent); transform-origin: 0 50%;
  transform: scaleX(var(--fx-progress, 0));
  pointer-events: none;
}

/* ---------- Bandeau défilant : data-fx-marquee="30" (secondes par tour) ---------- */
[data-fx-marquee] { overflow: hidden; display: flex; }
.fx-marquee-track {
  display: flex; flex: none; min-width: max-content;
  gap: var(--fx-gap, 2rem); padding-right: var(--fx-gap, 2rem);
  animation: fx-marquee var(--fx-marquee-dur, 30s) linear infinite;
}
[data-fx-marquee]:hover .fx-marquee-track { animation-play-state: paused; }
@keyframes fx-marquee { to { transform: translateX(-50%); } }

/* ---------- Inclinaison 3D au survol : data-fx-tilt ---------- */
[data-fx-tilt] {
  transform: perspective(900px) rotateX(var(--fx-rx, 0deg)) rotateY(var(--fx-ry, 0deg));
  transition: transform .5s var(--fx-ease);
}
[data-fx-tilt].fx-tilting { transition-duration: .12s; }

/* ---------- Pile de cartes collantes : data-fx-stack (dès 800 px : sur mobile, les cartes se cacheraient) ---------- */
@media (min-width: 800px) {
  [data-fx-stack] > * {
    position: sticky;
    top: calc(var(--fx-stack-top, 6rem) + var(--fx-i, 0) * var(--fx-stack-gap, 1.25rem));
  }
}

/* ---------- Carrousel : data-fx-carousel ---------- */
[data-fx-carousel] {
  display: flex; gap: var(--fx-gap, 1rem);
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  overscroll-behavior-x: contain; scrollbar-width: none;
}
[data-fx-carousel]::-webkit-scrollbar { display: none; }
[data-fx-carousel] > * { flex: 0 0 var(--fx-item, 82%); scroll-snap-align: start; }
@media (min-width: 720px) { [data-fx-carousel] > * { flex-basis: var(--fx-item-md, 45%); } }
@media (min-width: 1100px) { [data-fx-carousel] > * { flex-basis: var(--fx-item-lg, 31%); } }
.fx-carousel-nav { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.fx-carousel-nav button {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid currentColor;
  background: transparent; color: inherit; font-size: 1.1rem; cursor: pointer;
  transition: background-color .2s, color .2s, opacity .2s;
}
.fx-carousel-nav button:hover:not(:disabled) { background: color-mix(in srgb, currentColor 12%, transparent); }
.fx-carousel-nav button:disabled { opacity: .3; cursor: default; }

/* ---------- Visionneuse photos : data-fx-lightbox ---------- */
[data-fx-lightbox] img { cursor: zoom-in; }
.fx-lightbox {
  border: 0; padding: 0; margin: 0; width: 100%; max-width: none; height: 100%; max-height: none;
  background: rgba(10, 10, 12, .94); color: #fff;
}
.fx-lightbox[open] { display: grid; place-items: center; animation: fx-fade .3s ease; }
.fx-lightbox::backdrop { background: transparent; }
.fx-lightbox figure { margin: 0; display: grid; gap: .75rem; justify-items: center; max-width: 92vw; }
.fx-lightbox img { max-width: 92vw; max-height: 80vh; object-fit: contain; border-radius: 4px; }
.fx-lightbox figcaption { font: 400 .95rem/1.4 system-ui, sans-serif; opacity: .8; text-align: center; }
.fx-lightbox button {
  position: absolute; width: 3rem; height: 3rem; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.4rem; cursor: pointer;
}
.fx-lightbox button:hover { background: rgba(255, 255, 255, .25); }
.fx-lightbox .fx-lb-close { top: 1rem; right: 1rem; }
.fx-lightbox .fx-lb-prev { left: 1rem; top: 50%; translate: 0 -50%; }
.fx-lightbox .fx-lb-next { right: 1rem; top: 50%; translate: 0 -50%; }
@keyframes fx-fade { from { opacity: 0; } }

/* ---------- Avant / après : data-fx-compare (2 images) ---------- */
[data-fx-compare] { position: relative; display: grid; overflow: hidden; --fx-pos: 50%; }
[data-fx-compare] > img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: cover; }
[data-fx-compare] > img:nth-of-type(2) { clip-path: inset(0 0 0 var(--fx-pos)); }
[data-fx-compare]::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: var(--fx-pos); width: 2px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none;
}
.fx-compare-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: ew-resize;
}
.fx-compare-knob {
  position: absolute; top: 50%; left: var(--fx-pos); translate: -50% -50%; z-index: 1;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; background: #fff; color: #111;
  display: grid; place-items: center; font: 600 .9rem system-ui; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}
.fx-compare-range:focus-visible + .fx-compare-knob { outline: 3px solid var(--fx-accent); outline-offset: 2px; }

/* ---------- Statut d'ouverture : data-fx-hours ---------- */
[data-fx-hours]::before {
  content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%;
  margin-right: .5em; vertical-align: .08em; background: #9ca3af;
}
[data-fx-hours].fx-open::before { background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: fx-pulse 2s infinite; }
[data-fx-hours].fx-closed::before { background: #ef4444; }
@keyframes fx-pulse { 70% { box-shadow: 0 0 0 .5em rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* ---------- Menu mobile : data-fx-nav-toggle ---------- */
html.fx-nav-locked { overflow: hidden; }

/* ---------- FAQ / accordéon animé : <details class="fx-accordion"> ---------- */
.fx-accordion { interpolate-size: allow-keywords; }
.fx-accordion::details-content { height: 0; overflow: clip; transition: height .4s var(--fx-ease), content-visibility .4s allow-discrete; }
.fx-accordion[open]::details-content { height: auto; }

/* ---------- Petites classes utilitaires ---------- */
.fx-zoom-hover { overflow: hidden; }
.fx-zoom-hover img { transition: transform .9s var(--fx-ease); }
.fx-zoom-hover:hover img { transform: scale(1.05); }
.fx-underline {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--fx-ease);
}
.fx-underline:hover, .fx-underline:focus-visible { background-size: 100% 1px; }

/* ---------- Animations réduites : tout s'affiche immédiatement ---------- */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .fx-js [data-fx], .fx-js [data-fx-split] .fx-word { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }
  .fx-marquee-track { animation: none; flex-wrap: wrap; }
  [data-fx-parallax], [data-fx-tilt] { transform: none !important; }
  [data-fx-hours].fx-open::before { animation: none; }
}
