/* ==========================================================================
   Motion layer · Dr. Ezequiel Espaillat
   Slow, premium transitions. Everything is opt-in through classes that
   motion.js adds after the design runtime has rendered the page, so with JS
   off (or reduced motion) the page shows exactly as designed.
   Reveal states use !important because the export writes inline styles
   (some buttons even use `all:unset`), which would otherwise win.
   ========================================================================== */
:root {
  --mx-e: cubic-bezier(.16, 1, .3, 1);      /* expo out: long, soft landing */
  --mx-e2: cubic-bezier(.65, 0, .35, 1);    /* in-out for shapes */
  --mx-t: .75s;
}
html { scroll-behavior: smooth; }
html[data-motion="off"] { scroll-behavior: auto; }

/* Hero stays hidden for the few ms before motion.js tags it (no loading screen). */
.mx-boot #inicio > * { opacity: 0; }

/* ---------- Scroll progress ---------- */
.mx-progress {
  position: fixed; left: 0; top: 0; right: 0; height: 3px; z-index: 9998; pointer-events: none;
  background: linear-gradient(90deg, #6E8A36, #A9C06A 60%, #D3E39C);
  transform-origin: 0 50%; scale: 0 1; box-shadow: 0 0 12px rgba(169,192,106,.6);
}

/* ---------- Reveal core ---------- */
/* While tagging, hidden states apply instantly (no transition, no delay). */
.mx.mx-prep .mx-r, .mx.mx-prep .mx-r *, .mx.mx-prep .mx-kb { transition: none !important; }
.mx .mx-r {
  transition:
    opacity var(--mx-t) var(--mx-e) var(--mx-delay, 0s),
    translate var(--mx-t) var(--mx-e) var(--mx-delay, 0s),
    scale var(--mx-t) var(--mx-e) var(--mx-delay, 0s),
    rotate var(--mx-t) var(--mx-e) var(--mx-delay, 0s),
    filter var(--mx-t) var(--mx-e) var(--mx-delay, 0s),
    clip-path .9s var(--mx-e2) var(--mx-delay, 0s),
    transform .7s var(--mx-e) 0s,
    box-shadow .7s var(--mx-e) 0s,
    background-color .6s ease 0s,
    color .6s ease 0s,
    border-color .6s ease 0s !important;
}
.mx .mx-up:not(.in)    { opacity: 0 !important; translate: 0 64px !important; filter: blur(8px) !important; }
.mx .mx-down:not(.in)  { opacity: 0 !important; translate: 0 -34px !important; }
.mx .mx-left:not(.in)  { opacity: 0 !important; translate: -80px 0 !important; filter: blur(6px) !important; }
.mx .mx-right:not(.in) { opacity: 0 !important; translate: 80px 0 !important; filter: blur(6px) !important; }
.mx .mx-fade:not(.in)  { opacity: 0 !important; translate: 0 22px !important; }
.mx .mx-zoom:not(.in)  { opacity: 0 !important; scale: .86 !important; filter: blur(10px) !important; }
.mx .mx-pop:not(.in)   { opacity: 0 !important; scale: .55 !important; rotate: -8deg !important; filter: blur(6px) !important; }
.mx .mx-rise:not(.in)  { opacity: 0 !important; translate: 0 90px !important; scale: .96 !important; filter: blur(12px) !important; }
.mx .mx-card:not(.in)  { opacity: 0 !important; translate: 0 110px !important; rotate: var(--rot, 0deg) !important; scale: .92 !important; }
.mx .mx-card { transition-duration: .8s !important; }

/* Eyebrows: wipe in from the left */
.mx .mx-eyebrow { clip-path: inset(0 0 0 0); }
.mx .mx-eyebrow:not(.in) { opacity: 0 !important; clip-path: inset(0 100% 0 0) !important; translate: -14px 0 !important; }

/* ---------- Split titles (word by word, masked) ---------- */
.mx .mx-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .09em .16em 0; margin: 0 -.09em -.16em 0; }
.mx .mx-wi {
  display: inline-block;
  transition:
    translate .8s var(--mx-e) calc(var(--mx-delay, 0s) + var(--i) * .04s),
    rotate .8s var(--mx-e) calc(var(--mx-delay, 0s) + var(--i) * .04s),
    opacity .6s ease calc(var(--mx-delay, 0s) + var(--i) * .04s);
}
.mx .mx-title:not(.in) .mx-wi { translate: 0 118%; rotate: 6deg; opacity: 0; }

