/* ==========================================================================
   COD · Centro Oftalmológico Dias
   Cores principais: petróleo #5C95A4 e branco (decisão do cliente).
   ========================================================================== */

:root {
  --petrol: #5c95a4; /* cor da marca */
  --petrol-deep: #2e6070; /* petróleo para fundo de texto pequeno (branco passa 6,9:1) */
  --petrol-ink: #0e2e37; /* sombra das fotos */
  --petrol-soft: #cfe3e8; /* texto secundário sobre petróleo escuro */
  --white: #ffffff;
  --navy: #101e44;
  --mist: #edf4f6; /* fundo claro puxado para o petróleo */
  --text-muted: #46566a; /* 7,4:1 sobre branco */

  --font: "Manrope", "Relevance", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(1.25rem, 3.4vw, 3rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

/* No computador o site fica um pouco mais compacto: tudo que é medido em rem
   (texto, espaços, cartões) diminui junto. No celular fica o tamanho padrão. */
@media (min-width: 1024px) {
  html {
    font-size: 90%;
  }
}

body {
  background: var(--petrol-ink);
  color: var(--navy);
  font-family: var(--font);
  font-size: 1.125rem; /* 18px: muitos pacientes idosos */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p,
ul {
  margin: 0;
}
ul {
  padding: 0;
  list-style: none;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--petrol);
  color: var(--white);
}

:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--petrol-deep);
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 600px;
  overflow: hidden;
  color: var(--white);
  background: var(--petrol-ink);
}

.hero__slides {
  position: absolute;
  inset: 0;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}
.hero__slides.is-dragging {
  cursor: grabbing;
}

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide__zoom {
  position: absolute;
  inset: 0;
}
/* A foto da vez entra com zoom lento e clareia; a que sai escurece */
.slide img {
  filter: brightness(0.55);
  transition: filter 1200ms var(--ease-out);
}
.slide.is-active img {
  filter: none;
  animation: hero-in 7s var(--ease-out) both;
}
@keyframes hero-in {
  from {
    transform: scale(1.16);
  }
  to {
    transform: scale(1.02);
  }
}

.hero__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, rgb(14 46 55 / 0.88) 0%, rgb(14 46 55 / 0.3) 40%, rgb(14 46 55 / 0.25) 100%);
}
@media (min-width: 768px) {
  .hero__shade {
    background:
      linear-gradient(90deg, rgb(14 46 55 / 0.85) 0%, rgb(14 46 55 / 0.5) 35%, rgb(14 46 55 / 0) 65%),
      linear-gradient(0deg, rgb(14 46 55 / 0.7) 0%, rgb(14 46 55 / 0) 40%);
  }
}

/* Topo */
.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(0.5rem, 1.1vw, 1.25rem) var(--pad) 0;
  pointer-events: none;
}
.topbar > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.brand__mark {
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}
.dot {
  color: var(--petrol);
}
.brand__rule {
  display: none;
  width: 1px;
  height: 1.75rem;
  background: rgb(255 255 255 / 0.3);
}
.brand__name {
  display: none;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.8);
}
@media (min-width: 640px) {
  .brand__rule,
  .brand__name {
    display: block;
  }
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.menu-btn,
.topbar__phone {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: 2.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 180ms var(--ease-out);
}
.menu-btn {
  padding: 0 0.75rem;
  border-radius: 999px;
}
.menu-btn:hover,
.topbar__phone:hover {
  color: var(--petrol-soft);
}
.menu-btn__icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.menu-btn__icon span {
  display: block;
  height: 1.5px;
  width: 1.25rem;
  background: currentColor;
}
.menu-btn__icon span + span {
  width: 0.875rem;
  background: var(--petrol);
}
.topbar__rule,
.topbar__phone {
  display: none;
}
.topbar__rule {
  width: 1px;
  height: 1.5rem;
  background: rgb(255 255 255 / 0.3);
}
.topbar__phone {
  font-variant-numeric: tabular-nums;
}
@media (min-width: 768px) {
  .topbar__rule {
    display: block;
  }
  .topbar__phone {
    display: flex;
  }
}

/* Base */
.hero__bottom {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  gap: 1.5rem;
  padding: 0 var(--pad) calc(var(--pad) * 0.9 + 2.5rem); /* + a curva da seção que sobe por cima */
  pointer-events: none;
}
/* Texto de cada foto */
.hero__caption {
  max-width: 62rem;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid rgb(255 255 255 / 0.4);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(6px);
}
.hero__count {
  color: var(--petrol-soft);
  font-variant-numeric: tabular-nums;
}
.hero__sep {
  width: 1px;
  height: 0.875rem;
  background: rgb(255 255 255 / 0.35);
}
.hero__title {
  margin-top: 1.25rem;
  max-width: 13ch;
  /* sombra suave atrás das letras para ler bem sobre qualquer foto */
  filter: drop-shadow(0 6px 30px rgb(14 46 55 / 0.55));
  font-size: clamp(2.75rem, 5.2vw, 5.75rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--white);
  text-wrap: balance;
}
.hero__text {
  margin-top: 1.5rem;
  max-width: 38rem;
  font-size: clamp(1.125rem, 1.5vw, 1.375rem);
  line-height: 1.6;
  color: rgb(255 255 255 / 0.88);
}
/* Máscara de cada palavra: a palavra sobe por dentro dela */
.w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  /* folga para letras que descem (g, p, ç) não serem cortadas pela máscara */
  padding: 0.04em 0.02em 0.2em;
  margin: -0.04em -0.02em -0.2em;
}
.w__i {
  display: inline-block;
}
/* Texto "embutido" na foto: branco em cima, ficando translúcido embaixo,
   deixando a foto aparecer por dentro das letras */
