:root {
  color-scheme: light;
  --ink: #16201f;
  --muted: #5c6b68;
  --paper: #f7f9f6;
  --paper-2: #ffffff;
  --panel: rgba(255, 255, 255, 0.88);
  --line: #d6ded9;
  --forest: #0f5147;
  --moss: #618544;
  --acid: #d6ff69;
  --clay: #c15f42;
  --amber: #e7a93f;
  --water: #217f8c;
  --rose: #b94a5d;
  --lavender: #74629b;
  --danger: #a83232;
  --shadow: 0 18px 46px rgba(20, 35, 32, 0.11);
  --shadow-lg: 0 28px 72px rgba(20, 35, 32, 0.16);
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Fira Code', 'Courier New', Courier, monospace;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f9f6 0%, #edf4f0 54%, #f8faf8 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
}

body.gestante-theme {
  background: linear-gradient(180deg, #fff8fa 0%, #f4f1fb 48%, #f8faf8 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(22, 32, 31, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 32, 31, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

img, svg { max-width: 100%; }

a { color: inherit; }

p { margin: 0; }
p + p { margin-top: 0.75em; }

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: 18px;
  top: -80px;
  z-index: 99;
  background: var(--ink);
  color: white;
  padding: 10px 14px;
  border-radius: 999px;
}

.skip-link:focus { top: 18px; }

:focus-visible {
  outline: 3px solid rgba(33, 127, 140, 0.75);
  outline-offset: 3px;
}

/* ── Navigation ── */

.topbar {
  position: sticky;
  top: 14px;
  z-index: 10;
  margin: 14px auto 36px;
  padding: 10px;
  border: 1px solid rgba(22, 32, 31, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(20, 35, 32, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  scrollbar-width: thin;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  padding: 8px 14px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--forest);
  color: var(--acid);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
}

.nav a:not(.brand) {
  padding: 9px 14px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav a:not(.brand):hover,
.nav a.active {
  background: var(--ink);
  color: var(--paper-2);
  transform: translateY(-1px);
}

/* ── Hero ── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
  gap: var(--space-6);
  align-items: stretch;
  margin-bottom: var(--space-8);
}

.hero-card,
.panel,
.choice-card,
.metric-card,
.result-card,
.parasite-card,
.check-card,
.timeline-card,
.reference-card {
  border: 1px solid rgba(23, 32, 27, 0.11);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 68px);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(15, 81, 71, 0.07), transparent 44%),
    var(--panel);
}

.hero-card::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(42%, 280px);
  height: 10px;
  background: linear-gradient(90deg, var(--forest), var(--water), var(--rose));
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--forest);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker::before {
  content: '';
  width: 32px;
  height: 2px;
  background: currentColor;
}

h1, h2, h3 { line-height: 1.1; }

h1 {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 5rem);
  letter-spacing: -0.02em;
}

.hero-card > p {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: var(--space-5) 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.65;
}

.hero-side {
  display: grid;
  gap: var(--space-4);
}

.status-box {
  display: block;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--forest);
  color: #f7ffee;
  box-shadow: var(--shadow);
}

.status-link { text-decoration: none; }
.status-link:hover { transform: translateY(-2px); }

.status-box strong {
  display: block;
  margin-bottom: 10px;
  color: var(--acid);
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.15;
}

.status-box p { color: rgba(247, 255, 238, 0.76); }

.safety-ribbon {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(174, 47, 43, 0.22);
  background: #fff2ec;
  color: #6e211d;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ── Grids ── */

.grid-4,
.grid-3,
.grid-2 {
  display: grid;
  gap: 20px;
}

.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Sections ── */

.section {
  margin: var(--space-12) 0;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: var(--space-5);
}

.section-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  letter-spacing: -0.02em;
}

.section-title p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Cards ── */

.choice-card,
.metric-card,
.parasite-card,
.check-card,
.reference-card,
.timeline-card {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  padding: var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.choice-card:hover,
.parasite-card:hover,
.reference-card:hover {
  transform: translateY(-4px);
  border-color: rgba(23, 61, 42, 0.32);
  box-shadow: var(--shadow-lg);
}

.parasite-card[href] {
  cursor: pointer;
}

.choice-card .num,
.metric-card .num {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-6);
  border-radius: 8px;
  background: var(--ink);
  color: var(--acid);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.choice-card h3,
.metric-card h3,
.parasite-card h3,
.check-card h3,
.reference-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.choice-card p,
.metric-card p,
.parasite-card p,
.check-card p,
.reference-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-4);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(23, 32, 27, 0.08);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge.green { background: rgba(111, 143, 68, 0.16); color: #476322; }
.badge.orange { background: rgba(200, 105, 53, 0.16); color: #8b431b; }
.badge.blue { background: rgba(49, 123, 131, 0.16); color: #1f5b61; }
.badge.red { background: rgba(174, 47, 43, 0.16); color: #8e2521; }
.badge.purple { background: rgba(116, 98, 155, 0.16); color: #574582; }

.panel {
  padding: clamp(22px, 4vw, 36px);
  border-radius: var(--radius-lg);
}

/* ── Symptom checker ── */

.symptom-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.symptom-listing {
  display: grid;
  gap: var(--space-3);
}

.symptom-group {
  border: 1px solid rgba(23, 32, 27, 0.1);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.44);
  overflow: hidden;
}

.symptom-group summary {
  cursor: pointer;
  padding: 18px 20px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.symptom-options {
  display: grid;
  gap: 6px;
  padding: 0 12px 14px;
}

.option {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.94rem;
  transition: background 160ms ease, color 160ms ease;
}

.option:hover { background: rgba(23, 32, 27, 0.06); color: var(--ink); }
.option input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--forest); }
.option:has(input:checked) { background: rgba(111, 143, 68, 0.15); color: var(--ink); }

.result-card {
  position: sticky;
  top: 104px;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: #f8f3e8;
}

.result-card.low .risk-fill { background: var(--moss); }
.result-card.medium .risk-fill { background: var(--water); }
.result-card.high .risk-fill { background: var(--amber); }
.result-card.urgent .risk-fill { background: var(--danger); }

.risk-number {
  margin: 8px 0;
  color: var(--acid);
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5rem);
  line-height: 1;
}

.risk-bar {
  overflow: hidden;
  height: 12px;
  margin: var(--space-4) 0 var(--space-5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
}

.risk-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--moss), var(--amber), var(--danger));
  transition: width 240ms ease;
}

.result-card h3 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.7rem; }
.result-card p { color: rgba(248, 243, 232, 0.76); font-size: 0.94rem; }
.result-card ul { padding-left: 1.2rem; color: rgba(248, 243, 232, 0.82); font-size: 0.94rem; }

/* ── Lab form ── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(23, 32, 27, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.95rem;
}

.field input:focus,
.field select:focus {
  border-color: var(--water);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 127, 140, 0.18);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: var(--space-5);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font: 600 0.9rem var(--font-body);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(22, 32, 31, 0.22); }

.btn.secondary {
  background: rgba(23, 32, 27, 0.08);
  color: var(--ink);
}

.lab-output,
.inline-output {
  margin-top: var(--space-5);
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(23, 32, 27, 0.05);
}

.lab-output h3,
.inline-output h3 { margin: 0 0 8px; font-family: var(--font-display); }

/* ── Alerts ── */

.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 32, 27, 0.11);
  background: #fff8e7;
  color: #65470e;
  font-size: 0.93rem;
  line-height: 1.6;
}

