/* Tradifoods — Fase 1 prototype. Ver design-plan.md para racional. */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=IBM+Plex+Sans:wght@400;500;600&display=swap");

:root {
  --brand: #1c4070;
  --brand-soft: #7791a0;
  --ink: #12233d;
  --ink-soft: #4d6478; /* validado contra os 3 fundos onde é usado: paper 5.80:1, paper-sunk 5.38:1, e1e6ec (hero-band) 4.91:1 — a ronda 4 apanhou que o valor da ronda 3 (#536B7E) só tinha sido validado contra 2 dos 3 */
  --paper: #f7f8fa;
  --paper-sunk: #edf0f3;
  --rule: #dce2e6;
  --straw: #d9b24c;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", -apple-system, Segoe UI, Roboto, sans-serif;

  --space: 8px;
  --content-max: 1200px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: 2.75rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
p { margin: 0 0 1em; }

a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.site-nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; }
.brand-mark { font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; color: var(--ink); text-decoration: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: 24px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink); text-decoration: none; font-size: 0.9375rem; }
.nav-links a:hover { color: var(--brand); }
.nav-links a[aria-current="page"] { color: var(--brand); font-weight: 600; }
.lang-switch { display: flex; gap: 4px; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.lang-switch button { border: none; background: var(--paper); color: var(--ink-soft); padding: 4px 10px; font: inherit; font-size: 0.8125rem; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--brand); color: var(--paper); }
.nav-toggle { display: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-block; padding: 12px 20px; border-radius: 4px; border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; font-size: 0.9375rem; }
.btn-primary { background: var(--straw); color: var(--ink); }
.btn-primary:hover { filter: brightness(0.95); }
.btn-secondary { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover { background: var(--paper-sunk); }

/* ---------- Sections ---------- */
section { padding: 56px 0; border-bottom: 1px solid var(--rule); }
section:last-of-type { border-bottom: none; }

/* ---------- Hero / origin map ----------
   Único gesto de ousadia do site (design-plan.md) — por isso ocupa a secção inteira em vez de
   partilhar com o texto, tem fundo próprio ("faixa atlântica") e os números por região são
   tipografados como as credenciais, não como uma legenda de diagrama. */
/* #E1E6EC = --brand a 10% sobre --paper — banda visivelmente distinta (a ronda 3 apontou que
   paper→paper-sunk (4% de diferença) era impercetível e a separação vinha só do filete). */
.hero-band { background: linear-gradient(180deg, var(--paper) 0%, #e1e6ec 100%); border-bottom: 1px solid var(--rule); }
.hero-band .hero { border-bottom: none; }
.hero { display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 48px; align-items: center; padding: 64px 0; }
.hero-sub { color: var(--ink-soft); font-size: 1.125rem; max-width: 46ch; }
.origin-map { width: 100%; height: auto; }
.origin-map .coast { fill: none; stroke: var(--brand-soft); stroke-width: 10; stroke-linecap: round; opacity: 0.35; }
.origin-map .region-dot { fill: var(--brand); stroke: var(--paper); stroke-width: 3; cursor: pointer; }
.origin-map .region-dot.has-dop { fill: var(--straw); }
.origin-map .region-dot:hover, .origin-map .region-dot:focus-visible { fill: var(--brand-soft); outline: none; }
.origin-map text { font-family: var(--font-body); font-size: 12px; fill: var(--ink-soft); }
.origin-map .region-count { font-family: var(--font-display); font-weight: 600; fill: var(--brand); font-size: 15px; }
.map-caption { color: var(--ink-soft); font-size: 0.875rem; margin-top: 12px; }
.map-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8125rem; color: var(--ink-soft); }
.map-legend li { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }
.legend-dot.has-dop { background: var(--straw); }

/* ---------- Credentials ---------- */
.credentials { display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-end; }
.credential .num { font-family: var(--font-display); font-size: 2.75rem; color: var(--brand); display: block; }
.credential .label { color: var(--ink-soft); }

/* ---------- Seal — segundo gesto de design (ronda 4).
   O mapa de origem é o gesto primário (design-plan.md). Este é o único outro sítio onde o
   site sai da disciplina: a credencial DOP/IGP, o argumento de venda central do projeto
   (dossier.md §3.1), passa de texto plano a selo circular — a mesma linguagem "círculo =
   significância" do mapa, aplicada só à certificação. Não decoração: é a própria informação. */
.seal-group { display: flex; gap: 14px; align-items: center; }
.seal {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--straw); color: var(--ink);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--straw);
  line-height: 1.05; flex-shrink: 0;
}
.seal .seal-num { font-family: var(--font-display); font-weight: 600; }
.seal .seal-label { font-weight: 700; letter-spacing: 0.03em; }
.seal-lg { width: 64px; height: 64px; }
.seal-lg .seal-num { font-size: 1.375rem; }
.seal-lg .seal-label { font-size: 0.5625rem; }
.seal-md { width: 40px; height: 40px; }
.seal-md .seal-label { font-size: 0.5rem; }
.seal-sm { width: 30px; height: 30px; position: absolute; top: 8px; right: 8px; }
.seal-sm .seal-label { font-size: 0.4375rem; }

