/* ==========================================================================
   Dr. Wando de Almeida — Odontologia
   1. Tokens  2. Base  3. Componentes  4. Seções  5. Modos de animação  6. Mídia
   ========================================================================== */

/* 1. Tokens */
:root {
  --paper: #F7F4EE;
  --ivory: #FCFBF8;
  --sand: #E9E2D5;
  --line: #D8CFBF;
  --ink: #1C2621;
  --muted: #5B635C;
  --forest: #1F3229;
  --forest-deep: #15231C;
  --on-dark: #F7F4EE;
  --on-dark-muted: #BDC4B8;
  --line-dark: rgba(247, 244, 238, .2);
  --gold: #C4A878;
  --gold-text: #7D6841;
  --danger: #8C3B2E;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 4vw, 64px);
  --space-section: clamp(96px, 15vw, 220px);
  --header-h: 76px;
  --ease: cubic-bezier(.19, 1, .22, 1);
}

/* 2. Base */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

body.menu-open { overflow: hidden; }

img, svg { display: block; }
img { max-width: 100%; height: auto; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
em { font-style: italic; }

:focus-visible {
  outline: 2px solid var(--gold-text);
  outline-offset: 3px;
}

.esp :focus-visible,
.hero :focus-visible,
.cta :focus-visible,
.header.is-top :focus-visible,
.header.is-dark :focus-visible { outline-color: var(--gold); }

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--on-dark);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

.wrap {
  width: 100%;
  max-width: 1760px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* 3. Componentes */
.display {
  font-family: var(--serif);
  font-weight: 300;
  font-optical-sizing: auto;
  font-size: clamp(2.6rem, 6.2vw, 6.75rem);
  line-height: 1.04;
  letter-spacing: -.022em;
  text-wrap: balance;
}
.display em { font-weight: 200; }

.eyebrow {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.eyebrow--light { color: var(--gold); }

.frame { overflow: hidden; background: var(--sand); }
.frame img { width: 100%; height: 100%; object-fit: cover; }

.btn {
  --btn-bg: transparent;
  --btn-fg: currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 500 .95rem/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease);
}
.btn--light { --btn-bg: var(--paper); --btn-fg: var(--ink); }
.btn--light:hover { --btn-bg: var(--gold); }
.btn--solid { --btn-bg: var(--forest); --btn-fg: var(--on-dark); }
.btn--solid:hover { --btn-bg: var(--forest-deep); }

.btn__icon { width: 18px; height: 18px; flex: none; }
.btn__icon--arrow { width: 22px; height: 22px; transition: transform .7s var(--ease); }
.btn:hover .btn__icon--arrow,
.card__link:hover .btn__icon--arrow { transform: translateX(5px); }

/* Troca delicada do rótulo: o texto sobe e uma cópia entra por baixo. */
.btn__label {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding-block: .2em;
}
.btn__label > span { display: block; transition: transform .7s var(--ease); }
.btn__label::after {
  content: attr(data-text);
  position: absolute;
  top: 100%;
  left: 0;
  padding-block: .2em;
  transition: transform .7s var(--ease);
}
.btn:hover .btn__label > span { transform: translateY(-140%); }
.btn:hover .btn__label::after { transform: translateY(-100%); }

.link {
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 3px;
  transition: background-size .7s var(--ease);
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* Header */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  color: var(--ink);
  transition: color .5s var(--ease), background-color .5s var(--ease), border-color .5s var(--ease);
  background: rgba(247, 244, 238, .9);
  border-bottom: 1px solid rgba(28, 38, 33, .08);
}
@supports (backdrop-filter: blur(10px)) {
  .header { background: rgba(247, 244, 238, .78); backdrop-filter: blur(14px); }
}
.js .header.is-top {
  color: var(--on-dark);
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
}
.header.is-dark {
  color: var(--on-dark);
  background: rgba(21, 35, 28, .72);
  border-color: var(--line-dark);
}
.header.menu-active {
  color: var(--ink);
  background: transparent;
  border-color: transparent;
  backdrop-filter: none;
}

.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  max-width: 1760px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand { display: inline-flex; align-items: baseline; gap: 10px; }
.brand__name {
  font-family: var(--serif);
  font-size: 1.32rem;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand__sub {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .72;
}

.nav { display: none; gap: clamp(24px, 3vw, 44px); }
.nav__link {
  position: relative;
  padding-block: 6px;
  font-size: .92rem;
}
.nav__link::after {
  content: "";
  position: absolute;
  inset: auto 0 2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .7s var(--ease);
}
.nav__link:hover::after,
.nav__link.is-current::after { transform: scaleX(1); transform-origin: left; }

.btn--header {
  display: none;
  min-height: 44px;
  padding-inline: 20px;
  border-color: currentColor;
  font-size: .88rem;
}
.btn--header:hover { --btn-bg: var(--forest); --btn-fg: var(--on-dark); border-color: var(--forest); }
.header.is-top .btn--header:hover,
.header.is-dark .btn--header:hover { --btn-bg: var(--paper); --btn-fg: var(--ink); border-color: var(--paper); }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: 500 .92rem var(--sans);
  cursor: pointer;
}
.menu-toggle__lines { position: relative; display: block; width: 26px; height: 10px; }
.menu-toggle__lines i {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: transform .6s var(--ease), top .6s var(--ease);
}
.menu-toggle__lines i:first-child { top: 0; }
.menu-toggle__lines i:last-child { top: 9px; }
.menu-toggle[aria-expanded="true"] i:first-child { top: 5px; transform: rotate(18deg); }
.menu-toggle[aria-expanded="true"] i:last-child { top: 5px; transform: rotate(-18deg); }

/* Menu móvel */
.menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: calc(var(--header-h) + 32px) var(--gutter) max(32px, env(safe-area-inset-bottom));
  background: var(--sand);
  overflow-y: auto;
  clip-path: inset(0 0 100% 0);
  transition: clip-path .9s var(--ease);
}
.menu[hidden] { display: none; }
.menu.is-open { clip-path: inset(0); }
.menu__link {
  display: block;
  overflow: hidden;
  padding-block: 6px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.5rem, 12vw, 4rem);
  line-height: 1.12;
  letter-spacing: -.02em;
}
.menu__link span {
  display: block;
  transform: translateY(110%);
  transition: transform 1s var(--ease);
}
.menu.is-open .menu__link span { transform: none; }
.menu.is-open .menu__link:nth-child(2) span { transition-delay: .06s; }
.menu.is-open .menu__link:nth-child(3) span { transition-delay: .12s; }
.menu.is-open .menu__link:nth-child(4) span { transition-delay: .18s; }
.menu__foot { display: grid; gap: 20px; }
.menu__foot .btn { width: 100%; }
.menu__foot p { color: var(--muted); font-size: .92rem; }

