/* ==========================================================================
   Censo Pet de Santa Felicidade e Região — folha de estilo
   Mobile-first. Tokens do BRAND_KIT. Identidade "Galeria Real" (molduras
   provençais douradas sobre fundo cream). Purple SÓ em CTA.
   ========================================================================== */

:root {
  /* Paleta oficial (BRAND_KIT) */
  --cream: #f5efe6;
  --cream-light: #fffaf3;
  --gold: #c9a96e;
  --gold-deep: #d4af37;
  --gold-soft: #F4E1C2;
  --purple: #622df9;          /* exclusivo p/ CTA */
  --text-strong: #1A202C;
  --text-default: #2D3748;
  --muted: #718096;
  --royal: #2a3a63;           /* azul royal p/ faixas de seção */
  --wood: #6b4a2b;            /* madeira p/ bordas sutis */

  --radius-card: 32px;
  --radius-pill: 20px;
  --maxw: 920px;
  --tap: 44px;                /* alvo mínimo de toque */

  --shadow-soft: 0 6px 24px rgba(42, 58, 99, 0.08);
  --shadow-card: 0 10px 30px rgba(107, 74, 43, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Agrandir", "Georgia", "Playfair Display", serif;
  background: var(--cream);
  color: var(--text-default);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fonte da marca (Agrandir) — fallback elegante se o CDN não resolver. */
h1, h2, h3, .display {
  font-family: "Agrandir", "Playfair Display", "Georgia", serif;
  color: var(--text-strong);
  line-height: 1.15;
  letter-spacing: 0.2px;
}

/* ---------- Layout base (coluna única, mobile-first) ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }

section { padding: 46px 0; }
section + section { border-top: 1px solid var(--gold-soft); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--gold-deep);
  font-weight: 700;
  margin: 0 0 8px;
}

h1 { font-size: clamp(28px, 7vw, 46px); margin: 8px 0 14px; }
h2 { font-size: clamp(23px, 5.5vw, 34px); margin: 0 0 10px; }
h3 { font-size: clamp(18px, 4.5vw, 22px); margin: 0 0 8px; }

p { margin: 0 0 14px; }
.lead { font-size: clamp(16px, 4vw, 19px); color: var(--text-default); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(201,169,110,0.22), transparent 60%),
    linear-gradient(180deg, var(--cream-light), var(--cream));
  text-align: center;
  padding: 56px 0 40px;
}
.hero .crown {
  width: 54px; height: 54px; margin: 0 auto 10px; display: block;
}
/* Foto real do censo no hero (Amora / Shih Tzu), em moldura circular dourada. */
.hero-foto {
  width: 120px; height: 120px; margin: 0 auto 14px; display: block;
  object-fit: cover; border-radius: 50%;
  border: 3px solid var(--gold); box-shadow: var(--shadow-card);
  background: var(--cream);
}
.assinatura {
  margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--gold-deep);
}
.selo a { color: var(--text-strong); text-decoration: underline; text-underline-offset: 2px; }
.selo a:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb { background: var(--cream-light); border-bottom: 1px solid var(--gold-soft); }
.breadcrumb ol {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 0; padding: 10px 0; list-style: none;
  font-size: 13px; color: var(--muted);
}
.breadcrumb li { display: inline-flex; align-items: center; }
.breadcrumb li + li::before { content: "›"; margin: 0 8px 0 2px; color: var(--gold-deep); }
.breadcrumb a { color: var(--royal); text-decoration: none; font-weight: 700; }
.breadcrumb a:hover, .breadcrumb a:focus-visible { text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-default); font-weight: 700; }

/* ---------- Fatos pré-renderizados (HTML textual estático) ---------- */
.fatos-lista {
  margin: 0 0 18px; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 6px;
  counter-reset: fato;
}
.fatos-lista li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: var(--cream-light);
  border: 1px solid var(--gold-soft); border-radius: var(--radius-pill);
}
/* ranking numerado (ol.fatos-lista): mostra a posição */
ol.fatos-lista li::before {
  counter-increment: fato; content: counter(fato) ".";
  color: var(--gold-deep); font-weight: 800; margin-right: 8px;
}
.fatos-lista .fato-rotulo { font-weight: 700; color: var(--text-strong); flex: 1 1 auto; min-width: 0; }
.fatos-lista .fato-valor { font-weight: 800; color: var(--royal); text-align: right; }
.fatos-pares .fato-valor { color: var(--gold-deep); }

