/* ================================================================
   REFINE — the final UI layer.
   Loaded last, so it has the final say.

   Three problems this fixes:
   1. NO HIERARCHY. Every section was ~700-1000px and shouted at the
      same volume, so nothing landed. Now the page has cadence:
      sections breathe differently, and the important ones dominate.
   2. NO TYPE SCALE. Sizes were ad-hoc. Now there is a real ratio,
      with fluid clamp() so it holds from 360px to 1600px.
   3. CONTACT WAS BURIED. A sticky action bar keeps Call / WhatsApp /
      Book one tap away, always.
================================================================ */

:root {
  /* ── Type scale (1.25 minor third, fluid) ───────────────────── */
  --t-xs:   clamp(11px, 0.68rem + 0.1vw, 12.5px);
  --t-sm:   clamp(13px, 0.8rem  + 0.15vw, 14.5px);
  --t-base: clamp(15px, 0.92rem + 0.2vw,  17px);
  --t-lg:   clamp(18px, 1.05rem + 0.35vw, 21px);
  --t-xl:   clamp(22px, 1.2rem  + 0.9vw,  30px);
  --t-2xl:  clamp(28px, 1.4rem  + 1.9vw,  44px);
  --t-3xl:  clamp(34px, 1.6rem  + 3.2vw,  64px);

  /* ── Spacing rhythm ─────────────────────────────────────────── */
  --sp-section:   clamp(64px, 7vw, 110px);   /* standard */
  --sp-section-l: clamp(80px, 9vw, 140px);   /* hero-adjacent, breathing */
  --sp-section-s: clamp(48px, 5vw, 72px);    /* tight, supporting */

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── BASE TYPOGRAPHY ─────────────────────────────────────────── */
body {
  font-size: var(--t-base);
  line-height: 1.65;
  letter-spacing: -0.003em;
  text-rendering: optimizeLegibility;
}

/* Headlines: tighter as they get bigger — the mark of real typesetting */
.hero-h1 {
  font-size: var(--t-3xl);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 500;
}
.section-title, .intro-h2 {
  font-size: var(--t-2xl);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.bento-h3, .svc-index-title, .pillar-h3 {
  font-size: var(--t-lg);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

/* Measure: never let body text run wider than ~68 characters */
.section-sub, .intro-p, .bento-p, .svc-index-sub,
.pillar-p, .faq-item p, .ns-step p {
  max-width: 62ch;
}

/* ── SECTION RHYTHM ──────────────────────────────────────────── */
/* Not every section deserves equal weight. Supporting sections are
   tightened so the important ones (services, booking) can dominate. */
section { padding-block: var(--sp-section); }

.intro        { padding-block: var(--sp-section-l); }   /* first impression: breathe */
.services     { padding-block: var(--sp-section-l); }   /* the main event */
.booking      { padding-block: var(--sp-section-l); }   /* the conversion */

.pillars      { padding-block: var(--sp-section-s); }   /* supporting */
.gallery      { padding-block: var(--sp-section-s); }
.downloads    { padding-block: var(--sp-section-s); }
.testimonials { padding-block: var(--sp-section-s); }

/* Section heads: consistent, generous */
.section-head { margin-bottom: clamp(36px, 4vw, 60px); }

/* ── SERVICES: tighten the bloat (was 2118px) ────────────────── */
.svc-featured { gap: clamp(16px, 1.6vw, 24px); margin-bottom: clamp(40px, 5vw, 68px); }
.svc-card-img { aspect-ratio: 3 / 2; }             /* was 16/10 — shorter */
.svc-card-body { padding: clamp(20px, 2vw, 26px); gap: 8px; }
.svc-card { border-radius: var(--r-md); }

/* Cards lift on hover with a real, physical easing */
.svc-card, .review-card, .dl-card {
  transition: transform .35s var(--ease),
              box-shadow .35s var(--ease),
              border-color .25s var(--ease);
  will-change: transform;
}
.svc-card:hover { transform: translateY(-5px); }

/* Service index: calmer, tighter */
.svc-index { padding: clamp(28px, 3.2vw, 44px); border-radius: var(--r-md); }
.svc-list  { gap: clamp(20px, 2.4vw, 30px) clamp(24px, 3vw, 40px); }

/* ── STICKY ACTION BAR ───────────────────────────────────────── */
.action-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 400;
  display: none;                     /* mobile only — see media query */
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 28px rgba(62,31,51,0.10);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  gap: 6px;
}
.action-btn {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 9px 4px;
  border-radius: var(--r-sm);
  text-decoration: none;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: background .2s var(--ease), transform .12s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.action-btn:active { transform: scale(0.95); }
.action-btn svg { width: 21px; height: 21px; }

.action-call { color: var(--plum); }
.action-call:hover, .action-call:active { background: var(--plum-light); }

.action-wa   { color: #128C7E; }
.action-wa:hover, .action-wa:active { background: #e7f6f2; }

.action-book {
  background: var(--teal);
  color: #fff;
}
.action-book:hover, .action-book:active { background: var(--teal-dark); }

@media (max-width: 820px) {
  .action-bar { display: flex; }
  body { padding-bottom: 74px; }        /* never let the bar cover content */
  .wa-fab { bottom: 88px; }             /* lift the FAB above the bar */
}

/* ── HERO: make it earn its 836px ────────────────────────────── */
.hero-veil {
  background:
    radial-gradient(120% 80% at 20% 30%, rgba(44,21,36,0.30) 0%, transparent 60%),
    linear-gradient(180deg, rgba(44,21,36,0.42) 0%, rgba(44,21,36,0.20) 40%, rgba(44,21,36,0.78) 100%);
}
.hero-sub { font-size: var(--t-lg); line-height: 1.5; max-width: 34ch; opacity: 0.94; }

/* Hero buttons: chunkier tap targets, real motion */
.btn-hero-primary, .btn-hero-ghost {
  padding: 15px 30px;
  font-size: var(--t-sm);
  border-radius: var(--r-sm);
  transition: transform .2s var(--ease), background .2s var(--ease), box-shadow .25s var(--ease);
}
.btn-hero-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15,122,110,0.32); }
.btn-hero-ghost:hover   { transform: translateY(-2px); }

/* ── BUTTONS & FOCUS (accessibility) ─────────────────────────── */
.nav-cta, .form-btn { transition: transform .2s var(--ease), background .2s var(--ease), box-shadow .25s var(--ease); }
.nav-cta:hover, .form-btn:hover:not(:disabled) { transform: translateY(-1px); }

/* Visible keyboard focus everywhere — this was missing entirely */
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, .cal-day:focus-visible {
  outline: 2.5px solid var(--teal);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── FORMS: bigger targets, calmer ───────────────────────────── */
.form-input { padding: 13px 15px; font-size: var(--t-sm); border-radius: var(--r-sm); }
.form-btn   { padding: 15px 22px; font-size: var(--t-sm); font-weight: 600; }

/* Calendar: make days properly tappable (44px = Apple's minimum) */
.cal-day {
  min-height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.cal-day.available { cursor: pointer; }
.slot { padding: 11px 8px; border-radius: var(--r-sm); transition: all .18s var(--ease); }

/* ── FAQ ─────────────────────────────────────────────────────── */
.faq-item summary { padding-block: 20px; font-size: var(--t-lg); }
.faq-item p { font-size: var(--t-sm); }

/* ── GALLERY: subtle, not shouty ─────────────────────────────── */
.gallery-item { overflow: hidden; border-radius: var(--r-md); }
.gallery-item img { transition: transform .6s var(--ease); }
.gallery-item:hover img { transform: scale(1.045); }

/* ── REVEAL: gentler, less jumpy ─────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.visible { opacity: 1; transform: none; }

/* ── FOOTER ──────────────────────────────────────────────────── */
footer { padding-block: clamp(48px, 5vw, 72px) 28px; }

/* ── MOTION SAFETY ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ── SMALL SCREENS ───────────────────────────────────────────── */
@media (max-width: 560px) {
  :root { --gutter: 20px; }
  .hero-sub { max-width: 100%; }
  .svc-card-img { aspect-ratio: 16 / 10; }
  .section-head { margin-bottom: 28px; }
}

/* ================================================================
   SERVICES GRID — the real fix.
   The section was 2,200px because 4 cards sat in a 2-column grid
   (2 rows x 581px) with 346px-tall images. Going to 4 columns on
   wide screens, with shorter images, roughly halves the section
   without losing a single service.
================================================================ */
.svc-featured {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.svc-card-img { aspect-ratio: 4 / 3; }
.svc-card-body { padding: 18px 18px 20px; }
.svc-card-body .bento-p { font-size: var(--t-sm); line-height: 1.55; }
.svc-link { font-size: var(--t-xs); }
.bento-chip { font-size: 10px; padding: 4px 9px; }

/* Service index: 3 across is plenty */
.svc-list { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1100px) {
  .svc-featured { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .svc-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .svc-featured { grid-template-columns: 1fr; }
  .svc-list     { grid-template-columns: 1fr; }
  .svc-card-img { aspect-ratio: 16 / 9; }
}

/* ================================================================
   FINAL RHYTHM PASS
   A clinic site with ten real sections is legitimately long — the
   answer is not to crush the content, it is to make the length
   navigable and give the page a cadence. Supporting sections get
   tightened; the two that convert (services, booking) keep their air.
================================================================ */

/* Downloads is a utility strip, not a destination — compress it hard */
.downloads { padding-block: clamp(36px, 3.5vw, 52px); }
.downloads .section-head { margin-bottom: 24px; }
.dl-grid { gap: 14px; }
.dl-card { padding: 16px 18px; }

/* Intro & about: trim without starving them */
.intro { padding-block: clamp(60px, 6vw, 92px); }
.about { padding-block: clamp(60px, 6vw, 92px); }

/* Contact: the map does the talking, the header can be smaller */
.contact { padding-block: clamp(60px, 6vw, 92px); }

/* ── SCROLL PROGRESS ─────────────────────────────────────────
   A long page needs to tell you where you are. A 2px teal line
   under the nav is enough — quiet, but it removes the "how much
   more is there?" anxiety.                                      */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--teal-bright));
  z-index: 1000;
  transition: width .1s linear;
  pointer-events: none;
}

/* ── SECTION TRANSITIONS ─────────────────────────────────────
   Hairlines between light sections so they read as distinct
   panels rather than one undifferentiated scroll.              */
.services, .gallery, .faq, .downloads { border-top: 1px solid var(--line-warm); }

/* ================================================================
   TAP TARGETS
   An audit found 40 interactive elements under 32px. On a phone
   that means mis-taps — and a mis-tap on a booking form is a lost
   patient. WCAG asks for 24px minimum; Apple recommends 44px.
   These are the ones that actually get touched.
================================================================ */
@media (max-width: 820px) {
  .nav-drawer a,
  .footer-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .cal-day {
    min-height: 44px;
    min-width: 40px;
    font-size: var(--t-sm);
  }
  .slot { min-height: 44px; padding: 12px 10px; }
  .faq-item summary { min-height: 48px; }
  .form-input { min-height: 46px; }   /* iOS also stops zooming at 16px */
  .form-btn   { min-height: 50px; }
}

/* iOS zooms the page if an input's font-size is under 16px.
   This single line prevents that jarring zoom on focus. */
@media (max-width: 820px) {
  .form-input, select.form-input, textarea.form-input { font-size: 16px; }
}