/* WhatsApp flutuante (somente telas pequenas) */
.wa-float {
  position: fixed;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--forest);
  border: 1px solid var(--line-dark);
  color: var(--on-dark);
  font-weight: 500;
  font-size: .92rem;
  box-shadow: 0 8px 28px rgba(21, 35, 28, .22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s;
}
.wa-float svg { width: 20px; height: 20px; }
.wa-float.is-visible { opacity: 1; visibility: visible; transform: none; }

/* 4. Seções */

/* Hero */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  color: var(--on-dark);
}
.hero__media, .hero__scale { position: absolute; inset: 0; }
.hero__media { background: var(--forest); overflow: hidden; }
.hero__scale { overflow: hidden; }
.hero__scale::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(14, 22, 18, .72) 0%, rgba(14, 22, 18, .2) 46%, rgba(14, 22, 18, .34) 100%);
}
.hero__scale img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 30%;
}
.hero__content {
  position: relative;
  width: 100%;
  max-width: 1760px;
  margin-inline: auto;
  padding: calc(var(--header-h) + 32px) var(--gutter) clamp(32px, 5vw, 64px);
}
.hero__eyebrow { color: var(--on-dark); }
.hero__title {
  max-width: 13em;
  margin-top: 20px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3rem, 7.6vw, 8.25rem);
  line-height: 1.01;
  letter-spacing: -.026em;
  text-wrap: balance;
}
.hero__title em { font-weight: 200; }
.hero__foot {
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin-top: clamp(26px, 3.5vw, 48px);
}
.hero__lede { max-width: 34em; font-size: clamp(1rem, 1.25vw, 1.15rem); color: rgba(247, 244, 238, .9); }

/* A clínica */
.clinic { padding-block: var(--space-section); }
.clinic__head { display: grid; gap: 24px; }
.clinic__body {
  display: grid;
  gap: 48px;
  margin-top: clamp(56px, 8vw, 128px);
}
.clinic__main { aspect-ratio: 4 / 3; }
.clinic__small { aspect-ratio: 3 / 2; width: 70%; }
.clinic__aside { display: grid; gap: 32px; align-content: start; }
.clinic__text { font-size: 1.08rem; max-width: 34em; }