.hero__title .w__i {
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 38%, rgb(255 255 255 / 0.5) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__title .w__i--accent {
  background: linear-gradient(180deg, #e3f1f5 0%, var(--petrol-soft) 40%, rgb(163 205 215 / 0.45) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero__line {
  position: relative;
  display: none;
  height: 1px;
  overflow: hidden;
  background: rgb(255 255 255 / 0.35);
}
/* Barra que enche até a próxima foto */
.hero__progress {
  position: absolute;
  inset: 0;
  background: var(--white);
  transform: scaleX(0);
  transform-origin: left;
}
.hero__progress.is-running {
  animation: progress 5s linear forwards;
}
@keyframes progress {
  to {
    transform: scaleX(1);
  }
}
/* Botão de duas setas: passa para a próxima foto */
.hero__bottom {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.hero__next {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: var(--petrol);
  color: var(--white);
  transition:
    background-color 180ms var(--ease-out),
    color 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}
.hero__next:hover {
  background: var(--white);
  color: var(--petrol-deep);
}
.hero__next:active {
  transform: scale(0.95);
}
/* Leve empurrão das setas para indicar que dá para passar */
.hero__next svg {
  animation: nudge 2.4s var(--ease-out) 2s infinite;
}
@keyframes nudge {
  0%,
  60%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(4px);
  }
}

@media (min-width: 768px) {
  .hero__bottom {
    grid-template-columns: minmax(0, 62rem) 1fr auto;
    align-items: end;
    gap: 2rem;
  }
  .hero__line {
    display: block;
    margin-bottom: 1.75rem;
  }
  .hero__next {
    margin-bottom: 0;
  }
}
.hero.is-ready .hero__line,
.hero.is-ready .hero__next {
  animation: rise 1s var(--ease-out) 0.9s both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* --------------------------------------------------------------------------
   Passagem da hero para a próxima seção
   A hero fica presa no topo e recua (escurece, desfoca, afunda) enquanto a
   seção seguinte sobe por cima dela com cantos arredondados.
   -------------------------------------------------------------------------- */
.hero,
.phero {
  position: sticky;
  top: 0;
  z-index: 0;
}
.hero::after,
.phero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--petrol-ink);
  opacity: calc(var(--p, 0) * 0.75);
  pointer-events: none;
}
.hero .hero__slides {
  transform: scale(calc(1 - var(--p, 0) * 0.06));
}
.hero .topbar,
.hero .hero__bottom,
.phero .topbar,
.phero .phero__content {
  transform: translateY(calc(var(--p, 0) * -90px));
  opacity: calc(1 - var(--p, 0) * 1.4);
  filter: blur(calc(var(--p, 0) * 10px));
}
.hero + section,
.phero + section {
  position: relative;
  z-index: 1;
  margin-top: -2.5rem;
  border-radius: 2.5rem 2.5rem 0 0;
  box-shadow: 0 -40px 80px -40px rgb(14 46 55 / 0.6);
}
main > :not(.hero):not(.phero),
.footer {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Montagem das seções ao entrar na tela (só com JavaScript e sem movimento reduzido)
   -------------------------------------------------------------------------- */
.reveal-ready [data-reveal] {
  transition:
    opacity 900ms var(--ease-out),
    transform 1100ms var(--ease-out),
    filter 900ms var(--ease-out),
    clip-path 1300ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.reveal-ready [data-reveal="up"]:not(.is-in) {
  opacity: 0;
  transform: translateY(40px);
  filter: blur(8px);
}
.reveal-ready [data-reveal="card"]:not(.is-in) {
  opacity: 0;
  transform: perspective(1200px) translateY(80px) rotateX(16deg) scale(0.92);
  filter: blur(6px);
}
[data-reveal="card"] {
  transform-origin: 50% 100%;
}
/* O recorte fica nos filhos: se ficasse no próprio bloco, o navegador o veria como invisível e ele nunca abriria */
.reveal-ready [data-reveal="wipe"] > * {
  transition: clip-path 1300ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.reveal-ready [data-reveal="wipe"]:not(.is-in) > * {
  clip-path: inset(0 100% 0 0);
}
.reveal-ready [data-reveal="wipe"].is-in > * {
  clip-path: inset(0 0 0 0);
}
/* A foto dentro do cartão chega com zoom quando o cartão monta */
.reveal-ready [data-reveal] img {
  transition: transform 1600ms var(--ease-out);
}
.reveal-ready [data-reveal]:not(.is-in) img {
  transform: scale(1.25);
}

/* --------------------------------------------------------------------------
   Menu em tela cheia
   -------------------------------------------------------------------------- */

.menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--petrol-deep);
  color: var(--white);
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}
.menu[hidden] {
  display: none;
}
.menu.is-open {
  opacity: 1;
}
.menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(0.5rem, 1.1vw, 1.25rem) var(--pad) 0;
}
.menu__close {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 2.75rem;
  padding: 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 999px;
}
.menu__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 3rem;
  padding: 0 var(--pad) calc(var(--pad) * 1.1);
}
.menu__label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--petrol-soft);
}
.menu__phones {
  margin-top: 1.25rem;
}
.menu__phones a {
  font-size: clamp(2.5rem, 8vw, 6rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  transition: opacity 180ms;
}
.menu__phones a:hover {
  opacity: 0.75;
}
.menu__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(255 255 255 / 0.3);
  font-size: 1rem;
}
.menu__muted {
  color: var(--petrol-soft);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
