/* ==========================================================================
   Medi4u design system — base layer
   Palette is taken from the logo (teal #009688 + orange #f05a22) on warm paper.
   Shared by the home page and (via m4-inner.css) service / product pages.
   ========================================================================== */

:root {
  --ink: #0a2326;
  --ink-2: #103539;
  --ink-3: #1b4a4f;
  --teal: #009688;
  --teal-d: #00776c;
  --teal-b: #36c9b6;
  --teal-l: #cfece7;
  --teal-50: #eaf6f4;
  --orange: #f05a22;
  --orange-d: #c7400d;
  --orange-50: #feeee6;
  --paper: #f6f3ec;
  --paper-2: #ece7da;
  --card: #ffffff;
  --line: #e0dac9;
  --line-d: rgba(255, 255, 255, 0.12);
  --text: #1c2b2e;
  --muted: #566468;
  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --sh-1: 0 1px 2px rgba(10, 35, 38, 0.05), 0 8px 24px -12px rgba(10, 35, 38, 0.14);
  --sh-2: 0 2px 6px rgba(10, 35, 38, 0.06), 0 30px 60px -26px rgba(10, 35, 38, 0.32);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 72px;
  --gut: clamp(20px, 4vw, 56px);
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body.m4 {
  margin: 0;
  padding-top: var(--nav-h);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.m4.m4-menu-open { overflow: hidden; }
.m4 *, .m4 *::before, .m4 *::after { box-sizing: border-box; }
:where(.m4) img { max-width: 100%; height: auto; }
:where(.m4) a { color: inherit; }
:where(.m4) :is(h1, h2, h3, h4, h5, h6) { margin: 0; font-weight: 600; }
:where(.m4) p { margin: 0; }
.m4 ::selection { background: var(--teal); color: #fff; }
.m4 :focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 6px; }

.m4 .container { max-width: 1240px; padding-left: var(--gut); padding-right: var(--gut); }
.m4-skip { position: fixed; left: 12px; top: -80px; z-index: 3000; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; text-decoration: none; transition: top .2s; }
.m4-skip:focus { top: 12px; }

/* ---------- scroll progress ---------- */
.m4-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1100; pointer-events: none; }
.m4-progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--teal), var(--orange)); }

/* ---------- header ---------- */
.m4-header {
  position: fixed; inset: 0 0 auto 0; z-index: 1000; height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
/* blur lives on a pseudo-element: a filter on the header itself would trap the fixed mobile menu inside it */
.m4-header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(246, 243, 236, .86); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); transition: background .3s; }
.m4-header.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 30px -22px rgba(10, 35, 38, .45); }
.m4-header.is-scrolled::before { background: rgba(246, 243, 236, .94); }
.m4-nav { height: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: center; gap: 28px; }
.m4-logo { flex-shrink: 0; display: block; line-height: 0; }
.m4-logo img { width: 150px; height: auto; display: block; transition: width .3s var(--ease); }
.m4-header.is-scrolled .m4-logo img { width: 134px; }
.m4-menu { list-style: none; margin: 0 auto 0 12px; padding: 0; display: flex; align-items: center; gap: 2px; }
.m4-item { position: relative; }
.m4-link {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 999px;
  font-size: .92rem; font-weight: 500; color: var(--ink); text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s;
}
.m4-link:hover, .m4-link.is-active { background: var(--paper-2); color: var(--ink); }
.m4-link .fa-chevron-down { font-size: .6rem; opacity: .6; transition: transform .25s var(--ease); }
.m4-has-dd:hover .fa-chevron-down, .m4-has-dd:focus-within .fa-chevron-down, .m4-has-dd.open .fa-chevron-down { transform: rotate(180deg); }

.medi-dropdown {
  position: absolute; top: calc(100% + 6px); left: -8px; min-width: 300px; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-2);
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s; z-index: 50;
}
.m4-has-dd::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; }
.m4-has-dd:hover > .medi-dropdown, .m4-has-dd:focus-within > .medi-dropdown { opacity: 1; visibility: visible; transform: none; }
.medi-dropdown-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; transition: background .15s; }
.medi-dropdown-item:hover { background: var(--teal-50); }
.mdi-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px;
  background: var(--teal-50) !important; color: var(--teal-d); transition: background .2s, color .2s; }