/* ---------- Icons: pop + stroke drawing ---------- */
.mx .mx-ic:not(.in) { opacity: 0 !important; scale: .3 !important; rotate: -110deg !important; }
.mx .mx-draw {
  stroke-dasharray: var(--len);
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.2s var(--mx-e2) calc(var(--mx-delay, 0s) + .2s + var(--j, 0) * .08s);
}
.mx .mx-r:not(.in) .mx-draw { stroke-dashoffset: var(--len); }
.mx .mx-ic { transition-timing-function: cubic-bezier(.34, 1.56, .64, 1) !important; }
.mx .mx-ic-hover { transition: rotate .7s cubic-bezier(.34,1.56,.64,1), scale .7s cubic-bezier(.34,1.56,.64,1) !important; }

/* ---------- Pill buttons: open from the centre, then icon + label ---------- */
.mx .mx-pill { position: relative !important; overflow: hidden !important; isolation: isolate; clip-path: inset(0 0 0 0 round 999px); }
.mx .mx-pill:not(.in) { clip-path: inset(0 50% 0 50% round 999px) !important; opacity: 0 !important; }
.mx .mx-pill.done { clip-path: none !important; }
.mx .mx-pill .mx-lbl { display: inline-block; transition: translate .6s var(--mx-e) calc(var(--mx-delay, 0s) + .22s), opacity .5s ease calc(var(--mx-delay, 0s) + .22s); }
.mx .mx-pill:not(.in) .mx-lbl { translate: 0 120%; opacity: 0; }
.mx .mx-pill .mx-pic { transition: scale .8s cubic-bezier(.34,1.56,.64,1) calc(var(--mx-delay, 0s) + .2s), rotate .8s var(--mx-e) calc(var(--mx-delay, 0s) + .2s), opacity .5s ease calc(var(--mx-delay, 0s) + .2s); }
.mx .mx-pill:not(.in) .mx-pic { scale: .15; rotate: -160deg; opacity: 0; }
.mx .mx-pill.done .mx-pic { transition: scale .6s cubic-bezier(.34,1.56,.64,1), rotate .8s var(--mx-e); }
.mx .mx-pill .mx-arrow { transition: translate .6s var(--mx-e); }
.mx .mx-pill::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; border-radius: inherit;
  background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.42) 50%, transparent 75%);
  translate: -130% 0;
}
.mx .mx-pill.done::after { animation: mxShine 1.8s .1s var(--mx-e2) 1; }
.mx .mx-pill:hover::after { animation: mxShine 1.1s var(--mx-e2) 1; }
@keyframes mxShine { from { translate: -130% 0; } to { translate: 130% 0; } }
.mx .mx-pill.done:hover .mx-pic { rotate: -18deg; scale: 1.12; }
.mx .mx-pill:hover .mx-arrow { translate: 5px 0; }
.mx .mx-pill.mx-arrow-down:hover .mx-arrow { translate: 0 4px; }

/* Static badges (non-link pills): open from the centre */
.mx .mx-badge { clip-path: inset(0 0 0 0 round 999px); }
.mx .mx-badge:not(.in) { clip-path: inset(0 50% 0 50% round 999px) !important; opacity: 0 !important; }

