/* =================================================================
   KIT ARTISAN - Couche moderne et animée (2026)
   Chargée APRÈS style.css, jamais sur l'administration.
   Suit les variables de style.css : changer :root suffit.
   Animations : transform / opacity / clip-path uniquement,
   toutes coupées si le visiteur demande moins d'animation.
   Pour revenir à l'ancien rendu : retirer motion-init.js, motion.css
   et motion.js de app/views/header.php.
   ================================================================= */

:root {
    --ease: cubic-bezier(.16, 1, .3, 1);
    --ease-io: cubic-bezier(.65, 0, .35, 1);
}

/* ---------- Barre de lecture rouge ---------- */
.m-progress {
    position: fixed; inset: 0 0 auto; z-index: 70;
    height: 3px; background: var(--red);
    transform-origin: 0 50%; transform: scaleX(0);
    pointer-events: none; opacity: 0;
}
@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .m-progress { opacity: 1; animation: m-progress linear both; animation-timeline: scroll(root); }
    }
}
@keyframes m-progress { to { transform: scaleX(1); } }

/* ---------- En-tête : se resserre et s'éclaircit au défilement ---------- */
.site-header {
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    transition: box-shadow .3s ease, background-color .3s ease;
}
.header-inner { transition: min-height .45s var(--ease); }
.site-header.is-scrolled .header-inner { min-height: calc(var(--header-h) - 12px); }
.brand-hermine { transition: transform .8s var(--ease); }
.brand:hover .brand-hermine { transform: rotate(-10deg) scale(1.08); }
.header-phone { transition: background-color .25s ease, transform .4s var(--ease); }
.header-phone:hover { transform: translateY(-2px); }
@media (prefers-reduced-transparency: reduce) {
    .site-header { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- Boutons : le fond monte depuis la gauche ---------- */
.btn {
    position: relative; overflow: hidden; isolation: isolate;
    transition: color .3s ease, border-color .3s ease, transform .45s var(--ease), box-shadow .45s var(--ease);
}
.btn::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    transform: scaleX(0); transform-origin: left;
    transition: transform .5s var(--ease);
}
.btn:hover::before { transform: scaleX(1); }
.btn:active { transform: scale(.97); transition-duration: .1s; }
.btn-red { box-shadow: 0 12px 26px -14px rgba(198, 40, 40, .75); }
.btn-red:hover { background: var(--red); box-shadow: 0 18px 34px -14px rgba(198, 40, 40, .85); }
.btn-red::before { background: var(--red-dark); }
.btn-ink:hover { background: var(--ink); }
.btn-ink::before { background: var(--red); }
.btn-outline::before { background: var(--ink); }
.btn-outline:hover { background: transparent; }
.btn .ico { transition: transform .45s var(--ease); }
.btn:hover .ico:last-child { transform: translateX(4px); }
.btn:hover .ico:first-child:not(:last-child) { transform: rotate(-12deg); }
/* Boutons aimantés (le JS pose --tx / --ty) */
.m-magnet { transform: translate(var(--tx, 0), var(--ty, 0)); }
.m-magnet:hover { transform: translate(var(--tx, 0), var(--ty, 0)); }

.link-arrow .ico { transition: transform .45s var(--ease); }
.link-arrow:hover .ico { transform: translateX(4px); }

/* ---------- Hero ---------- */
/* Le grand « 22 » se dessine, puis dérive au défilement */
.js .hero-bg-num { animation: m-num 2.2s var(--ease) .2s both; }
@keyframes m-num {
    from { opacity: 0; transform: translateY(8%) scale(.94); -webkit-text-stroke-color: rgba(198, 40, 40, 0); }
    to   { opacity: 1; transform: none; }
}
@supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
        .hero-bg-num { translate: 0 0; animation: m-num 2.2s var(--ease) .2s both, m-num-drift linear both; animation-timeline: auto, scroll(root); animation-range: normal, 0 100vh; }
    }
}
@keyframes m-num-drift { to { translate: 0 -18%; } }

/* Texte en cascade */
.js .hero .kicker,
.js .hero-trades,
.js .hero-lead,
.js .hero-actions,
.js .page-head .kicker,
.js .page-head p:not(.kicker),
.js .page-head .chips {
    animation: m-rise 1s var(--ease) both;
}
.js .hero .kicker, .js .page-head .kicker { animation-delay: .1s; }
.js .hero-trades { animation-delay: .55s; }
.js .hero-lead, .js .page-head p:not(.kicker) { animation-delay: .7s; }
.js .hero-actions, .js .page-head .chips { animation-delay: .85s; }
@keyframes m-rise {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: none; }
}