.medi-dropdown-item:hover .mdi-icon { background: var(--teal) !important; color: #fff; }
.mdi-name { font-size: .9rem; font-weight: 600; color: var(--ink); line-height: 1.25; }
.mdi-sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }

.m4-nav-cta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.m4-burger { display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 0; cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.m4-burger .m4-bar { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
.m4-burger.active .m4-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.m4-burger.active .m4-bar:nth-child(2) { opacity: 0; }
.m4-burger.active .m4-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- buttons ---------- */
.m4-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; height: 48px;
  border-radius: 999px; border: 1.5px solid transparent; font-family: var(--f-body); font-size: .95rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1;
  transition: background .25s var(--ease), color .25s, border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.m4-btn i { font-size: .8em; transition: transform .25s var(--ease); }
.m4-btn:hover i.fa-arrow-right { transform: translateX(4px); }
.m4-btn:active { transform: translateY(1px); }
.m4-btn-sm { height: 42px; padding: 0 18px; font-size: .88rem; }
.m4-btn-ink { background: var(--ink); color: #fff; }
.m4-btn-ink:hover { background: var(--teal-d); color: #fff; box-shadow: 0 14px 28px -14px rgba(0, 119, 108, .8); }
.m4-btn-orange { background: var(--orange-d); color: #fff; }
.m4-btn-orange:hover { background: var(--orange); color: #fff; box-shadow: 0 14px 28px -14px rgba(240, 90, 34, .9); }
.m4-btn-ghost { background: transparent; color: var(--ink); border-color: rgba(10, 35, 38, .28); }
.m4-btn-ghost:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.m4-btn-light { background: #fff; color: var(--ink); }
.m4-btn-light:hover { background: var(--ink); color: #fff; }
.m4-btn-ghost-l { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.m4-btn-ghost-l:hover { background: #fff; color: var(--ink); border-color: #fff; }

/* ---------- section head (applied to the existing .text-center.mb-5 blocks) ---------- */
.m4-head { text-align: left !important; margin-bottom: clamp(32px, 5vw, 56px) !important;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); column-gap: clamp(32px, 6vw, 96px); row-gap: 14px; align-items: end; }
.m4-head > :first-child {
  grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 12px; width: fit-content;
  font-family: var(--f-mono); font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--teal-d) !important; background: none !important; padding: 0 !important; border-radius: 0 !important; border: 0 !important; margin: 0 !important;
}
.m4-head > :first-child::before { content: ""; width: 26px; height: 2px; background: var(--orange); border-radius: 2px; }
.m4-head h2, .m4-head h3 {
  font-family: var(--f-display) !important; font-weight: 600 !important; color: var(--ink) !important; margin: 0 !important;
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3.2rem) !important; line-height: 1.08 !important; letter-spacing: -.022em; font-optical-sizing: auto;
  text-wrap: balance;
}
.m4-head h2 br { display: none; }
.m4-head > p {
  color: var(--muted) !important; font-size: 1.05rem !important; line-height: 1.7 !important; max-width: none !important; margin: 0 !important; text-align: left !important; padding-bottom: 6px;
}
.m4-dark .m4-head h2, .m4-dark .m4-head h3 { color: #fff !important; }
.m4-dark .m4-head > :first-child { color: var(--teal-b) !important; }
.m4-dark .m4-head > p { color: rgba(255, 255, 255, .72) !important; }
@media (max-width: 860px) { .m4-head { grid-template-columns: 1fr; } .m4-head > p { padding-bottom: 0; } }

/* ---------- reveal on scroll (classes added by m4.js, only below the fold) ---------- */
.m4-reveal { opacity: 0; }
.m4-reveal.is-in { opacity: 1; animation: m4-in .85s var(--ease-out) var(--rd, 0s) backwards; }
@keyframes m4-in { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes m4-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes m4-fade { from { opacity: 0; } to { opacity: 1; } }

/* spotlight hover: m4.js feeds --mx / --my */
.m4-spot { position: relative; isolation: isolate; }
.m4-spot::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(0, 150, 136, .11), transparent 60%);
}
.m4-spot:hover::before { opacity: 1; }

/* ---------- floating widgets ---------- */
.whatsapp-float {
  position: fixed; right: 20px; bottom: 100px; z-index: 900; width: 56px; height: 56px; border-radius: 50%;
  background: #1fa855; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; text-decoration: none;
  box-shadow: 0 12px 28px -8px rgba(31, 168, 85, .7); transition: transform .3s var(--ease), box-shadow .3s;
}
.whatsapp-float::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #1fa855; animation: m4-ping 2.6s ease-out infinite; }
.whatsapp-float:hover { transform: scale(1.08); color: #fff; }
@keyframes m4-ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }

.m4-sticky { display: none; }
@media (max-width: 767px) {
  .m4-sticky {
    display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
    padding: 10px 92px calc(10px + env(safe-area-inset-bottom)) 14px; background: rgba(246, 243, 236, .96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); transform: translateY(110%); transition: transform .4s var(--ease-out);
  }
  .m4-sticky.is-on { transform: none; }
  .m4-sticky .m4-btn { height: 46px; }
  .whatsapp-float { bottom: 100px; right: 20px; width: 52px; height: 52px; font-size: 26px; }
  body.m4 { padding-bottom: 66px; }
}

/* ---------- contact popup ---------- */
.contact-popup-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 35, 38, .62); backdrop-filter: blur(6px); animation: m4-fade .3s ease; }
.contact-popup-overlay.hidden { display: none; }
@keyframes m4-fade { from { opacity: 0; } to { opacity: 1; } }
.contact-popup { position: relative; width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto; background: var(--paper); border-radius: 26px; padding: 40px; box-shadow: var(--sh-2); animation: m4-pop .45s var(--ease-out); }
.contact-popup::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: linear-gradient(90deg, var(--teal), var(--orange)); border-radius: 26px 26px 0 0; }
@keyframes m4-pop { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.popup-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s, transform .3s var(--ease); }
.popup-close:hover { background: var(--ink); color: #fff; transform: rotate(90deg); }
.contact-popup .form-header { text-align: left; margin-bottom: 24px; padding-right: 40px; }
.contact-popup .form-header h3 { font-family: var(--f-display); font-size: 1.85rem; letter-spacing: -.02em; color: var(--ink); }
.contact-popup .form-header p { color: var(--muted); margin-top: 6px; font-size: .95rem; }
@media (max-width: 640px) { .contact-popup { padding: 28px 20px; } }

/* ---------- forms (home contact + popup) ---------- */
.m4 .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.m4 .form-group.full-width { grid-column: 1 / -1; }
.m4 .input-wrapper { position: relative; display: flex; flex-direction: column-reverse; }
.m4 .input-wrapper label { font-family: var(--f-mono); font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 2px; }
.m4 .input-wrapper input, .m4 .input-wrapper textarea {
  width: 100%; padding: 14px 14px 14px 44px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink);
  font-family: var(--f-body); font-size: .95rem; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.m4 .input-wrapper input::placeholder, .m4 .input-wrapper textarea::placeholder { color: #8b979a; }
.m4 .input-wrapper input:focus, .m4 .input-wrapper textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 150, 136, .14); }
.m4 .input-wrapper .input-icon { position: absolute; left: 16px; bottom: 0; height: 51px; display: flex; align-items: center; color: var(--teal-d); font-size: .9rem; pointer-events: none; }
.m4 .input-wrapper textarea ~ .input-icon, .m4 .input-wrapper:has(textarea) .input-icon { bottom: auto; top: 28px; height: auto; }
.m4 .btn-submit {
  width: 100%; margin-top: 18px; height: 54px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-family: var(--f-body); font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer; transition: background .25s, box-shadow .25s, transform .25s;
}
.m4 .btn-submit i { transition: transform .3s var(--ease); }
.m4 .btn-submit:hover { background: var(--orange-d); box-shadow: 0 16px 30px -14px rgba(240, 90, 34, .9); }
.m4 .btn-submit:hover i { transform: translate(3px, -3px); }
@media (max-width: 640px) { .m4 .form-grid { grid-template-columns: 1fr; } }

/* ---------- footer (home + inner pages) ---------- */
.m4 .modern-footer { position: relative; background: var(--ink); color: rgba(255, 255, 255, .7); padding: clamp(56px, 7vw, 88px) 0 0; margin: 0; overflow: hidden; }
.m4 .modern-footer::before { content: ""; position: absolute; width: 640px; height: 640px; right: -220px; top: -320px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 150, 136, .28), transparent 65%); pointer-events: none; }
.m4 .modern-footer .footer-background, .m4 .modern-footer .footer-overlay { display: none; }
.m4 .modern-footer .container { position: relative; z-index: 1; }
.m4 .footer-logo { width: 168px; height: auto; background: #fff; padding: 10px 14px; border-radius: 14px; margin-bottom: 20px; display: block; }
.m4 .footer-description { color: rgba(255, 255, 255, .66); font-size: .93rem; line-height: 1.75; max-width: 42ch; margin: 0 0 18px; }
.m4 .footer-title { font-family: var(--f-mono); font-size: .72rem !important; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-b) !important; margin: 0 0 20px !important; }
.m4 .footer-menu { list-style: none; margin: 0; padding: 0; }
.m4 .footer-menu li { margin-bottom: 10px; }
.m4 .footer-menu a { color: rgba(255, 255, 255, .72); text-decoration: none; font-size: .92rem; background: linear-gradient(var(--orange), var(--orange)) 0 100% / 0 1px no-repeat; transition: color .2s, background-size .3s var(--ease); padding-bottom: 2px; }
.m4 .footer-menu a:hover { color: #fff; background-size: 100% 1px; }
.m4 .contact-info .contact-item, .m4 .modern-footer .contact-item { display: flex; align-items: flex-start; gap: 12px; color: rgba(255, 255, 255, .78); font-size: .92rem; margin-bottom: 12px; }
.m4 .modern-footer .contact-item i { width: 18px; margin: 4px 0 0; color: var(--teal-b); text-align: center; }
.m4 .footer-contact a { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 600; font-size: .92rem; border: 1px solid var(--line-d); padding: 10px 16px; border-radius: 999px; transition: background .25s, border-color .25s; }
.m4 .footer-contact a:hover { background: #1fa855; border-color: #1fa855; }
.m4 .modern-footer .social-links { display: none; }
.m4 .modern-footer .container > div:not(.row):not(.footer-parent):not(.footer-bottom) { margin-top: 12px; padding: 22px 0 0; border-top: 1px solid var(--line-d); }
.m4 .modern-footer .container > div:not(.row):not(.footer-parent):not(.footer-bottom) p { color: rgba(255, 255, 255, .42) !important; font-size: .74rem !important; line-height: 1.9; text-align: left !important; margin: 0; }
.m4 .footer-parent { margin-top: 28px !important; border-radius: 20px !important; border-color: var(--line-d) !important; background: rgba(255, 255, 255, .04) !important; }
.m4 .footer-parent .fp-name { font-family: var(--f-display); font-weight: 600; letter-spacing: -.01em; }
.m4 .footer-bottom { border-top: 1px solid var(--line-d); margin-top: 32px; padding: 22px 0 26px; }
.m4 .footer-bottom .copyright, .m4 .footer-bottom .powered-by { color: rgba(255, 255, 255, .5); font-size: .82rem; margin: 0; }
.m4 .footer-bottom .powered-by .highlight { color: var(--teal-b); }

/* ---------- responsive nav ---------- */
@media (max-width: 991px) {
  .m4-burger { display: flex; margin-left: auto; }
  .m4-nav-cta { display: none; }
  .m4-menu {
    position: fixed; inset: var(--nav-h) 0 0 0; margin: 0; padding: 16px var(--gut) 120px; flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--paper); overflow-y: auto; opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s; z-index: 999;
  }
  .m4-menu.is-open { opacity: 1; visibility: visible; transform: none; }
  .m4-link { height: 54px; padding: 0 6px; font-family: var(--f-display); font-size: 1.5rem; font-weight: 500; border-radius: 0; border-bottom: 1px solid var(--line); width: 100%; justify-content: space-between; background: none !important; }
  .m4-has-dd::after { display: none; }
  .medi-dropdown { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; border-radius: 0; padding: 0; min-width: 0; background: transparent; display: none; }
  .m4-has-dd.open > .medi-dropdown { display: block; padding: 8px 0 14px; }
  .m4-menu .m4-menu-cta { display: block; margin-top: 18px; }
}
@media (min-width: 992px) { .m4-menu .m4-menu-cta { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .m4-reveal { opacity: 1; }
}