.facts { border-top: 1px solid var(--line); }
.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-block: 14px;
  border-bottom: 1px solid var(--line);
  font-size: .94rem;
}
.facts dt { color: var(--muted); }
.facts dd { text-align: right; }

/* Especialidades: padrão é deslize nativo, sem pin. */
.esp {
  background: var(--forest);
  color: var(--on-dark);
  padding-block: var(--space-section) 72px;
}
.esp__intro { padding-inline: var(--gutter); }
.esp__title { margin-top: 20px; }
.esp__lede { max-width: 30em; margin-top: 24px; color: var(--on-dark-muted); }
.esp__hint { display: none; }
.esp__rail {
  display: flex;
  gap: 16px;
  margin-top: 48px;
  padding-inline: var(--gutter);
  scroll-padding-inline: var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--gold) transparent;
  -webkit-overflow-scrolling: touch;
  outline: none;
}
@media (hover: none) {
  .esp__rail { scrollbar-width: none; }
  .esp__rail::-webkit-scrollbar { display: none; }
}

.card { flex: 0 0 min(80vw, 400px); scroll-snap-align: start; }
.card__link { display: block; height: 100%; }
.card__media { position: relative; aspect-ratio: 4 / 5; background: var(--forest-deep); }
.card__media img { transition: scale 1.6s var(--ease); }
.card__link:hover .card__media img { scale: 1.04 !important; }
.card__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-dark);
  color: var(--gold);
  font-size: .76rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.card__title {
  margin-top: 14px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.7rem, 2.2vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -.012em;
}
.card__text { margin-top: 10px; color: var(--on-dark-muted); font-size: .96rem; line-height: 1.5; }
.card__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: .9rem;
  font-weight: 500;
}

.esp__progress {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 36px;
  padding-inline: var(--gutter);
}
.esp__count { flex: none; font-size: .82rem; color: var(--on-dark-muted); font-variant-numeric: tabular-nums; }
.esp__count b { font-weight: 500; color: var(--on-dark); }
.esp__bar { flex: 1; height: 1px; background: var(--line-dark); }
.esp__bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  transform: scaleX(.14);
  transform-origin: left;
}

/* Diferenciais: padrão é empilhado, imagem + texto. */
.diff { padding-top: var(--space-section); }
.diff__head { display: grid; gap: 24px; margin-bottom: clamp(56px, 8vw, 112px); }
.diff__stage { display: none; }
.diff__grid { padding-inline: var(--gutter); padding-bottom: var(--space-section); }
.diff__steps { display: grid; gap: 72px; }
.step__media { aspect-ratio: 3 / 2; }
.step__body { margin-top: 24px; }
.step__num { color: var(--gold-text); font-size: .82rem; font-weight: 500; letter-spacing: .1em; }
.step__title {
  margin-top: 8px;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 3.8vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -.018em;
}
.step__text { max-width: 30em; margin-top: 14px; color: var(--muted); font-size: 1.05rem; }

/* Chamada */
.cta {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 78vh;
  min-height: 78svh;
  overflow: hidden;
  color: var(--on-dark);
  text-align: center;
  background: var(--forest-deep);
}
.cta__media { position: absolute; inset: 0; overflow: hidden; }
.cta__media::after { content: ""; position: absolute; inset: 0; background: rgba(31, 50, 41, .74); }
.cta__media img { width: 100%; height: 100%; object-fit: cover; }
.cta__content {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 36px;
  padding: 96px var(--gutter);
}

/* Contato */
.contact { padding-block: var(--space-section); }
.contact__grid { display: grid; gap: 64px; }
.contact__title { margin-top: 20px; }
.contact__list { display: grid; gap: 24px; margin-top: 48px; }
.contact__list li { display: grid; gap: 4px; justify-items: start; font-size: 1.08rem; }
.contact__label { color: var(--muted); font-size: .84rem; }

