:root {
  --site-header-height: 5.25rem;
}

html {
  scroll-padding-top: calc(var(--site-header-height) + 1rem);
}

body {
  overflow-x: clip;
}

[id] {
  scroll-margin-top: calc(var(--site-header-height) + 1rem);
}

h1,
h2,
h3,
blockquote {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

button,
.motion-button,
.testimonial-control,
.gallery-expand {
  min-height: 2.75rem;
  min-width: 2.75rem;
  touch-action: manipulation;
}

.reactive-photo-stage img,
.clinic-gallery-item img,
.lightbox-image {
  backface-visibility: hidden;
}

.testimonials-rail {
  scroll-padding-inline: 1.25rem;
}

/* Abertura aprovada: texto e fotografia em blocos independentes. */
.hero-image {
  object-position: 52% 48%;
}

.hero-quote {
  border: 1px solid rgba(96, 64, 46, 0.08);
}

/* Mantém a legenda abaixo da moldura e impede que a frase quebre. */
.sobre-caption {
  z-index: 20;
  max-width: 52% !important;
  padding: 0.75rem 1.25rem 0.25rem 0;
  background: #60402e;
  line-height: 1.85 !important;
  white-space: nowrap;
}

/* O CTA mantém a largura do conteúdo em telas estreitas. */
.specialties-cta-row .motion-button {
  align-self: flex-start;
  flex: none;
  width: auto;
  max-width: 100%;
}

.clinic-gallery-item:nth-child(1) img {
  object-position: 50% 52%;
}

.clinic-gallery-item:nth-child(2) img {
  object-position: 62% 50%;
}

.clinic-gallery-item:nth-child(3) img {
  object-position: 50% 72%;
}

.clinic-gallery-item:nth-child(4) img {
  object-position: 50% 50%;
}

@media (width <= 639px) {
  :root {
    --site-header-height: 5.25rem;
  }

  #inicio > section > div:first-child {
    padding-top: 3.5rem;
    padding-bottom: 3.25rem;
  }

  #inicio h1 {
    max-width: 11.5ch;
    font-size: clamp(3.75rem, 18vw, 4.5rem);
    line-height: 0.84;
    letter-spacing: -0.052em;
  }

  #inicio h1 + div {
    margin-top: 2rem;
    padding-left: 1.25rem;
  }

  #inicio h1 + div p {
    line-height: 1.75;
  }

  #inicio > section > div:last-child {
    min-height: clamp(33rem, 145vw, 38rem);
  }

  .hero-image {
    object-position: 50% 50%;
  }

  .hero-quote {
    max-width: min(17rem, calc(100% - 2.5rem)) !important;
  }

  .sobre-caption {
    bottom: 0.5rem !important;
    max-width: 58% !important;
    padding-right: 0.65rem;
    font-size: 0.58rem !important;
    letter-spacing: 0.13em !important;
  }

  .specialties-cta-row .motion-button {
    max-width: calc(100vw - 2.5rem);
  }

  .kinetic-trace-b {
    display: none;
  }

  .reactive-photo-stage {
    will-change: auto;
  }

  .testimonials-rail {
    scroll-padding-inline: 1.25rem;
  }
}

@media (width >= 640px) and (width <= 1023px) {
  #inicio > section > div:first-child {
    padding-top: 5rem;
    padding-bottom: 4.5rem;
  }

  #inicio > section > div:last-child {
    min-height: 46rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .testimonials-rail {
    scroll-behavior: auto;
  }
}
