/* ============================================================
   style-extras.css — Dra. Helena Beatriz
   Apenas o que Tailwind não cobre nativamente:
   - Tipografia fluida com clamp()
   - Animações de entrada (.reveal)
   - Slider antes/depois (compare)
   - FAQ <details> custom
   - Smooth scroll e scrollbar
   - Gradiente radial helper
   - prefers-reduced-motion
   ============================================================ */

/* Smooth scroll global, com offset para o header sticky */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tipografia fluida — clamp(min, fluid, max) */
.fluid-h1   { font-size: clamp(2.4rem, 6.2vw, 4.6rem); font-weight: 500; }
.fluid-h2   { font-size: clamp(1.85rem, 4.4vw, 3.1rem); font-weight: 500; }
.fluid-lead { font-size: clamp(1rem, 1.4vw, 1.18rem); line-height: 1.65; }
.fluid-body { font-size: clamp(0.98rem, 1.2vw, 1.08rem); line-height: 1.75; }

/* Helper de gradiente radial usado no Hero (Tailwind v3 não traz nativo) */
.bg-gradient-radial {
  background-image: radial-gradient(circle at center, var(--tw-gradient-from), var(--tw-gradient-to));
}

/* Header transição transparente → creme com blur ao scrollar */
#header {
  background-color: transparent;
  backdrop-filter: blur(0);
}
#header.is-scrolled {
  background-color: rgba(250, 246, 241, 0.85);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(42, 37, 32, 0.05), 0 14px 30px -20px rgba(42, 37, 32, 0.18);
}

/* Compensa o header sticky deixando espaço acima do hero */
body { padding-top: 0; }

/* ===== Animações de entrada ===== */
.reveal,
.reveal-delayed {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.is-visible,
.reveal-delayed.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delayed { transition-delay: 180ms; }

/* Stagger automático para filhos diretos de um grupo .reveal-group */
.reveal-group > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-group > .reveal:nth-child(2) { transition-delay: 90ms; }
.reveal-group > .reveal:nth-child(3) { transition-delay: 180ms; }
.reveal-group > .reveal:nth-child(4) { transition-delay: 270ms; }
.reveal-group > .reveal:nth-child(5) { transition-delay: 360ms; }
.reveal-group > .reveal:nth-child(6) { transition-delay: 450ms; }

/* CTA primário com pulse suave permanente */
.cta-primary {
  position: relative;
  isolation: isolate;
}
.cta-primary::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.35), transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 3.2s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity 250ms ease;
}
.cta-primary:hover::before { opacity: 1; }

/* ===== Slider Antes/Depois ===== */
.compare-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  isolation: isolate;
}
.compare-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}
.compare-after {
  clip-path: inset(0 calc(100% - var(--pos, 55%)) 0 0);
  transition: clip-path 80ms linear;
}
.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: ew-resize;
  margin: 0;
  z-index: 3;
}
.compare-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: ew-resize;
}
.compare-range::-moz-range-thumb {
  width: 0;
  height: 0;
  border: none;
  background: transparent;
  cursor: ew-resize;
}
.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos, 55%);
  width: 2px;
  background: rgba(250, 246, 241, 0.95);
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 9999px;
  background: rgba(250, 246, 241, 0.95);
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.05);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23A8804E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 3 12 9 6'/><polyline points='15 6 21 12 15 18'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}
.compare-label {
  position: absolute;
  top: 5%;
  z-index: 2;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: rgba(26, 23, 20, 0.6);
  color: #FAF6F1;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.compare-label-before { left: 5%; }
.compare-label-after  { right: 5%; }

/* ===== FAQ <details> ===== */
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary { transition: background-color 200ms ease; }
.faq-item:hover summary { background-color: rgba(232, 213, 196, 0.18); }
.faq-item[open] .faq-icon { transform: rotate(45deg); }
.faq-item > div {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
.faq-item[open] > div {
  grid-template-rows: 1fr;
}
.faq-item > div > * { overflow: hidden; }

/* Ajuste fallback para browsers que não suportam grid-template-rows transition */
.faq-item > div { animation: faqOpen 320ms ease forwards; }
@keyframes faqOpen { from { opacity: 0.5; } to { opacity: 1; } }

/* ===== Botão flutuante WhatsApp ===== */
#floating-wa.is-ready {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 500ms ease 800ms, transform 500ms cubic-bezier(0.22, 1, 0.36, 1) 800ms;
}

/* ===== Scrollbar mais elegante (Webkit) ===== */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: #FAF6F1; }
::-webkit-scrollbar-thumb { background: #C9A77C; border-radius: 8px; border: 3px solid #FAF6F1; }
::-webkit-scrollbar-thumb:hover { background: #A8804E; }

/* ===== Acessibilidade: respeitar prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-delayed { opacity: 1; transform: none; }
  .compare-after { transition: none; }
}

/* ===== Mobile fine-tuning ===== */
@media (max-width: 640px) {
  html { scroll-padding-top: 4rem; }
  .compare-handle::after { width: 38px; height: 38px; }
}