/* ---------- Category grid ---------- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-top: 24px; }
.category-card { border: 1px solid var(--rule); padding: 24px; text-decoration: none; color: var(--ink); display: block; }
.category-card:hover { border-color: var(--brand); }
.category-card .count { color: var(--brand); font-family: var(--font-display); font-size: 1.75rem; }
.category-card h3 { margin-bottom: 0.25em; }
.category-card p { color: var(--ink-soft); font-size: 0.9375rem; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 40px 0; color: var(--ink-soft); font-size: 0.9375rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.footer-grid h4 { color: var(--ink); font-family: var(--font-body); font-size: 0.9375rem; margin: 0 0 0.5em; }
.footer-grid address { font-style: normal; }

/* ---------- Catalogue ---------- */
.catalogue-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.filters { border: 1px solid var(--rule); padding: 20px; }
.filter-group { margin-bottom: 20px; }
.filter-group legend { font-weight: 600; padding: 0 0 8px; }
.filter-group label { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 0.9375rem; cursor: pointer; }
.filter-group select { width: 100%; padding: 8px; border: 1px solid var(--rule); background: var(--paper); font: inherit; }
.filters-toggle { display: none; width: 100%; margin-bottom: 16px; }

.results-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.results-count { font-weight: 600; }

.cheese-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.cheese-card { border: 1px solid var(--rule); text-decoration: none; color: var(--ink); display: block; }
.cheese-card .thumb { position: relative; aspect-ratio: 4/3; background: var(--paper-sunk); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); font-size: 0.8125rem; text-align: center; padding: 8px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.cheese-card .body { padding: 12px 16px 16px; }
.cheese-card h3 { font-size: 1.0625rem; margin-bottom: 0.15em; }
.cheese-card .region { color: var(--ink-soft); font-size: 0.875rem; }
.cheese-card:hover { border-color: var(--brand); }
.tag { display: inline-block; margin-top: 8px; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 3px; }

.empty-state { border: 1px dashed var(--rule); padding: 48px 24px; text-align: center; color: var(--ink-soft); grid-column: 1 / -1; }
.empty-state h3 { color: var(--ink); }

/* ---------- Product page ---------- */
.product-header { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.product-header .thumb { aspect-ratio: 1/1; background: var(--paper-sunk); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.product-title { display: flex; align-items: center; gap: 14px; }
.product-meta { color: var(--ink-soft); margin-bottom: 8px; }
.product-cta { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.spec-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.spec-table th, .spec-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); font-size: 0.9375rem; }
.spec-table th { width: 40%; color: var(--ink-soft); font-weight: 500; }
.spec-table.example td { background: var(--paper-sunk); }
.example-note { background: var(--paper-sunk); border-left: 3px solid var(--brand-soft); padding: 12px 16px; font-size: 0.875rem; color: var(--ink-soft); margin-top: 16px; }

.pairing-list { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.pairing-card { border: 1px solid var(--rule); padding: 12px 16px; font-size: 0.9375rem; max-width: 280px; }
.pairing-card strong { display: block; margin-bottom: 4px; }

/* ---------- Motion & responsive ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .catalogue-layout { grid-template-columns: 1fr; }
  .filters { display: none; }
  .filters.open { display: block; }
  .filters-toggle { display: block; }
  .product-header { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  .nav-links { display: none; }
  .nav-toggle { display: inline-block; background: none; border: 1px solid var(--rule); padding: 6px 10px; font: inherit; }
  .nav-links.open { display: flex; flex-direction: column; width: 100%; order: 3; }
  .site-nav { flex-wrap: wrap; }
  .credentials { gap: 24px; }
}