/* Titre découpé mot à mot (par motion.js) */
.m-split .w { display: inline-block; overflow: clip; overflow-clip-margin: .1em; vertical-align: top; }
.m-split .w > span { display: inline-block; }
.js .m-split .w > span {
    transform: translateY(105%);
    animation: m-word .95s var(--ease) forwards;
    animation-delay: calc(.2s + var(--i, 0) * 55ms);
}
@keyframes m-word { to { transform: translateY(0); } }
.m-split .nowrap { white-space: nowrap; }

/* La carte de visite arrive en 3D, puis suit la souris (--rx / --ry posés par le JS) */
.hero-card-wrap { perspective: 1200px; }
.biz-card {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotate(-4deg);
    transition: transform .6s var(--ease), box-shadow .6s var(--ease);
    will-change: transform;
}
.biz-card:hover {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) rotate(-2deg) translateY(-6px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .05), 0 44px 80px -28px rgba(20, 20, 20, .5);
}
.js .hero-card-wrap { animation: m-card 1.5s var(--ease) .35s both; }
@keyframes m-card {
    from { opacity: 0; transform: translateY(60px) rotateX(24deg) rotateZ(6deg); }
    to   { opacity: 1; transform: none; }
}
/* Reflet de lumière sur la carte, qui suit la souris */
.biz-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(60% 80% at var(--gx, 30%) var(--gy, 20%), rgba(255, 255, 255, .55), transparent 60%);
    mix-blend-mode: soft-light; opacity: 0; transition: opacity .5s ease;
}
.biz-card:hover::after { opacity: 1; }
/* Les hermines de la carte se balancent doucement */
@media (prefers-reduced-motion: no-preference) {
    .h1-hermine { animation: m-sway 6s var(--ease-io) 2s infinite alternate; transform-origin: 50% 80%; }
    .h2-hermine { animation: m-sway 6s var(--ease-io) 2.6s infinite alternate-reverse; transform-origin: 50% 80%; }
}
@keyframes m-sway { from { rotate: 0deg; } to { rotate: 6deg; } }

/* ---------- Bandeau rouge défilant (un seul sur le site) ---------- */
.ribbon { overflow: hidden; }
.ribbon-track { display: flex; width: max-content; }
.ribbon .ribbon-list {
    flex: none; flex-wrap: nowrap; justify-content: flex-start;
    width: auto; max-width: none; gap: 0; padding-inline: 0;
}
.ribbon .ribbon-list li { padding-right: 2.6rem; white-space: nowrap; }
.ribbon .ribbon-list li .ico { transition: transform .5s var(--ease); }
@media (prefers-reduced-motion: no-preference) {
    .ribbon-track { animation: m-marquee 38s linear infinite; }
    .ribbon:hover .ribbon-track { animation-play-state: paused; }
}
@keyframes m-marquee { to { transform: translateX(-50%); } }

/* ---------- Apparitions au défilement (classe .m-up posée par le JS) ---------- */
.js .m-up {
    opacity: 0; transform: translateY(32px);
    transition: opacity .9s var(--ease) var(--d, 0ms), transform .9s var(--ease) var(--d, 0ms);
}
.js .m-up.in { opacity: 1; transform: none; }

/* Les kickers : le trait rouge se dessine */
.kicker::before { transform-origin: left; transition: transform .9s var(--ease) calc(var(--d, 0ms) + .2s); }
.js .m-up:not(.in) .kicker::before { transform: scaleX(0); }

/* ---------- Trois métiers ---------- */
.trade { border-top-color: transparent; transition: translate .6s var(--ease), opacity .9s var(--ease) var(--d, 0ms), transform .9s var(--ease) var(--d, 0ms); }
.trade::before {
    content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 4px;
    background: var(--ink); transform-origin: left;
    transition: transform 1.1s var(--ease) var(--d, 0ms), background-color .3s ease;
}
.js .trade.m-up:not(.in)::before { transform: scaleX(0); }
.trade:hover::before { background: var(--red); }
.trade:hover { translate: 0 -6px; }
.trade-num { transition: transform .8s var(--ease); display: inline-block; }
.trade:hover .trade-num { transform: translateX(6px) scale(1.06); }

