/* ==========================================================================
   Páginas de categoria de tratamento (tratamentos-*.html) + overlay de
   detalhe do procedimento. Isolado de sections.css por só existir
   nessas páginas geradas em build (scripts/build-tratamentos.mjs).
   ========================================================================== */

.tratamento-intro {
  /* Menos conteúdo que uma seção "cheia" (sem grade abaixo do texto) —
     o padding-block padrão de .section (clamp 4-6.5rem) deixava um
     vão vazio grande demais entre o texto e a grade de procedimentos.
     padding-top separado do bottom: o .site-header é position:fixed
     (~79px de altura) e fica por cima do conteúdo — precisa de espaço
     próprio pra não tampar o "Voltar" (mesmo valor de .legal em
     css/legal.css, usado por privacidade.html/termos.html pelo mesmo
     motivo). */
  padding-top: 6rem;
  padding-bottom: clamp(2rem, 4vw, 3rem);
  background: var(--color-warmwhite);
}

.tratamento-intro__voltar {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: var(--space-sm);
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  font-weight: 600;
}

.tratamento-intro h1 {
  margin-top: var(--space-2xs);
}

/* Some ao vão da grade de procedimentos (a seção já reduzida de
   .tratamento-intro cuida do espaço "de baixo"; aqui só o topo). */
.tratamento-grid-section {
  padding-top: clamp(1rem, 3vw, 2rem);
}

.tratamento-intro__subtitulo {
  margin-top: 0.75rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: var(--text-lead);
  color: var(--color-text-soft);
}

.tratamento-intro > .container > p:last-child {
  margin-top: var(--space-md);
  max-width: 60ch;
}

.procedure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.procedure-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-soft), box-shadow var(--duration-fast) var(--ease-soft);
}

.procedure-card:hover,
.procedure-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(80, 62, 43, 0.1);
}

.procedure-card__photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--color-beige-200);
  overflow: hidden;
}

.procedure-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.procedure-card__photo--vazia {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-sm);
}

.procedure-card__photo--vazia::before,
.procedure-card__photo--vazia::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: var(--color-accent);
  pointer-events: none;
}

.procedure-card__photo--vazia::before { width: 46%; aspect-ratio: 1; top: -14%; right: -14%; opacity: 0.16; }
.procedure-card__photo--vazia::after { width: 56%; aspect-ratio: 1; bottom: -20%; left: -16%; opacity: 0.1; }

.procedure-card__photo-categoria {
  position: relative;
  z-index: 1;
  color: var(--color-text-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.procedure-card__photo-nome {
  position: relative;
  z-index: 1;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  line-height: 1.3;
}

.procedure-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.25rem 1.35rem 1.5rem;
  flex: 1;
}

.procedure-card__name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text);
}

.procedure-card__desc {
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------------------------------- Overlay de detalhe ---------------------------------- */

.procedure-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.procedure-modal[hidden] {
  display: none;
}

.procedure-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(60, 46, 32, 0.55);
}

.procedure-modal__panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(88vh, 900px);
  overflow-y: auto;
  background: var(--color-warmwhite);
  border-radius: 20px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

.procedure-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-warmwhite);
  color: var(--color-text);
  font-size: 1.3rem;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.procedure-modal__photo {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--color-beige-200);
  overflow: hidden;
}

.procedure-modal__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.procedure-modal__photo--vazia {
  display: flex;
  align-items: center;
  justify-content: center;
}

.procedure-modal__photo--vazia::after {
  content: attr(data-categoria);
  color: var(--color-text-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.procedure-modal__body {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.procedure-modal__category {
  color: var(--color-text-soft);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.procedure-modal__subtitle {
  color: var(--color-text-soft);
  margin-top: 0.5rem;
}

.procedure-modal__section {
  margin-top: var(--space-sm);
}

.procedure-modal__section h3 {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-soft);
  margin-bottom: 0.35rem;
}

.procedure-modal__section p {
  color: var(--color-text);
  line-height: 1.6;
}

.procedure-modal__cta {
  margin-top: var(--space-md);
}

@media (prefers-reduced-motion: no-preference) {
  .procedure-card {
    transition: transform var(--duration-fast) var(--ease-soft), box-shadow var(--duration-fast) var(--ease-soft);
  }
}