/* ---------- Respostas diretas (GEO) ---------- */
.respostas { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.resposta {
  background: var(--cream-light); border: 1px solid var(--gold-soft);
  border-radius: 18px; padding: 14px 16px;
}
.resposta h3 { color: var(--royal); font-size: clamp(16px, 4vw, 18px); margin: 0 0 6px; }
.resposta p { margin: 0; }

/* ---------- Metodologia ---------- */
.metodologia {
  margin: 8px 0 0; padding: 16px 18px;
  background: var(--cream-light); border: 1px solid var(--gold-soft);
  border-radius: 18px;
}
.metodologia dt {
  font-weight: 800; color: var(--gold-deep);
  text-transform: uppercase; letter-spacing: 1px; font-size: 12px;
  margin-top: 12px;
}
.metodologia dt:first-child { margin-top: 0; }
.metodologia dd { margin: 2px 0 0; color: var(--text-default); }
.selo {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--cream-light);
  border: 2px solid var(--gold);
  color: var(--text-strong);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-soft);
  min-height: var(--tap);
}
.selo .stars { color: var(--gold-deep); letter-spacing: 1px; }
.amostra {
  margin-top: 18px; font-size: clamp(15px, 4vw, 18px);
  color: var(--text-default);
}

/* ---------- Molduras provençais (Galeria Real) ---------- */
.frame {
  position: relative;
  background: var(--cream-light);
  border-radius: 18px;
  padding: 8px;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-card);
}
.frame::after {
  content: "";
  position: absolute; inset: 5px;
  border: 1.5px dashed var(--gold-deep);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0.5;
}
.frame img, .frame .ph {
  display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: 12px;
  background: var(--cream);
}
.frame .ph {
  min-height: 120px;
  background: url("../img/placeholder-moldura.svg") center/cover no-repeat;
}

/* ---------- Cards grid ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 560px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--cream-light);
  border-radius: var(--radius-card);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--gold-soft);
}
.card .thumb { aspect-ratio: 1 / 1; margin-bottom: 10px; }
.card .pet-name { font-weight: 800; color: var(--text-strong); font-size: 17px; }
.card .titulos-count {
  display: inline-block; margin-top: 4px; padding: 2px 10px;
  background: var(--royal); color: var(--gold-soft);
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 800;
}
.card .titulo-nobre { color: var(--gold-deep); font-size: 14px; font-weight: 700; margin-top: 2px; }
.card .titulos-list { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.card .titulos-list li {
  font-size: 12px; background: var(--gold-soft); color: var(--wood);
  padding: 4px 10px; border-radius: var(--radius-pill);
}

/* ---------- Tosa cards ---------- */
.tosa-card .thumb { aspect-ratio: 4 / 3; }
.tosa-card .raca { font-weight: 800; color: var(--text-strong); font-size: 16px; }
.tosa-card .estilo { color: var(--gold-deep); font-weight: 700; font-size: 14px; }
.tosa-card .perfil { color: var(--muted); font-size: 13px; }

/* foto de tosa clicável: amplia no lightbox (toque/clique) e no hover (desktop) */
.tosa-thumb { cursor: zoom-in; min-height: var(--tap); transition: transform .18s ease, box-shadow .18s ease; }
.tosa-thumb:hover, .tosa-thumb:focus-visible { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-card); }
.tosa-thumb:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }

/* ---------- Lightbox das fotos ---------- */
.lb-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(26, 32, 44, 0.72);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.lb-overlay[hidden] { display: none; }
.lb-dialog {
  position: relative; width: min(92vw, 460px);
  background: var(--cream-light); border-radius: var(--radius-card);
  border: 2px solid var(--gold); box-shadow: var(--shadow-card);
  padding: 16px; text-align: center;
}
.lb-close {
  position: absolute; top: 8px; right: 8px;
  min-width: var(--tap); min-height: var(--tap);
  border: none; background: var(--gold-soft); color: var(--wood);
  border-radius: 50%; font-size: 22px; line-height: 1; font-weight: 800;
  cursor: pointer;
}
.lb-close:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }
.lb-frame { aspect-ratio: 1 / 1; margin: 6px auto 12px; }
.lb-caption .lb-nome { font-weight: 800; color: var(--text-strong); font-size: 19px; }
.lb-caption .lb-titulo { color: var(--gold-deep); font-weight: 700; font-size: 15px; margin-top: 2px; }

/* ---------- Acordeão "Ver dados completos" ----------
   A tabela/lista é conteúdo real no HTML (indexável), apenas inicialmente recolhida.
   O gráfico é a apresentação; o fato principal fica em texto visível fora do acordeão. */
.dados-detalhe { margin: 14px 0 4px; border-top: 1px solid var(--gold-soft); }
.dados-detalhe > summary {
  cursor: pointer; list-style: none; padding: 12px 2px; min-height: var(--tap);
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; color: var(--gold-deep); font-size: 14px; user-select: none;
}
.dados-detalhe > summary::-webkit-details-marker { display: none; }
.dados-detalhe > summary::after {
  content: "▾"; margin-left: auto; transition: transform .2s ease; color: var(--gold-deep);
}
.dados-detalhe[open] > summary::after { transform: rotate(180deg); }
.dados-detalhe > summary:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 6px; }
.dados-detalhe .fatos-lista { margin-top: 4px; }

/* ---------- Gráficos ---------- */
.chart {
  width: 100%;
  background: var(--cream-light);
  border-radius: var(--radius-card);
  border: 1px solid var(--gold-soft);
  box-shadow: var(--shadow-soft);
  padding: 10px;
}

/* ---------- Coluna de avatares alinhada ao eixo Y (gráficos 1, 2 e 4) ----------
   Overlay posicionado por JS (CensoAvatarAxis): cada avatar fica na MESMA linha da sua
   barra/célula, incluindo a 1ª e a última categoria. Fotos redondas (1/2) ou quadradas (4). */
#grafico1, #grafico2, #grafico4 { position: relative; }
.avatar-axis { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.avatar-axis-cell {
  position: absolute; overflow: hidden;
  background: var(--cream);
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-soft);
}
.avatar-axis-cell.avatar-circle { border-radius: 50%; }
.avatar-axis-cell.avatar-square { border-radius: 8px; }
.avatar-axis-cell img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
}
.avatar-axis-cell .avatar-ph {
  width: 100%; height: 100%;
  background: url("../img/placeholder-moldura.svg") center/cover no-repeat, var(--cream);
}

/* ---------- Rostinhos REDONDOS do quadrante (gráfico 5) ---------- */
#grafico5 { position: relative; }
.quadrante-faces { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.quadrante-face {
  position: absolute; overflow: hidden; border-radius: 50%;
  background: var(--cream);
  border: 3px solid var(--gold);
  box-shadow: var(--shadow-card);
  pointer-events: auto;
  transition: transform .18s ease, box-shadow .18s ease, z-index 0s;
}
.quadrante-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.quadrante-face .avatar-ph {
  width: 100%; height: 100%;
  background: url("../img/placeholder-moldura.svg") center/cover no-repeat, var(--cream);
}
.quadrante-face:hover, .quadrante-face:focus-within {
  transform: scale(1.18); z-index: 5;
  box-shadow: 0 12px 30px rgba(42, 58, 99, 0.28);
}
.chart-tall { height: 420px; }
.chart-med { height: 340px; }
.chart-square { aspect-ratio: 1 / 1; width: 100%; height: auto; }

/* grafico1 ("As raças de Santa Felicidade") e grafico2 ("Cada raça e sua tosa"):
   rostinhos MAIORES (64/60px) exigem contêiner mais alto para que as 11 raças caibam
   sem corte e cada avatar tenha folga na sua linha (~69px por linha). */
#grafico1 { height: 760px; }
#grafico2 { height: 740px; }

/* nuvem de nomes: mais altura para espaçar os 40 nomes sem transbordar nem descartar */
#grafico-nomes { height: 420px; }

/* heatmap: scroll-x isolado com coluna sticky controlada pelo ECharts grid.
   Avatares quadrados maiores (60px) em 8 raças → ~67px por linha. */
.heatmap-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heatmap-inner { min-width: 560px; height: 560px; }

/* ---------- Legendas colapsáveis (chips) ---------- */
.legend-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.chip {
  min-height: var(--tap); display: inline-flex; align-items: center;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--gold); background: var(--cream-light);
  color: var(--text-default); font-size: 13px; font-weight: 700;
  cursor: pointer; user-select: none;
}
.chip[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold-deep); }