.composer {
  align-self: start;
  padding: clamp(24px, 3.4vw, 52px);
  background: var(--ivory);
  border: 1px solid var(--line);
}
.composer__title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -.012em;
}
.composer__text { margin-top: 10px; color: var(--muted); }
.field { margin-top: 28px; }
.field label { display: block; color: var(--muted); font-size: .86rem; }
.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1.05rem var(--sans);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .4s var(--ease);
}
.field select {
  padding-right: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%231C2621' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 2px center / 12px;
}
.field input:focus-visible,
.field select:focus-visible { outline: none; border-bottom: 2px solid var(--gold-text); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field__error { margin-top: 6px; color: var(--danger); font-size: .86rem; }
.composer__submit { width: 100%; margin-top: 32px; }
.composer__note { margin-top: 14px; color: var(--muted); font-size: .82rem; }

/* Footer */
.footer {
  padding-block: 32px 96px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .86rem;
}
.footer__row { display: grid; gap: 10px; }
.footer__brand { color: var(--ink); }

/* O Lenis controla a rolagem; o CSS só suaviza as âncoras quando ele não está ativo. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.lenis) { scroll-behavior: smooth; }
}
[data-lenis-prevent] { overscroll-behavior: contain; }

/* 5. Modos de animação (classes definidas em main.js) */

/* Evita o flash do texto antes da divisão em linhas. */
.motion-pending [data-lines],
.motion-pending [data-hero-title],
.motion-pending [data-hero-fade] { visibility: hidden; }

/* Sem JavaScript: navegação visível e o que depende de script fica fora. */
html:not(.js) .menu-toggle,
html:not(.js) .composer { display: none; }
html:not(.js) .header { position: static; }
html:not(.js) .header__bar { flex-wrap: wrap; height: auto; padding-block: 14px; }
html:not(.js) .nav { display: flex; flex-wrap: wrap; }

.split-line-mask { padding-bottom: .14em; margin-bottom: -.14em; }



/* Horizontal fixado no desktop */
.esp-pinned .esp {
  padding-block: 0;
}
.esp-pinned .esp__pin {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.esp-pinned .esp__mover {
  display: flex;
  align-items: center;
  width: max-content;
  padding-top: var(--header-h);
  will-change: transform;
}
.esp-pinned .esp__intro { flex: none; width: 36vw; padding-right: 2vw; }
.esp-pinned .esp__hint {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  font-size: .9rem;
  color: var(--gold);
}
.esp-pinned .esp__rail {
  margin-top: 0;
  padding-left: 0;
  padding-right: var(--gutter);
  gap: clamp(28px, 3vw, 56px);
  overflow: visible;
  scroll-snap-type: none;
}
.esp-pinned .card { flex: none; width: clamp(280px, 25vw, 420px); }
.esp-pinned .card__media { aspect-ratio: auto; height: calc(100svh - var(--header-h) - 320px); min-height: 200px; }
.esp-pinned .esp__progress { position: absolute; inset: auto 0 24px; margin: 0; }

/* Diferenciais com imagem fixa no desktop */
.diff-pinned .diff__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 96px);
  padding-right: 0;
  padding-bottom: 0;
}
.diff-pinned .diff__steps { display: block; }
.diff-pinned .step {
  display: flex;
  align-items: center;
  min-height: 86vh;
  min-height: 86svh;
}
.diff-pinned .step:last-child { min-height: 100vh; min-height: 100svh; }
.diff-pinned .step__body { margin-top: 0; }
.diff-pinned .diff__stage {
  display: block;
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--sand);
}
.diff-pinned .diff__stage .step__media {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}

/* 6. Mídia */
@media (max-width: 479px) {
  .brand__sub { display: none; }
}

@media (min-width: 640px) {
  .hero__foot { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 48px; }
  .footer { padding-bottom: 32px; }
  .footer__row { grid-template-columns: 1fr auto auto; gap: 40px; align-items: center; }
  .card { flex-basis: min(46vw, 400px); }
}

@media (min-width: 768px) {
  .wa-float { display: none; }
  .clinic__small { width: 60%; }
  .contact__grid { gap: 64px; }
}

@media (min-width: 1024px) {
  .nav { display: flex; }
  .btn--header { display: inline-flex; }
  .menu-toggle, .menu { display: none; }

  .clinic__head { grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
  .clinic__head .eyebrow { grid-column: 1 / span 2; padding-top: 1.2em; }
  .clinic__statement { grid-column: 3 / -1; }
  .clinic__body { grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
  .clinic__main { grid-column: 1 / span 7; aspect-ratio: 5 / 6; }
  .clinic__aside { grid-column: 9 / -1; padding-top: 18vh; }
  .clinic__small { width: 100%; }

  .diff__head { grid-template-columns: repeat(12, 1fr); column-gap: 24px; }
  .diff__head .eyebrow { grid-column: 1 / span 2; padding-top: 1.2em; }
  .diff__title { grid-column: 3 / -1; }

  .contact__grid { grid-template-columns: 7fr 5fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
  .menu__link span { transform: none; }
}