/* ---------- Méthode des joints : le fil se remplit au défilement ---------- */
.method li::after {
    content: ""; position: absolute; left: 27px; top: 56px; bottom: 0; width: 2px;
    background: var(--red); transform-origin: top; transform: scaleY(0);
    transition: transform 1s var(--ease) calc(var(--d, 0ms) + .3s);
}
.method li:last-child::after { display: none; }
.method li.in::after { transform: scaleY(1); }
.method-step { transition: transform .7s var(--ease), background-color .4s ease; }
.js .method li.m-up:not(.in) .method-step { transform: scale(.4); }
.method li:hover .method-step { background: var(--red); transform: scale(1.08); }

/* « Lumière rasante » : un reflet traverse le titre de la spécialité */
.split-text h2 { position: relative; }
.split-text.in h2 {
    background: linear-gradient(100deg, var(--ink) 40%, #8a8a8a 50%, var(--ink) 60%) 0 0 / 250% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: m-raking 2.6s var(--ease-io) .5s both;
}
@keyframes m-raking { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Mosaïque et galerie : dévoilement en rideau ---------- */
/* Le rideau est un voile posé sur la photo (::after), jamais un clip-path sur l'élément :
   un élément rogné à 100 % a une surface visible nulle, l'IntersectionObserver ne le voit
   jamais et le chargement différé (loading="lazy") des photos ne démarre pas. */
.js .mosaic-item.m-up, .js .gallery-item.m-up { opacity: 1; transform: none; }
.js .mosaic-item.m-up::after, .js .gallery-item.m-up > a::after {
    content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: var(--stone); transform-origin: 50% 0;
    transition: transform 1.2s var(--ease) var(--d, 0ms);
}
.js .mosaic-item.m-up.in::after, .js .gallery-item.m-up.in > a::after { transform: scaleY(0); }
.mosaic-item img, .gallery-item img { transition: transform 1.2s var(--ease); }
.mosaic-item:hover img { transform: scale(1.06); }
.gallery-item a:hover img { transform: scale(1.05); }

/* ---------- Zone d'intervention (styles qui manquaient dans style.css) ---------- */
.zone { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.zone p:not(.kicker) { color: var(--ink-2); }
.zone-address { display: flex; align-items: flex-start; gap: .6em; margin-top: 18px; font-weight: 400; }
.zone-address .ico { color: var(--red); margin-top: .35em; }
.towns { display: flex; flex-wrap: wrap; gap: 10px; }
.towns li {
    padding: .5em 1.05em; border: 2px solid var(--ink); border-radius: var(--radius); background: #fff;
    font-family: var(--font-display); font-weight: 500; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase;
}

/* ---------- Communes : les puces arrivent une à une ---------- */
.towns li { transition: transform .5s var(--ease), background-color .3s ease, color .3s ease, border-color .3s ease, opacity .6s ease; }
.towns li:hover { transform: translateY(-3px); border-color: var(--red); color: var(--red); }
.towns li:first-child:hover { color: #fff; }
.js .towns.m-up { opacity: 1; transform: none; }
.js .towns.m-up:not(.in) li { opacity: 0; transform: translateY(12px); }
.towns.in li:nth-child(2) { transition-delay: .04s; }
.towns.in li:nth-child(3) { transition-delay: .08s; }
.towns.in li:nth-child(4) { transition-delay: .12s; }
.towns.in li:nth-child(5) { transition-delay: .16s; }
.towns.in li:nth-child(6) { transition-delay: .20s; }
.towns.in li:nth-child(7) { transition-delay: .24s; }
.towns.in li:nth-child(8) { transition-delay: .28s; }
.towns.in li:nth-child(n+9) { transition-delay: .32s; }

/* ---------- FAQ : ouverture fluide (navigateurs récents) ---------- */
:root { interpolate-size: allow-keywords; }
.faq details::details-content {
    block-size: 0; overflow: clip; opacity: 0;
    transition: block-size .5s var(--ease), opacity .4s ease, content-visibility .5s allow-discrete;
}
.faq details[open]::details-content { block-size: auto; opacity: 1; }
.faq summary { transition: color .25s ease, padding-left .45s var(--ease); }
.faq summary:hover { padding-left: 8px; }
.faq summary .ico { transition: transform .45s var(--ease); }

/* ---------- Bandeau d'appel final ---------- */
@media (prefers-reduced-motion: no-preference) {
    .cta-hermine { animation: m-float 9s var(--ease-io) infinite alternate; }
}
@keyframes m-float { to { translate: -18px 26px; rotate: 6deg; } }
.cta-phone { position: relative; display: inline-block; }
.cta-phone::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 4px;
    background: var(--red); transform: scaleX(0); transform-origin: left;
    transition: transform .6s var(--ease);
}
.cta-phone:hover::after, .cta-inner.in .cta-phone::after { transform: scaleX(1); }
.cta-inner.in .cta-phone::after { transition-delay: .5s; }

/* ---------- En-têtes de pages : la ligne rouge se dessine ---------- */
.page-head { border-bottom: 0; overflow: hidden; }
.page-head::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px;
    background: var(--red); transform-origin: left;
}
.js .page-head::after { animation: m-line 1.4s var(--ease) .3s both; }
@keyframes m-line { from { transform: scaleX(0); } }
.page-head::before {
    content: ""; position: absolute; right: -60px; top: -40px; width: 260px; height: 260px;
    border: 2px solid rgba(198, 40, 40, .1); transform: rotate(45deg); pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
    .page-head::before { animation: m-spin 40s linear infinite; }
}
@keyframes m-spin { to { transform: rotate(405deg); } }
.chips a { transition: background-color .25s ease, color .25s ease, transform .4s var(--ease); }
.chips a:hover { transform: translateY(-2px); }

/* ---------- Prestations ---------- */
.service-icon { transition: transform .8s var(--ease); }
.service-grid:hover .service-icon { transform: rotate(-8deg) scale(1.08); }
.service-body { transition: box-shadow .6s var(--ease), translate .6s var(--ease), opacity .9s var(--ease) var(--d, 0ms), transform .9s var(--ease) var(--d, 0ms); }
.service-body:hover { translate: 0 -4px; box-shadow: 0 30px 60px -34px rgba(20, 20, 20, .4); }
.js .service-body.m-up:not(.in) .checklist li { opacity: 0; transform: translateX(-12px); }
.checklist li { transition: opacity .5s ease, transform .6s var(--ease); }
.service-body.in .checklist li:nth-child(2) { transition-delay: .1s; }
.service-body.in .checklist li:nth-child(3) { transition-delay: .2s; }
.service-body.in .checklist li:nth-child(4) { transition-delay: .3s; }
.service-body.in .checklist li:nth-child(n+5) { transition-delay: .4s; }

.timeline li { position: relative; border-top-color: transparent; }
.timeline li::before {
    content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 3px;
    background: var(--ink); transform-origin: left;
    transition: transform 1s var(--ease) var(--d, 0ms);
}
.js .timeline li.m-up:not(.in)::before { transform: scaleX(0); }
.timeline-num { transition: transform .7s var(--ease); display: inline-block; }
.timeline li:hover .timeline-num { transform: translateY(-4px) scale(1.08); }

/* ---------- Contact ---------- */
@media (prefers-reduced-motion: no-preference) {
    .contact-hermine { animation: m-float 10s var(--ease-io) infinite alternate; }
}
.contact-card-phone { transition: color .25s ease, border-color .25s ease; }
input:focus, select:focus, textarea:focus { transition: border-color .2s ease, box-shadow .35s var(--ease); }

/* ---------- 404 ---------- */
.js .big-404 { animation: m-rise 1.2s var(--ease) both; }

/* ---------- Pied de page ---------- */
.footer-list a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: color .25s ease, background-size .45s var(--ease); }
.footer-list a:hover { text-decoration: none; background-size: 100% 1px; }
.socials a { transition: background-color .25s ease, border-color .25s ease, transform .45s var(--ease); }
.socials a:hover { transform: translateY(-3px); }
.footer-hermine { transition: transform .8s var(--ease); }
.footer-logo:hover .footer-hermine { transform: rotate(-10deg); }

/* Barre d'appel mobile : arrive par le bas */
@media (max-width: 720px) {
    .js .callbar { animation: m-bar .8s var(--ease) 1s both; }
}
@keyframes m-bar { from { transform: translateY(100%); } }

/* ---------- Moins d'animation : tout est affiché, rien ne bouge ---------- */
@media (prefers-reduced-motion: reduce) {
    .js .m-up, .js .m-up:not(.in) li, .js .m-up:not(.in) .method-step { opacity: 1 !important; transform: none !important; clip-path: none !important; }
    .js .trade.m-up::before, .js .timeline li.m-up::before, .method li::after, .page-head::after { transform: none !important; }
    .split-text.in h2 { background: none; color: inherit; }
}

@media print {
    .m-progress { display: none !important; }
    .ribbon-track { animation: none !important; }
}