/* ---------- Hall faixas ---------- */
.hall-faixa h3 { color: var(--royal); margin-top: 4px; }
.raras {
  margin-top: 14px; padding: 14px 16px; border-radius: 18px;
  background: linear-gradient(180deg, var(--cream-light), var(--gold-soft));
  border: 1.5px solid var(--gold);
}
.raras ul { margin: 8px 0 0; padding-left: 18px; }
.raras li { margin: 2px 0; }

/* medalhas raras lado a lado (mobile-first: embrulha em telas estreitas) */
.raras-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px;
}
@media (min-width: 560px) { .raras-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 760px) { .raras-grid { grid-template-columns: repeat(4, 1fr); } }
.raras-card {
  background: var(--cream-light); border: 1.5px solid var(--gold-soft);
  border-radius: 18px; padding: 12px; text-align: center;
  min-height: var(--tap);
}
.raras-card .raras-medal {
  width: 72px; height: 72px; margin: 0 auto 8px;
}
.raras-card .raras-medal img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.raras-card .raras-medal .ph {
  width: 100%; height: 100%; min-height: 0; border-radius: 10px;
  background: url("../img/placeholder-moldura.svg") center/contain no-repeat;
}
.raras-card .raras-nome { font-weight: 800; color: var(--text-strong); font-size: 14px; }
.raras-card .raras-sig { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.raras-card .raras-pct { color: var(--royal); font-weight: 800; font-size: 13px; margin-top: 6px; }

/* ---------- Reviews ---------- */
.quotes { margin-top: 10px; }
.quote {
  background: var(--cream-light); border-left: 4px solid var(--gold);
  border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-soft);
}
.quote p { font-style: italic; margin: 0 0 6px; }
.quote .autor { font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- Idade / nomes ---------- */
.pill-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; padding: 0; list-style: none; }
.pill-list li {
  background: var(--cream-light); border: 1.5px solid var(--gold-soft);
  border-radius: var(--radius-pill); padding: 10px 16px; font-weight: 700;
  color: var(--text-strong); font-size: 15px;
}
.pill-list li span { color: var(--gold-deep); margin-left: 6px; font-size: 13px; }

/* ---------- CTA ---------- */
.cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 14px 26px; margin-top: 6px;
  background: var(--purple); color: #fff; font-weight: 800;
  border: none; border-radius: var(--radius-pill); font-size: 16px;
  text-decoration: none; box-shadow: 0 8px 22px rgba(98,45,249,0.28);
}
.cta:focus-visible { outline: 3px solid var(--gold-deep); outline-offset: 2px; }

/* ---------- Footer ---------- */
footer:not(.rp-footer) { background: var(--royal); color: #e8edf7; padding: 30px 0; text-align: center; }
footer:not(.rp-footer) a { color: var(--gold-soft); }

/* ---------- Divisória coroa ---------- */
.divider { text-align: center; color: var(--gold); margin: 6px 0 18px; font-size: 20px; }

/* ---------- Acessibilidade / foco ---------- */
a, button, [tabindex] { outline-offset: 2px; }
:focus-visible { outline: 3px solid var(--gold-deep); }

/* Evitar CLS: contêineres de gráfico já reservam altura. */
img { max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
