/* Shared motion + mobile layer for the clinic sites.
   --fx-brand / --fx-ink are set per site in <html style>. */
:root {
  --fx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fx-dur: 700ms;
  --fx-shift: 22px;
  --fx-stagger: 70ms;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
img, svg, video { max-width: 100%; }
[id] { scroll-margin-top: 88px; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--fx-brand); outline-offset: 3px; border-radius: 6px; }

/* ---------- Header ---------- */
header { transition: box-shadow 300ms var(--fx-ease), background-color 300ms var(--fx-ease); }
header.is-scrolled { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.35); }

/* ---------- Buttons & cards: micro-interactions ---------- */
a[href^="tel:"], a[href*="wa.me"], a[href*="whatsapp"], a[href*="maps"], .btn-p, .btn-o {
  transition: transform 220ms var(--fx-ease), box-shadow 220ms var(--fx-ease), background-color 220ms ease, color 220ms ease;
}
@media (hover: hover) {
  .btn-p:hover, .btn-o:hover, a.fx-btn:hover { transform: translateY(-2px); }
  .fx-card { transition: transform 320ms var(--fx-ease), box-shadow 320ms var(--fx-ease); }
  .fx-card:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -26px rgba(0, 0, 0, 0.35); }
  .fx-zoom { overflow: hidden; }
  .fx-zoom img { transition: transform 900ms var(--fx-ease); }
  .fx-zoom:hover img { transform: scale(1.04); }
}
a.fx-btn:active, .btn-p:active, .btn-o:active { transform: scale(0.97); }
header nav a { position: relative; }
@media (hover: hover) {
  header nav a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
    background: var(--fx-brand); transform: scaleX(0); transform-origin: left;
    transition: transform 300ms var(--fx-ease);
  }
  header nav a:hover::after { transform: scaleX(1); }
}

/* ---------- Hero entrance (only when JS is running) ---------- */
@keyframes fx-rise { from { opacity: 0; transform: translateY(var(--fx-shift)); } to { opacity: 1; transform: none; } }
@keyframes fx-reveal-img { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes fx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.fx-js .fx-hero-item { animation: fx-rise var(--fx-dur) var(--fx-ease) both; animation-delay: calc(var(--fx-i, 0) * 90ms + 120ms); }
.fx-js .fx-hero-media img { animation: fx-reveal-img 1200ms var(--fx-ease) both 200ms; }
.fx-js .fx-float { animation: fx-float 6s ease-in-out infinite; animation-delay: calc(var(--fx-i, 0) * -2s); }

/* ---------- Scroll reveal ---------- */
.fx-js .fx-reveal {
  opacity: 0; transform: translateY(var(--fx-shift));
  transition: opacity var(--fx-dur) var(--fx-ease), transform var(--fx-dur) var(--fx-ease);
  transition-delay: calc(var(--fx-i, 0) * var(--fx-stagger));
}
.fx-js .fx-reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Mobile menu ---------- */
.fx-menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 14px;
  background: #fff; color: var(--fx-ink); cursor: pointer; padding: 0;
}
.fx-menu-btn span, .fx-menu-btn span::before, .fx-menu-btn span::after {
  display: block; width: 20px; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform 300ms var(--fx-ease), opacity 200ms ease; position: relative;
}
.fx-menu-btn span::before, .fx-menu-btn span::after { content: ""; position: absolute; left: 0; }
.fx-menu-btn span::before { top: -6px; }
.fx-menu-btn span::after { top: 6px; }
.fx-menu-btn[aria-expanded="true"] span { background: transparent; }
.fx-menu-btn[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.fx-menu-btn[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Mobile layout ---------- */
@media (max-width: 900px) {
  .fx-menu-btn { display: inline-flex; }
  header > div { flex-wrap: nowrap !important; padding-top: 10px !important; padding-bottom: 10px !important; gap: 12px !important; }
  header:not([style*="sticky"]) { position: relative; z-index: 20; }
  /* :not(#id) lifts specificity above site rules like .mm-hide-sm{display:none!important} */
  header nav:not(#fx-never) {
    display: flex !important;
    position: absolute !important; top: 100%; left: 0; right: 0;
    flex-direction: column !important; flex-wrap: nowrap !important; gap: 0 !important; align-items: stretch !important;
    background: #fff; padding: 8px 20px 18px !important;
    box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.35); border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 260ms var(--fx-ease), transform 260ms var(--fx-ease), visibility 0s linear 260ms;
  }
  header.menu-open nav:not(#fx-never) { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  header nav a {
    display: flex !important; align-items: center; min-height: 48px;
    font-size: 17px !important; border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important; padding: 0 !important;
  }
  header nav a:last-child { border-bottom: 0 !important; }
  header nav a::after { display: none; }
  .fx-header-cta { display: none !important; }
}

@media (max-width: 640px) {
  :root { --fx-shift: 16px; }
  section > div, section, footer > div { padding-left: 20px !important; padding-right: 20px !important; }
  [style*="flex: 1 1"] { flex-basis: 100% !important; }
  [style*="grid-template-columns: repeat(auto-fit, minmax(2"], [style*="grid-template-columns: repeat(auto-fit, minmax(3"] {
    grid-template-columns: 1fr !important;
  }
  [style*="height: 460px"], [style*="height: 480px"], [style*="height: 520px"] { height: 300px !important; }
  a[href^="tel:"], a[href^="mailto:"], a[href*="wa.me"], a[href*="instagram"], a[href*="facebook"], footer a { min-height: 44px; display: inline-flex; align-items: center; }
  article[style*="min-height"] { min-height: 0 !important; }
  [role="img"][style*="height: 200px"] {
    width: 72px !important; height: 72px !important; border-radius: 50%;
    margin: 22px 0 0 22px; font-size: 26px !important; flex: none;
  }
  h1 { overflow-wrap: break-word; hyphens: manual; }
  .fx-mobile-call {
    position: fixed; z-index: 30; left: 16px; right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: flex !important; align-items: center; justify-content: center; gap: 10px;
    min-height: 52px; border-radius: 999px; background: var(--fx-brand); color: #fff !important;
    font-weight: 700; font-size: 16px; text-decoration: none; box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.5);
    transform: translateY(140%); transition: transform 400ms var(--fx-ease);
  }
  .fx-mobile-call.is-shown { transform: none; }
  body { padding-bottom: 84px; }
}
.fx-mobile-call { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fx-js .fx-reveal { opacity: 1; transform: none; }
}
