/* ==========================================================================
   Filhos Saudáveis — stylesheet
   Design tokens carried over from the original Squarespace theme.
   Original used Adobe Fonts (futura-pt, proxima-nova), which are licensed per
   Squarespace subscription and cannot be reused off-platform. Substituted with
   Jost (geometric sans, closest free match to Futura PT) and Source Sans 3
   (humanist sans, closest free match to Proxima Nova), self-hosted below.
   ========================================================================== */

/* --- Self-hosted fonts (no external requests, no Google Fonts dependency) ---
   These are variable fonts: one file covers the whole weight range, so the
   font-weight descriptor below is a range, not a single value. */
@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin-var.woff2') format('woff2-variations'),
       url('../fonts/jost-latin-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-latin-var.woff2') format('woff2-variations'),
       url('../fonts/source-sans-3-latin-var.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/source-sans-3-latin-var-italic.woff2') format('woff2-variations'),
       url('../fonts/source-sans-3-latin-var-italic.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #fafafa;
  --text: rgba(18, 17, 17, 0.72);   /* original was .5 alpha; darkened for WCAG AA */
  --text-strong: rgba(18, 17, 17, 0.95);
  --heading: #121111;
  --rule: rgba(18, 17, 17, 0.13);
  --accent: #1a6b8f;
  --accent-hover: #124e69;
  --font-heading: 'Jost', 'Futura', 'Century Gothic', 'Avenir Next', sans-serif;
  --font-body: 'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --measure: 46rem;
  --gutter: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;      /* 18px, matches original */
  line-height: 1.8;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Skip link (accessibility) --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--heading);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

/* --- Layout --- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Header --- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 1.75rem 0 1.25rem;
}
.site-header .wrap { max-width: 62rem; }

.brand {
  display: block;
  text-align: center;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.25rem, 3.2vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--heading);
  text-decoration: none;
  margin-bottom: 1.25rem;
}
.brand:hover { color: var(--accent); }

/* Mobile menu toggle — hidden on desktop, shown under 46rem */
.nav-toggle {
  display: none;
  margin: 0 auto 0.5rem;
  padding: 0.55rem 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--heading);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
}
.site-nav a {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--heading);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--heading); }
.site-nav a[aria-current="page"]:hover { border-bottom-color: var(--accent); }

.site-nav--secondary {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--rule);
}
.site-nav--secondary a {
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  color: var(--text);
}
.site-nav--secondary a[aria-current="page"] { color: var(--heading); }

/* --- Main --- */
main { padding: 3.5rem 0 4rem; }

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--heading);
}
h1 {
  font-weight: 600;
  font-size: clamp(1.85rem, 5vw, 2.5rem);   /* original 40px */
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}
h2 {
  font-weight: 700;
  font-size: 0.875rem;      /* original 14px uppercase */
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.7;
  margin: 2.75rem 0 0.75rem;
}
h3 {
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.7;
  margin: 2rem 0 0.5rem;
}
h1 + p, h2 + p, h3 + p { margin-top: 0; }

p { margin: 0 0 1.25rem; }
strong { color: var(--text-strong); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

ul, ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
li { margin-bottom: 0.6rem; }
li > p { margin-bottom: 0.4rem; }
li > p:last-child { margin-bottom: 0; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 3rem 0;
}

/* Indented detail lines — mirrors the original's margin-left:40px paragraphs */
.detail {
  margin-left: 2.5rem;
  margin-bottom: 0.5rem;
}
.detail .label { text-decoration: underline; }
@media (max-width: 34rem) {
  .detail { margin-left: 1rem; }
}

/* --- Figures / images --- */
figure {
  margin: 2.5rem 0;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  margin-inline: auto;
}
figure.narrow img { max-width: 34rem; }
figcaption {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  text-align: center;
  color: var(--text);
}

/* Wide diagrams may exceed the text measure and scroll on small screens */
.figure-wide {
  margin: 2.5rem 0;
  overflow-x: auto;
}
.figure-wide img {
  display: block;
  width: 100%;
  min-width: 30rem;
  height: auto;
}

/* --- Hero --- */
.hero { margin: 0 0 3rem; }
.hero img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Card links (Squarespace "collection link" blocks) --- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
  margin: 2rem 0 1rem;
  padding: 0;
  list-style: none;
}
.card {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1.75rem 1.5rem;
  background: #fff;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
/* Card titles follow the original's "collection link" styling: body font at
   1.2em, sentence case — not the uppercase h2 treatment used elsewhere. */
.card h2, .card h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: 1.2em;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  line-height: 1.3;
}
.card h2 a, .card h3 a {
  color: var(--heading);
  text-decoration: none;
}
.card:hover h2 a, .card:hover h3 a { color: var(--accent); }
.card p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* --- FAQ ---
   Questions keep the theme's uppercase h2 treatment (see the h2 rule above),
   matching the original site. To render them as larger sentence-case headings
   instead, see the "Typography" note in README.md. */