.alert.danger { background: #fff0ee; color: #6e211d; border-color: rgba(174, 47, 43, 0.22); }
.alert.safe { background: #eff7e5; color: #344f18; border-color: rgba(111, 143, 68, 0.22); }
.alert.info { background: #eef8f8; color: #1e565c; border-color: rgba(49, 123, 131, 0.22); }
.alert.pregnancy { background: #fff1f3; color: #70303d; border-color: rgba(185, 74, 93, 0.22); }

/* ── Filters ── */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-btn {
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid rgba(23, 32, 27, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  font: 500 0.875rem var(--font-body);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.filter-btn:hover { background: rgba(255, 255, 255, 0.9); color: var(--ink); }

.filter-btn.active {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

.parasite-card small,
.reference-card small {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--clay);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Checklists ── */

.check-card ul,
.clean-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}

.check-card li,
.clean-list li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.clean-list li > span:first-child {
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 4px;
  background: var(--moss);
  box-shadow: 0 0 0 5px rgba(111, 143, 68, 0.12);
}

.check-card input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--forest); }
.check-card li.done span { color: var(--ink); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(111, 143, 68, 0.55); }

.progress-pill {
  display: inline-flex;
  margin-top: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(23, 32, 27, 0.07);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Gestante theme ── */

.gestante-hero .hero-card::after { background: linear-gradient(90deg, var(--rose), var(--lavender)); }
.gestante-hero .status-box { background: #5d486f; }
.gestante-hero .status-box strong { color: #ffe1e7; }

/* ── Footer ── */

.footer {
  margin-top: var(--space-16);
  padding: var(--space-6) 0 var(--space-12);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(23, 32, 27, 0.11);
  padding-top: 20px;
}

/* ── Detail page ── */

.detail-hero {
  margin-bottom: var(--space-8);
}

.detail-hero .hero-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: var(--space-6);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.detail-meta .badge { font-size: 0.8rem; min-height: 28px; }

.detail-lead {
  grid-column: 1 / -1;
  margin-top: var(--space-5) !important;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(23, 32, 27, 0.07);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
  white-space: nowrap;
}

.back-link:hover { background: rgba(23, 32, 27, 0.13); color: var(--ink); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-5);
  align-items: start;
}

.detail-main {
  display: grid;
  gap: var(--space-5);
}

.detail-section {
  padding: var(--space-6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 32, 27, 0.11);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(23, 32, 27, 0.07);
  font-size: 1rem;
  flex-shrink: 0;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.tag-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(23, 32, 27, 0.04);
  color: var(--ink);
  font-size: 0.93rem;
  line-height: 1.55;
}

.tag-list li::before {
  content: '→';
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--forest);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.tag-list.red li { background: rgba(174, 47, 43, 0.06); }
.tag-list.red li::before { color: var(--danger); }
.tag-list.orange li { background: rgba(200, 105, 53, 0.06); }
.tag-list.orange li::before { color: var(--clay); }
.tag-list.blue li { background: rgba(33, 127, 140, 0.06); }
.tag-list.blue li::before { color: var(--water); }

.detail-sidebar {
  display: grid;
  gap: var(--space-4);
}

.sidebar-card {
  padding: var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(23, 32, 27, 0.11);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar-card h3 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.sidebar-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.not-found-state {
  text-align: center;
  padding: var(--space-16) 0;
  color: var(--muted);
}

.not-found-state h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  margin: 0 0 var(--space-4);
}

/* ── Animations ── */

.fade-in {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal 480ms ease forwards;
}

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */

@media (max-width: 960px) {
  .hero,
  .detail-hero .hero-card,
  .detail-grid,
  .symptom-board,
  .grid-4,
  .grid-3,
  .grid-2,
  .form-grid { grid-template-columns: 1fr; }

  .result-card { position: static; }
  .section-title { align-items: start; flex-direction: column; }
  .nav { overflow-x: auto; padding-bottom: 2px; }
  .nav a:not(.brand) { white-space: nowrap; }
  .back-link { display: none; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 24px, 1120px); }
  .topbar { border-radius: 20px; }
  .nav { flex-wrap: nowrap; align-items: stretch; }
  .brand { flex: 0 0 auto; }
  .brand span:last-child { max-width: 130px; white-space: normal; line-height: 1.1; }
  .hero-card, .panel, .status-box { border-radius: var(--radius-md); }
  .choice-card, .metric-card, .parasite-card, .check-card, .reference-card { padding: 20px; }
  h1 { font-size: clamp(2.1rem, 11vw, 3rem); }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