/* ---------- Image frames: curtain + slow zoom-out ---------- */
.mx .mx-frame { clip-path: inset(0 0 0 0 round var(--fr, 0px)); }
.mx .mx-frame:not(.in)            { clip-path: inset(100% 0 0 0 round var(--fr, 0px)) !important; }
.mx .mx-frame.mx-fr-left:not(.in) { clip-path: inset(0 100% 0 0 round var(--fr, 0px)) !important; }
.mx .mx-frame.mx-fr-right:not(.in){ clip-path: inset(0 0 0 100% round var(--fr, 0px)) !important; }
.mx .mx-frame.mx-fr-mid:not(.in)  { clip-path: inset(50% 0 50% 0 round var(--fr, 0px)) !important; }
.mx .mx-frame { transition-duration: .9s !important; }
.mx .mx-frame.done { clip-path: none !important; }
.mx .mx-frame .mx-zimg { transition: scale 1.1s var(--mx-e) var(--mx-delay, 0s), transform 1.2s var(--mx-e) !important; }
.mx .mx-frame:not(.in) .mx-zimg { scale: 1.32; }

/* ---------- Hero ---------- */
.mx .mx-hero-shape.mx-play { animation: mxHeroShape 1.4s var(--mx-e2) both; }
@keyframes mxHeroShape {
  0%   { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); }
  55%  { clip-path: polygon(0 0, 100% 0, 100% 94%, 0 70%); }
  100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 var(--cut, 84%)); }
}
.mx .mx-kb { scale: 1.22; transition: scale 2.6s var(--mx-e) .1s; }
.mx .mx-kb.in { scale: 1; }
.mx .mx-doc:not(.in) { opacity: 0 !important; translate: 0 180px !important; filter: blur(10px) !important; }
.mx .mx-doc { transition-duration: 1.4s !important; }

/* Nav links: underline draws on hover */
.mx .mx-nl { background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0% 1.5px; padding-bottom: 4px; transition: background-size .6s var(--mx-e), color .4s, opacity var(--mx-t) var(--mx-e) var(--mx-delay,0s), translate var(--mx-t) var(--mx-e) var(--mx-delay,0s) !important; }
.mx .mx-nl:hover { background-size: 100% 1.5px; color: #fff; opacity: 1; }

/* Form */
.mx .mx-seg { transition: background-color .7s var(--mx-e), color .5s, border-color .7s, transform .5s cubic-bezier(.34,1.56,.64,1), box-shadow .6s, opacity var(--mx-t) var(--mx-e) var(--mx-delay,0s), translate var(--mx-t) var(--mx-e) var(--mx-delay,0s) !important; }
.mx .mx-seg:hover { transform: translateY(-2px); }
.mx .mx-seg:active { transform: scale(.96); }
.mx #inicio input { transition: box-shadow .6s var(--mx-e), border-color .6s, transform .6s var(--mx-e); }
.mx #inicio input:focus { outline: none; box-shadow: 0 0 0 4px rgba(169,192,106,.38), 0 10px 26px -12px rgba(0,0,0,.5); transform: translateY(-1px); }
.mx [role="alert"] { animation: mxShake .7s var(--mx-e) both; }
@keyframes mxShake { 0% { opacity: 0; translate: 0 -8px; } 30% { opacity: 1; translate: -6px 0; } 50% { translate: 5px 0; } 70% { translate: -3px 0; } 100% { translate: 0 0; } }

/* ---------- Continuous, quiet motion ---------- */
.mx .mx-bob   { animation: mxBob 6.5s ease-in-out infinite; }
.mx .mx-bob2  { animation: mxBob 7.5s -2.5s ease-in-out infinite; }
@keyframes mxBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
.mx .mx-floatimg { animation: mxFloat 7s ease-in-out infinite; animation-delay: var(--fd, 0s); }
@keyframes mxFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -14px; } }
.mx .mx-sway { animation: mxSway 6s ease-in-out infinite; animation-delay: var(--fd, 0s); }
@keyframes mxSway { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }
.mx .mx-morph  { animation: mxMorph 16s ease-in-out infinite; }
.mx .mx-morph2 { animation: mxMorph2 19s ease-in-out infinite; }
@keyframes mxMorph {
  0%, 100% { border-radius: 62% 38% 44% 56% / 48% 56% 44% 52%; }
  33% { border-radius: 48% 52% 60% 40% / 58% 42% 58% 42%; }
  66% { border-radius: 56% 44% 38% 62% / 42% 60% 40% 58%; }
}
@keyframes mxMorph2 {
  0%, 100% { border-radius: 44% 56% 58% 42% / 56% 44% 56% 44%; }
  50% { border-radius: 60% 40% 42% 58% / 44% 58% 42% 56%; }
}
.mx .mx-drift  { animation: mxDrift 12s ease-in-out infinite; }
.mx .mx-drift2 { animation: mxDrift 15s -5s ease-in-out infinite reverse; }
@keyframes mxDrift { 0%, 100% { translate: 0 0; scale: 1; } 50% { translate: 16px -18px; scale: 1.12; } }
.mx .mx-ping { animation: mxPing 2.6s ease-out infinite; }
@keyframes mxPing { 0% { box-shadow: 0 0 0 0 rgba(143,160,89,.7); } 80%, 100% { box-shadow: 0 0 0 10px rgba(143,160,89,0); } }
.mx .mx-playring { animation: mxPlay 2.8s ease-out infinite; }
@keyframes mxPlay {
  0%   { box-shadow: 0 0 0 0 rgba(169,192,106,.55), 0 14px 30px rgba(0,0,0,.4); }
  70%  { box-shadow: 0 0 0 22px rgba(169,192,106,0), 0 14px 30px rgba(0,0,0,.4); }
  100% { box-shadow: 0 0 0 0 rgba(169,192,106,0), 0 14px 30px rgba(0,0,0,.4); }
}
.mx .mx-nudge { animation: mxNudge 2.4s ease-in-out infinite; }
@keyframes mxNudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 5px; } }

