/* ==========================================================
   Muhouze Agencies — animation layer
   Loaded after style.css. Everything here is switched off for
   visitors who ask for reduced motion (see bottom of file).
   The `anim` class is added in <head> only when motion is allowed.
   ========================================================== */

:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- Page enter / leave ---------- */
.anim body { animation: pageIn .55s var(--ease) both; }
.anim body.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .25s ease, transform .25s ease; }
@keyframes pageIn { from { opacity: 0; } }

/* ---------- Scroll progress ---------- */
.progress-bar { position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: 200; pointer-events: none;
  background: linear-gradient(90deg, var(--leaf), var(--ember)); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- Header hides on scroll down, returns on scroll up ---------- */
.anim .header { transition: transform .4s var(--ease), border-color .3s, box-shadow .3s; }
.anim body.header-hidden .header { transform: translateY(-100%); }
.anim .subnav { transition: top .4s var(--ease); }
.anim body.header-hidden .subnav { top: 0; }

/* ---------- Headline words rise in ---------- */
.anim .hero h1, .anim .page-hero h1 { opacity: 0; animation: showAnyway 0s 2s forwards; } /* safety net if JS fails */
.anim .hero h1.is-split, .anim .page-hero h1.is-split { opacity: 1; animation: none; }
@keyframes showAnyway { to { opacity: 1; } }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.w > span { display: inline-block; transform: translateY(105%); animation: wordUp .9s var(--ease) forwards; animation-delay: calc(var(--i) * 70ms + 150ms); }
@keyframes wordUp { to { transform: none; } }

/* Hero supporting copy follows the headline */
.anim .hero .wrap > div > p, .anim .hero .btn-row, .anim .page-hero p, .anim .crumbs {
  opacity: 0; transform: translateY(18px); animation: riseIn .8s var(--ease) forwards; }
.anim .hero .wrap > div > p, .anim .page-hero p { animation-delay: .65s; }
.anim .hero .btn-row { animation-delay: .8s; }
.anim .crumbs { animation-delay: .05s; }
.anim .hero-card { opacity: 0; transform: translateY(30px) scale(.97); animation: riseIn 1s 1s var(--ease) forwards; }
.anim .hero-card li { opacity: 0; transform: translateX(14px); animation: riseIn .6s var(--ease) forwards; }
.anim .hero-card li:nth-child(1) { animation-delay: 1.35s; }
.anim .hero-card li:nth-child(2) { animation-delay: 1.45s; }
.anim .hero-card li:nth-child(3) { animation-delay: 1.55s; }
@keyframes riseIn { to { opacity: 1; transform: none; } }

/* Slow drift on hero photography */
.anim .hero .media img { animation: drift 14s var(--ease) both; transform-origin: 60% 40%; }
.anim .page-hero .media img { animation: drift 10s var(--ease) both; }
@keyframes drift { from { transform: scale(1.14); } to { transform: scale(1); } }

/* Beacons keep a gentle pulse after the plot is drawn */
.anim .survey .beacon { transform-box: fill-box; transform-origin: center; }
.anim .survey .ring { fill: none; stroke: var(--ember); stroke-width: 2; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; opacity: 0; animation: ring 2.8s ease-out infinite; }
@keyframes ring { 0% { opacity: .8; transform: scale(1); } 100% { opacity: 0; transform: scale(3.2); } }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
.reveal--left { transform: translateX(-40px); }
.reveal--right { transform: translateX(40px); }
.reveal--zoom { transform: scale(.94); }
.reveal.is-in { opacity: 1; transform: none; }

/* Images unveil with a wipe as they arrive */
.reveal-img img { clip-path: inset(0 0 100% 0); transform: scale(1.18); transition: clip-path 1.2s var(--ease), transform 1.6s var(--ease); transition-delay: calc(var(--d, 0) * 120ms); }
.reveal-img.is-in img { clip-path: inset(0 0 0 0); transform: none; }

/* Kicker line grows in */
.anim .kicker::before { transform-origin: left; transition: transform .7s .2s var(--ease); }
.anim .reveal:not(.is-in) .kicker::before, .anim .kicker.reveal:not(.is-in)::before { transform: scaleX(0); }

/* ---------- Process: the dashed line draws itself, numbers pop ---------- */
.anim .steps::before { transform-origin: left; transform: scaleX(0); transition: transform 1.8s var(--ease); }
.anim .steps.is-in::before { transform: scaleX(1); }
.anim .step .step__n { transform: scale(0); transition: transform .6s var(--spring), background .3s, color .3s; transition-delay: calc(var(--d, 0) * 280ms + 200ms); }
.anim .steps.is-in .step__n { transform: none; }
.step:hover .step__n { background: var(--leaf-ink); color: #fff; }
@media (max-width: 980px) {
  .anim .steps::before { transform-origin: top; transform: scaleY(0); }
  .anim .steps.is-in::before { transform: scaleY(1); }
}

/* Guide stage numbers count up visually */
.anim .stage__n { display: inline-block; transition: transform .6s var(--spring), color .3s; }
.anim .stage:not(.is-in) .stage__n { transform: translateY(20px) rotate(-8deg); }
.stage:hover .stage__n { color: var(--leaf-ink); transform: translateX(6px); }

/* ---------- Hover play ---------- */
/* Cards lift; JS adds a gentle tilt on desktop */
.card, .role, .quote, .tool, .ccard { transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s; will-change: transform; }
.card:hover, .role:hover, .quote:hover, a.ccard:hover { box-shadow: 0 28px 50px -28px rgba(14,39,22,.45); }
.quote:hover, a.ccard:hover, .card:hover, .role:hover { transform: translateY(-6px); }
.card__status { transition: transform .4s var(--spring); }
.card:hover .card__status { transform: translateY(-2px) scale(1.06); }
.card__loc svg { transition: transform .5s var(--spring); }
.card:hover .card__loc svg { transform: translateY(-3px); }

/* Icons answer the pointer */
.pillars h3 svg, .why__item > svg, .value svg, .ccard span svg, .contact-line span svg, .svc__icon svg { transition: transform .5s var(--spring); }
.pillars > div:hover h3 svg { transform: rotate(-12deg) scale(1.2); }
.why__item:hover > svg { transform: translateY(-4px) rotate(-6deg) scale(1.12); }
.value:hover svg { transform: scale(1.15) rotate(6deg); }
a.ccard:hover span svg, a.contact-line:hover span svg { animation: jiggle .6s ease; }
.svc:hover .svc__icon svg { transform: scale(1.15) rotate(-8deg); }
@keyframes jiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 50% { transform: rotate(10deg); } 75% { transform: rotate(-6deg); } }

/* Service rows slide their title on hover */
.svc h3 { transition: transform .5s var(--ease), color .3s; }
.svc:hover h3 { transform: translateX(10px); color: var(--leaf); }

/* Why section: the line under each item fills on hover */
.why__item { position: relative; }
.why__item::after { content: ""; position: absolute; left: 0; top: -1px; height: 2px; width: 100%; background: var(--ember); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.why__item:hover::after { transform: scaleX(1); }

/* Buttons: icon nudges, click ripples */
.btn { position: relative; overflow: hidden; isolation: isolate; transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .3s var(--spring); }
.btn:active { transform: scale(.96); }
.btn svg { transition: transform .4s var(--spring); }
.btn:hover svg { transform: scale(1.18) rotate(-8deg); }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .28; transform: scale(0); animation: ripple .65s ease-out forwards; z-index: -1; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.round, .chip, .seg span { transition: background .25s, color .25s, border-color .25s, transform .3s var(--spring); }
.round:hover { transform: scale(1.08); }
.round:active, .chip:active { transform: scale(.92); }
.chip:hover { border-color: var(--leaf-ink); }

/* Text links get a drawn underline */
.textlink { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px no-repeat; padding-bottom: 3px; transition: background-size .4s var(--ease), color .25s; }
.textlink:hover { background-size: 0 1.5px; background-position: 100% 100%; }

/* Nav underline slides in on hover */
.nav a::before { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; background: var(--leaf); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.nav a:hover::before { transform: scaleX(1); transform-origin: left; }
.nav a:hover { background: transparent; }
.nav a[aria-current="page"]::before { display: none; }

/* Mobile drawer links cascade in */
.drawer nav a { opacity: 0; transform: translateX(30px); transition: opacity .4s, transform .5s var(--ease), color .2s; }
.drawer.is-open nav a { opacity: 1; transform: none; }
.drawer.is-open nav a:nth-child(1) { transition-delay: .12s; }
.drawer.is-open nav a:nth-child(2) { transition-delay: .17s; }
.drawer.is-open nav a:nth-child(3) { transition-delay: .22s; }
.drawer.is-open nav a:nth-child(4) { transition-delay: .27s; }
.drawer.is-open nav a:nth-child(5) { transition-delay: .32s; }
.drawer.is-open nav a:nth-child(6) { transition-delay: .37s; }
.drawer nav a:hover { color: var(--leaf); }

/* ---------- Listings re-flow when filters change ---------- */
[data-listings] .card, [data-featured] .card { animation: cardIn .6s var(--ease) both; }
[data-listings] .card:nth-child(2) { animation-delay: .06s; }
[data-listings] .card:nth-child(3) { animation-delay: .12s; }
[data-listings] .card:nth-child(4) { animation-delay: .18s; }
[data-listings] .card:nth-child(5) { animation-delay: .24s; }
[data-listings] .card:nth-child(6) { animation-delay: .3s; }
[data-listings] .card:nth-child(n+7) { animation-delay: .36s; }
[data-featured] .card { animation: none; }
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.results-bar [data-count] { display: inline-block; }
.results-bar [data-count].bump { animation: bump .45s var(--spring); }
@keyframes bump { 40% { transform: scale(1.12); color: var(--leaf-ink); } }

/* Modal content slides in */
.modal.is-open .modal__scrim { animation: fadeIn .3s ease both; }
.modal.is-open .modal__info > * { animation: riseIn .6s var(--ease) both; opacity: 0; transform: translateY(14px); }
.modal.is-open .modal__info > *:nth-child(2) { animation-delay: .06s; }
.modal.is-open .modal__info > *:nth-child(3) { animation-delay: .12s; }
.modal.is-open .modal__info > *:nth-child(4) { animation-delay: .18s; }
.modal.is-open .modal__info > *:nth-child(5) { animation-delay: .24s; }
.modal.is-open .modal__info > *:nth-child(6) { animation-delay: .3s; }
.gallery__main img { transition: opacity .35s ease; }
.gallery__main img.is-swapping { opacity: 0; }
.gallery__thumbs button { transition: transform .3s var(--spring), border-color .2s; }
.gallery__thumbs button:hover { transform: translateY(-3px); }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Tools: results pulse when they change ---------- */
.out.is-updated b { animation: tick .5s var(--spring); }
@keyframes tick { 40% { transform: translateY(-3px) scale(1.06); } }
.out b { display: inline-block; }
.plotview rect { animation: plotIn .6s var(--ease) both; transform-box: fill-box; transform-origin: center; }
.plotview circle { animation: beaconIn .5s .25s var(--spring) both; transform-box: fill-box; transform-origin: center; }
@keyframes plotIn { from { opacity: .3; transform: scale(.94); } }
@keyframes beaconIn { from { transform: scale(0); } }
.checklist label { transition: background .25s, padding-left .3s var(--ease); border-radius: 8px; }
.checklist label:hover { background: rgba(55,179,74,.06); padding-left: 8px; }
.checklist input:checked { animation: checkPop .4s var(--spring); }
@keyframes checkPop { 50% { transform: scale(1.3); } }
.progress i.done { animation: glow 1.2s ease; }
@keyframes glow { 50% { box-shadow: 0 0 16px 2px rgba(55,179,74,.7); } }

/* Form fields lift label colour on focus */
.field label { transition: color .2s; }
.field:focus-within label { color: var(--leaf-ink); }
.on-dark .field:focus-within label { color: var(--leaf); }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- WhatsApp button says hello ---------- */
.fab__wa { position: relative; animation: fabIn .7s 1.6s var(--spring) both; }
.fab__wa::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--leaf); animation: fabRing 2.6s 2.4s ease-out infinite; }
.fab__wa svg { transition: transform .4s var(--spring); }
.fab__wa:hover svg { transform: rotate(-14deg) scale(1.12); }
@keyframes fabIn { from { transform: scale(0) rotate(-90deg); } }
@keyframes fabRing { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }
.fab__bubble { position: absolute; right: 70px; bottom: 6px; white-space: nowrap; background: var(--white); color: var(--ink); font-family: var(--f-display); font-size: .92rem; padding: 10px 14px 10px 16px; border-radius: 18px 18px 4px 18px; box-shadow: 0 14px 34px -14px rgba(0,0,0,.4); display: flex; align-items: center; gap: 8px; opacity: 0; transform: translateX(12px) scale(.9); transform-origin: right bottom; pointer-events: none; transition: opacity .35s, transform .45s var(--spring); }
.fab__bubble.is-on { opacity: 1; transform: none; pointer-events: auto; }
.fab__bubble button { width: 26px !important; height: 26px !important; box-shadow: none !important; background: var(--stone); color: var(--ink); border-radius: 50%; display: grid; place-items: center; }
.fab__bubble button svg { width: 12px; height: 12px; }
.fab__bubble .wave { width: 9px; height: 9px; border-radius: 50%; background: var(--leaf); flex: none; box-shadow: 0 0 0 0 rgba(55,179,74,.6); animation: online 1.8s ease-out infinite; }
@keyframes online { 70% { box-shadow: 0 0 0 8px rgba(55,179,74,0); } 100% { box-shadow: 0 0 0 0 rgba(55,179,74,0); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-8deg); } }
.fab__wrap { position: relative; }

/* ---------- Custom cursor (desktop with a mouse only) ---------- */
.cursor-dot, .cursor-ring { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 300; border-radius: 50%; opacity: 0; transition: opacity .3s; }
.cursor-dot { width: 7px; height: 7px; background: var(--ember); margin: -3.5px 0 0 -3.5px; }
.cursor-ring { width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid var(--leaf-ink); transition: opacity .3s, width .3s var(--ease), height .3s var(--ease), margin .3s var(--ease), background .3s, border-color .3s; }
.has-cursor .cursor-dot, .has-cursor .cursor-ring { opacity: 1; }
.cursor-ring.is-hover { width: 62px; height: 62px; margin: -31px 0 0 -31px; background: rgba(55,179,74,.12); border-color: var(--leaf); }
.cursor-ring.is-down { width: 26px; height: 26px; margin: -13px 0 0 -13px; }

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-img img { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .w > span { transform: none !important; }
  .cursor-dot, .cursor-ring, .progress-bar { display: none !important; }
  .fab__wa::before, .survey .ring { display: none; }
}
@media (max-width: 900px) {
  .reveal--left, .reveal--right { transform: translateY(34px); }
}
