/* =========================================================================
   Fisiolight — página "Antes e depois"
   O visual vem todo de style.css (cores, fontes, botões, seções, topo);
   aqui ficam só as peças novas: comparador de fotos, grade de resultados,
   filtros e a luz que acompanha o mouse.
   ========================================================================= */

/* Página atual no menu: sublinhado à mão fica desenhado */
.nav > a[aria-current="page"] { color: #936039; }
.nav > a[aria-current="page"] .sublinhado-mao path { stroke-dashoffset: 0; }

.resultados {
  isolation: isolate;
  position: relative;
}

.so-leitor {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Comparador antes/depois ---------- */
.comparar {
  --pos: 50%;
  position: relative;
  isolation: isolate;
  aspect-ratio: 9 / 8;
  overflow: hidden;
  background: #e9ddf3;
  cursor: grab;
  touch-action: pan-y pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}

.comparar.arrastando { cursor: grabbing; }

.comparar-foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* A foto do antes fica por cima, recortada até a linha */
.comparar-antes { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }

.comparar-divisor {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  z-index: 2;
  width: 2px;
  margin-left: -1px;
  background: #fcf8fe;
  box-shadow: 0 0 0 1px #65517b14, 0 0 18px #20162b40;
  pointer-events: none;
}

/* A alça acompanha a linha, mas para antes da borda para não ser cortada */
.comparar-alca {
  position: absolute;
  top: 50%;
  left: clamp(30px, var(--pos), calc(100% - 30px));
  z-index: 3;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  translate: -50% -50%;
  color: #65517b;
  background: #fcf8fef0;
  border: 1px solid #ffffff80;
  border-radius: 50%;
  box-shadow: 0 8px 25px #20162b30;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: scale .35s var(--anim-ease, cubic-bezier(.22, 1, .36, 1)), background-color .2s ease, color .2s ease;
}

.comparar.arrastando .comparar-alca {
  scale: 1.1;
  color: #fbf7f1;
  background: #65517b;
}

.comparar-alca:focus-visible {
  outline: 3px solid #8a5733;
  outline-offset: 4px;
}

.comparar-rotulo {
  position: absolute;
  bottom: 14px;
  z-index: 2;
  padding: 7px 12px;
  border-radius: 100px;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .16em;
  text-transform: uppercase;
  box-shadow: 0 4px 14px #20162b14;
  pointer-events: none;
  transition: opacity .3s ease;
}

.comparar-rotulo-antes {
  left: 14px;
  color: #3b2418;
  background: #fcf8fef0;
}

.comparar-rotulo-depois {
  right: 14px;
  color: #fbf7f1;
  background: #65517bf0;
}

.comparar.so-depois .comparar-rotulo-antes,
.comparar.so-antes .comparar-rotulo-depois { opacity: 0; }

/* Luz que acompanha o mouse sobre a foto */
.comparar-luz {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  background: radial-gradient(circle 260px at var(--gx, 50%) var(--gy, 50%), #fff8f05c, #fff8f01f 40%, #fff8f000 72%);
  pointer-events: none;
  transition: opacity .5s ease;
}

/* Enquanto arrasta, o cursor redondo some para não cobrir a foto */
.cursor { transition: opacity .25s ease; }
.arrastando-comparador .cursor { opacity: 0; }
.arrastando-comparador { cursor: grabbing; }

/* Comparador dentro da moldura em arco do topo (só quando há comparador nela) */
.hero-image-frame:has(> .comparar) { position: relative; }

.hero-image-frame > .comparar {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  border-radius: inherit;
}

.hero-image-frame .comparar-rotulo { bottom: 20px; }
.hero-image-frame .comparar-rotulo-antes { left: 20px; }
.hero-image-frame .comparar-rotulo-depois { right: 20px; }

/* ---------- Filtros ---------- */
.resultados-filtros {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.resultados-filtros button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 12px 20px;
  color: #65517b;
  background: #fcf8fe;
  border: 1px solid #c9b6d5;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  transition: transform .16s var(--ease-out), background .2s ease, color .2s ease, border-color .2s ease;
}

.resultados-filtros button[hidden] { display: none; }

.resultados-filtros button > span {
  font-size: 10px;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
  opacity: .55;
}

.resultados-filtros button[aria-pressed="true"] {
  color: #fbf7f1;
  background: #65517b;
  border-color: #3b2418;
}

.resultados-filtros button:active { transform: scale(.97); }

/* ---------- Grade de resultados ---------- */
/* A última linha incompleta fica centralizada */
.resultados-grade {
  --colunas: 3;
  --espaco: 26px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--espaco);
  counter-reset: resultado;
}

.resultado {
  position: relative;
  display: flex;
  flex: 0 0 calc((100% - (var(--colunas) - 1) * var(--espaco)) / var(--colunas));
  flex-direction: column;
  min-width: 0;
  padding: 10px;
  background: #f1e7f8;
  border: 1px solid #d6c6e0;
  border-radius: 18px;
  box-shadow: 0 10px 25px #65517b10;
  counter-increment: resultado;
  transition: transform .25s var(--ease-out), border-color .2s ease, box-shadow .35s ease;
}

.resultado[hidden] { display: none; }

.resultado > .comparar {
  z-index: 1;
  border-radius: 12px;
}

/* Luz do card: a borda acende perto do mouse e o fundo clareia em volta dele */
.resultado::before,
.resultado::after {
  content: "";
  position: absolute;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
}

.resultado::before {
  inset: -1px;
  z-index: 4;
  padding: 1.5px;
  background: radial-gradient(circle 340px at var(--bx, 50%) var(--by, 50%), #c99562, #d6b18b 28%, #ab8bbd80 58%, #ab8bbd00 82%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.resultado::after {
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle 320px at var(--bx, 50%) var(--by, 50%), #fcf8fee6, #fcf8fe00 70%);
}

.resultado-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px 14px 12px;
}

.resultado .card-top { margin-bottom: 18px; }

.resultado-categoria {
  display: flex;
  align-items: center;
  gap: 9px;
  text-transform: uppercase;
}

.resultado .card-top > .resultado-categoria { font-size: 10px; letter-spacing: .16em; }

.resultado-numero::before { content: counter(resultado, decimal-leading-zero); }

.resultado h3 { font-size: 30px; }

.resultado-info > p {
  max-width: 360px;
  margin: 14px 0 26px;
  font-size: 14px;
}

.resultado-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #d8c8b6;
  font-size: 12px;
}

.resultado-link .sublinha { position: relative; }

.resultado-link .sublinha::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: #c99562;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}

.resultado-link svg { transition: transform .3s ease; }

/* Rodapé da galeria: aviso mais longo que o da página inicial */
.resultados .gallery-footer { margin-top: 40px; }
.resultados .gallery-footer > span { max-width: 620px; line-height: 1.6; }
.resultados .gallery-footer > span > svg { flex-shrink: 0; color: #936039; }

/* ---------- Chamada na página inicial ---------- */
.resultados-chamada {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 90px;
}

.chamada-foto > .comparar {
  border-radius: 100px 4px 4px;
  box-shadow: 12px 22px 40px #65517b25;
}

.chamada-foto > .photo-caption { margin-top: 16px; }

.chamada-texto > p:not(.eyebrow) {
  max-width: 440px;
  margin-top: 25px;
  font-size: 15px;
}

.chamada-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.chamada-filtros > a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 18px;
  color: #65517b;
  background: #fcf8fe;
  border: 1px solid #c9b6d5;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  transition: transform .16s var(--ease-out), background .2s ease;
}

.chamada-filtros > a:active { transform: scale(.97); }

.chamada-texto > .button { margin-top: 32px; }

@media (hover: hover) and (pointer: fine) {
  .chamada-filtros > a:hover { background: #e9ddf3; }
}

@media (width <= 1100px) {
  .resultados-chamada { gap: 60px; }
}

@media (width <= 820px) {
  .resultados-chamada {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .chamada-foto {
    width: min(100%, 560px);
    margin-inline: auto;
  }
}

@media (width <= 540px) {
  .chamada-foto > .comparar { border-radius: 75px 4px 4px; }
  .chamada-filtros { gap: 8px; }
  .chamada-filtros > a {
    min-height: 40px;
    padding: 9px 15px;
    font-size: 11px;
  }
  .chamada-texto > .button { width: 100%; }
}

@media (hover: hover) and (pointer: fine) {
  .resultado:hover {
    border-color: #ab8bbd;
    box-shadow: 0 18px 40px #65517b22;
    transform: translateY(-4px);
  }
  .resultado:hover::before,
  .resultado:hover::after { opacity: 1; }
  .comparar:hover .comparar-luz { opacity: 1; }
  .comparar:hover .comparar-alca { scale: 1.06; }
  .resultados-filtros button:hover:not([aria-pressed="true"]) { background: #e9ddf3; }
  .resultado-link:hover .sublinha::after { transform: scaleX(1); }
  .resultado-link:hover svg { transform: translateX(4px); }
}

@media (width <= 1100px) {
  .resultados-grade { --espaco: 18px; }
  .resultado h3 { font-size: 27px; }
  .resultado-info { padding: 22px 10px 10px; }
}

@media (width <= 820px) {
  .resultados-grade { --colunas: 2; }
  .resultados .gallery-footer { margin-top: 32px; }
}

@media (width <= 540px) {
  .resultados-filtros {
    justify-content: flex-start;
    gap: 8px;
  }
  .resultados-filtros button {
    min-height: 42px;
    padding: 10px 15px;
    font-size: 11px;
  }
  .resultados-grade {
    --colunas: 1;
    --espaco: 22px;
  }
  .resultado { border-radius: 16px; }
  .resultado h3 { font-size: 30px; }
  .comparar-alca {
    width: 46px;
    height: 46px;
  }
  .resultados .gallery-footer {
    flex-direction: column;
    gap: 16px;
  }
  .resultados .gallery-footer > span {
    max-width: none;
    font-size: 11px;
  }
  .hero-image-frame .comparar-rotulo { bottom: 14px; }
  .hero-image-frame .comparar-rotulo-antes { left: 14px; }
  .hero-image-frame .comparar-rotulo-depois { right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .resultado:hover,
  .resultados-filtros button:active { transform: none; }
}

/* Subtítulo do card (ex.: "Bioestimulador de colágeno em glúteos") */
.resultado-info > .resultado-subtitulo {
  margin: 8px 0 0;
  color: #936039;
  font-size: 13px;
  line-height: 1.5;
}

/* Card "Toxina botulínica" na página inicial: mesmo visual dos cards da galeria */
.resultado-destaque { counter-reset: resultado; }