/* ---------- Servicios ---------- */
.mx .mx-tag:not(.in) { opacity: 0 !important; translate: 0 -46px !important; scale: .4 !important; filter: blur(6px) !important; }
.mx .mx-tag { transition-timing-function: cubic-bezier(.34, 1.4, .64, 1) !important; }
.mx .mx-obj:not(.in) { opacity: 0 !important; scale: .45 !important; rotate: -18deg !important; filter: blur(10px) !important; }
.mx .mx-obj { transition-duration: .9s !important; transition-timing-function: cubic-bezier(.34, 1.3, .64, 1) !important; }
.mx .mx-svc:hover .mx-obj { transform: translateY(-10px) rotate(4deg) scale(1.05); }
.mx .mx-svc { will-change: transform; }

/* Mitos: line strikes through each myth */
.mx .mx-strike { background: linear-gradient(#B9CA8A, #B9CA8A) no-repeat 0 56% / 0% 2px; transition: background-size .9s var(--mx-e2) calc(var(--mx-delay, 0s) + .5s); }
.mx .in .mx-strike, .mx .mx-strike.in { background-size: 100% 2px; }

/* ---------- Cards, hovers ---------- */
.mx .mx-lift:hover { transform: translateY(-8px); box-shadow: 0 34px 60px -30px rgba(15,46,34,.55) !important; }
.mx .mx-hz { overflow: hidden; }
.mx .mx-hz img { transition: scale 1.1s var(--mx-e) var(--mx-delay, 0s), transform 1.2s var(--mx-e) !important; }
.mx .mx-lift:hover .mx-hz img, .mx .mx-hz:hover img { transform: scale(1.07); }
.mx .mx-feat:hover .mx-ic-hover { rotate: -12deg; scale: 1.12; }
.mx .mx-feat:hover { transform: translateY(-4px); background-color: #EEF2E4 !important; }
.mx .mx-vid:hover .mx-vplay { transform: scale(1.12); }
.mx .mx-vplay { transition: transform .8s cubic-bezier(.34,1.56,.64,1), scale 1.3s cubic-bezier(.34,1.56,.64,1) var(--mx-delay,0s), opacity 1s ease var(--mx-delay,0s) !important; }
.mx .mx-vplay:not(.in) { opacity: 0 !important; scale: .2 !important; }
.mx .mx-vgo { transition: transform .7s var(--mx-e), rotate .7s var(--mx-e); }
.mx .mx-vid:hover .mx-vgo { rotate: 45deg; transform: scale(1.1); }
.mx .mx-num:not(.in) { opacity: 0 !important; scale: 0 !important; rotate: -200deg !important; }
.mx .mx-num { transition-timing-function: cubic-bezier(.34, 1.56, .64, 1) !important; }

/* ---------- FAQ ---------- */
.mx .mx-faq:hover { transform: translateX(6px); border-color: #C3D58A !important; }
.mx .mx-faq button { transition: color .5s ease !important; }
.mx .mx-faq button > span:last-child { transition: rotate .8s cubic-bezier(.34,1.56,.64,1), background-color .6s, color .6s !important; }
.mx .mx-faq button[aria-expanded="true"] > span:last-child { rotate: 180deg; background-color: #0F2E22 !important; color: #C3D58A !important; }
.mx .mx-faq button + p, .mx .mx-faq button ~ p { animation: mxFaqIn 1s var(--mx-e) both; transform-origin: top; }
@keyframes mxFaqIn { from { opacity: 0; translate: 0 -12px; clip-path: inset(0 0 100% 0); } to { opacity: 1; translate: 0 0; clip-path: inset(0 0 0 0); } }

/* ---------- Mobile: lighter distances ---------- */
@media (max-width: 760px) {
  .mx .mx-left:not(.in)  { translate: -36px 0 !important; }
  .mx .mx-right:not(.in) { translate: 36px 0 !important; }
  .mx .mx-card:not(.in)  { translate: 0 70px !important; }
  .mx .mx-doc:not(.in)   { translate: 0 110px !important; }
}

/* ==========================================================================
   Phone layout fixes (layout only, desktop untouched)
   ========================================================================== */
@media (max-width: 900px) {
  /* Hero: doctor centred and whole, under the form, on a gentler diagonal */
  #inicio .wrap > div > div:first-child { padding-bottom: 24px !important; }
  #inicio .wrap > div > div:nth-child(2) { height: 560px !important; flex-basis: 100% !important; }
  #inicio > div:last-child img { height: 680px !important; right: auto !important; left: 50% !important; margin-left: -234px !important; bottom: -150px !important; }
  /* Rounded cards: comfortable padding so buttons keep one line */
  #hombres .wrap > div > div:last-child, #contacto .wrap > div > div:first-child { padding: 44px 22px !important; }
  #ubicacion .wrap > div > div:first-child { padding: 38px 22px !important; }
  #hombres .wrap > div > div:first-child { min-height: 380px !important; }
}
@media (max-width: 600px) {
  /* Pills never wrap into tall shapes */
  .mx-pill, #hombres a, #contacto a, #ubicacion a, #faq a { white-space: nowrap; }
  #hombres .wrap > div > div:last-child > div:last-child a,
  #contacto .wrap > div > div:first-child > div:nth-child(4) a,
  #ubicacion .wrap > div > div:first-child > div:last-child a { font-size: 15px !important; }
  #hombres .wrap > div > div:last-child > div:last-child a:last-child { padding: 15px 20px !important; }
  /* ¿Para quién?: two cards per row */
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; column-gap: 14px !important; row-gap: 84px !important; }
  .svc-grid article { width: 100% !important; height: 268px !important; padding: 0 13px 15px !important; }
  .svc-grid article > img { width: 150px !important; height: 140px !important; left: 50% !important; right: auto !important; margin-left: -75px !important; top: -62px !important; }
  .svc-grid article > p { font-size: 11.5px !important; line-height: 1.5 !important; }
  .svc-head > div > span:first-child { left: -4px !important; }
  .svc-head > div > span:last-child { right: -4px !important; }
  #servicios { padding-top: 90px !important; }
}