.faq-item { margin-bottom: 0; }
.faq-item h2 { margin: 0 0 0.75rem; }
.faq-item > p:last-child { margin-bottom: 0; }

/* --- Events --- */
.event { margin-bottom: 0; }
.event h2, .event h3 { margin: 1.5rem 0 0.75rem; }
.event img { max-width: 26rem; }

/* --- Data tables (disease list, lab comparison) --- */
.data-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;      /* forces horizontal scroll inside .figure-wide on phones */
  font-size: 0.95rem;
  line-height: 1.45;
}
.data-table caption { text-align: left; }
.data-table th,
.data-table td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  text-align: left;
}
.data-table thead th {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--heading);
  border-bottom: 2px solid var(--rule);
  background: #f2f2f2;
  white-space: nowrap;
}
.data-table tbody th[scope="row"] {
  font-weight: 600;
  color: var(--text-strong);
}
.data-table tbody tr:nth-child(even) { background: rgba(18,17,17,0.025); }
.data-table .th-note,
.data-table .cell-note,
.data-table .gene-note {
  font-weight: 400;
  font-size: 0.82em;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

/* --- Callouts --- */
.callout {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: #fff;
}
.callout p { margin: 0 0 0.6rem; }
.callout p:last-child { margin-bottom: 0; }
.callout--info { border-left: 4px solid var(--accent); background: #eef4f8; }
.callout--stat {
  border: 0;
  background: var(--heading);
  color: #fff;
  text-align: center;
  padding: 1.75rem 1.5rem;
}
.callout--stat .stat-number {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(2.5rem, 9vw, 4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}
.callout--stat .stat-text {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.85);
  max-width: 24rem;
  margin: 0 auto;
}

/* --- Buttons / calls to action --- */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 3px;
  border: 2px solid transparent;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; text-decoration: none; }
.btn--ghost { color: var(--accent); border-color: var(--accent); }
.btn--ghost:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn--whatsapp { background: #25d366; border-color: #25d366; color: #0b3d1e; }
.btn--whatsapp:hover { background: #1db757; border-color: #1db757; color: #0b3d1e; text-decoration: none; }

/* --- Checklist ("Isto se aplica a mim?") --- */
.checklist {
  list-style: none;
  padding-left: 0;
  margin: 1.25rem 0;
}
.checklist li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.85rem;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 3px;
  background: var(--accent);
  /* white check mark */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.5 3.5L13 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.9rem;
}

/* --- Numbered "Comece aqui" steps --- */
.steps { padding-left: 0; list-style: none; counter-reset: step; }
.steps > li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.1rem;
  min-height: 2rem;
}
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Review-date stamp --- */
.review-stamp {
  font-size: 0.9rem;
  color: var(--text);
  background: rgba(18,17,17,0.04);
  border-radius: 3px;
  padding: 0.6rem 0.9rem;
}

/* --- Share block --- */
.share {
  margin: 2.5rem 0 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

/* --- Misc utilities --- */
.fine-print { font-size: 0.85rem; color: var(--text); }
.footer-fine { font-size: 0.85rem; color: var(--text); }
.section-heading { }
.cell-note { display: inline-block; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 3rem;
  font-size: 0.9375rem;
  text-align: center;
}
.site-footer p { margin: 0 0 0.5rem; }
.site-footer p:last-child { margin-bottom: 0; }

/* --- Responsive --- */
@media (max-width: 46rem) {
  main { padding: 2.5rem 0 3rem; }

  .nav-toggle { display: block; }

  /* Collapsed by default on mobile; nav.js toggles [data-open]. */
  .nav-menu { display: none; }
  .nav-menu[data-open="true"] { display: block; }
  .site-nav ul { flex-direction: column; align-items: center; gap: 0.25rem; }
  .site-nav a { display: block; padding: 0.5rem 0; }
  .site-nav--secondary { margin-top: 0.5rem; padding-top: 0.75rem; }

  .figure-wide img { min-width: 24rem; }
}

/* No JS: never hide the nav behind a toggle that cannot open. */
.no-js .nav-toggle { display: none; }
.no-js .nav-menu { display: block; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}

@media print {
  .site-header nav, .nav-toggle, .skip-link { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}
