/* petkilo — estilos base */
:root {
  --paper: #f6f8f3;
  --paper-2: #edf1e8;
  --ink: #17231c;
  --ink-2: #4b5a50;
  --line: #d3dbd1;
  --brand: #1f5a3a;
  --brand-ink: #143f28;
  --brand-soft: #dfeee3;
  --mark: #e39b12;
  --mark-soft: #fbefcf;
  --mark-ink: #6b4300;
  --danger: #a33a2a;
  --focus: #1f5a3a;
  --radius: 6px;
  --measure: 66ch;
  --font: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  font-optical-sizing: auto;
}

a { color: var(--brand-ink); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

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

img, svg { display: block; }

.wrap {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

/* Cabecera */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.logo .mark {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid; place-items: center;
  letter-spacing: 0;
}
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 15px;
}
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--brand); }
.site-nav a:hover { color: var(--ink); }

/* Portada */
.hero {
  padding: 56px 0 28px;
}
.hero h1 {
  font-size: clamp(34px, 5.2vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 18px;
  max-width: 20ch;
}
.hero p {
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 19px;
  margin: 0;
}

/* Calculadora */
.calc {
  margin: 30px 0 10px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  align-items: end;
}
.calc label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 500;
}
.calc input[type="number"], .calc select, .filters input[type="search"] {
  font: inherit;
  font-size: 17px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  min-width: 150px;
}
.calc input[type="number"] { width: 120px; min-width: 0; }
.calc output {
  font-size: 15px;
  color: var(--ink);
  flex-basis: 100%;
}
.calc output strong { font-weight: 700; }

/* Filtros */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 22px 0 14px;
}
.chip {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.filters input[type="search"] { margin-left: auto; min-width: 200px; }

/* Tabla */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.prices {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.prices th, .prices td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.prices thead th {
  background: var(--paper-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.prices th button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.prices th button::after {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--line);
}
.prices th[aria-sort="ascending"] button::after { border-top: none; border-bottom: 5px solid var(--brand); }
.prices th[aria-sort="descending"] button::after { border-top-color: var(--brand); }
.prices th[aria-sort] button { color: var(--ink); }

.prices td.num, .prices th.num { text-align: right; }
.prices td.num { white-space: nowrap; }
.prices tbody tr:last-child td { border-bottom: none; }
.prices .name a { font-weight: 600; text-decoration: none; }
.prices .name a:hover { text-decoration: underline; }
.prices .name small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.prices td.key { font-weight: 700; font-size: 18px; }
.prices td.missing { color: var(--ink-2); }
.prices td.missing abbr { text-decoration: none; border-bottom: 1px dotted var(--ink-2); cursor: help; }

.prices tr.best td.key {
  background: var(--mark-soft);
  color: var(--mark-ink);
  box-shadow: inset 3px 0 0 var(--mark);
}
.best-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--mark-ink);
  background: var(--mark-soft);
  border: 1px solid var(--mark);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}

.table-note {
  font-size: 14px;
  color: var(--ink-2);
  margin: 12px 0 0;
  max-width: var(--measure);
}
.empty {
  padding: 28px;
  text-align: center;
  color: var(--ink-2);
}

/* Bloques de texto */
.prose {
  max-width: var(--measure);
  padding: 40px 0 60px;
}
.prose h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
}
.prose h2 {
  font-size: 24px;
  letter-spacing: -0.015em;
  margin: 36px 0 10px;
}
.prose h3 { font-size: 18px; margin: 24px 0 6px; }
.prose p, .prose li { color: var(--ink); }
.prose .lede { font-size: 19px; color: var(--ink-2); }
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
  margin: 14px 0 20px;
  background: #fff;
  border: 1px solid var(--line);
}
.prose th, .prose td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { background: var(--paper-2); font-weight: 600; font-size: 14px; }
.prose td.num, .prose th.num { text-align: right; }
.prose code { background: var(--paper-2); padding: 2px 6px; border-radius: 4px; font-size: 0.92em; }
.prose .formula {
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  padding: 12px 16px;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.prose .placeholder { background: var(--mark-soft); padding: 0 4px; border-radius: 3px; }

.findings {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.findings h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; margin: 0 0 6px; }
.findings-note { color: var(--ink-2); margin: 0 0 24px; font-size: 15px; }
.findings-grid { display: grid; gap: 22px 32px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.findings-grid > div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 22px 8px; }
.findings .big { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; color: var(--brand); margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.findings h3 { font-size: 18px; letter-spacing: -0.01em; margin: 0 0 8px; }
.findings p { margin: 0 0 14px; color: var(--ink-2); font-size: 15px; }

.guide-list { display: grid; gap: 14px; margin-top: 26px; }
.guide {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.guide:hover { border-color: var(--brand); color: inherit; }
.guide h2 { margin: 0 0 6px; font-size: 20px; color: var(--brand-ink); }
.guide p { margin: 0; color: var(--ink-2); font-size: 15px; }
.prose ol { padding-left: 22px; }

.home-more {
  padding: 40px 0 60px;
  display: grid;
  gap: 28px 40px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 8px;
}
.home-more h2 { font-size: 20px; margin: 0 0 8px; letter-spacing: -0.01em; }
.home-more p { margin: 0; color: var(--ink-2); font-size: 16px; }

/* Pie */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: 28px 0 36px;
  font-size: 14px;
  color: var(--ink-2);
}
.site-foot .wrap { display: grid; gap: 14px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-foot a { color: var(--ink-2); }
.site-foot p { margin: 0; max-width: 80ch; }

/* Móvil */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 14px; }
  .hero { padding-top: 36px; }
  .hero p { font-size: 17px; }
  .site-head .wrap { flex-wrap: wrap; padding: 10px 0; }
  .site-nav { flex-basis: 100%; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; }
  .prices th.opt, .prices td.opt { display: none; }
  .prices th, .prices td { padding: 10px 8px; }
  .prices td.key { font-size: 16px; }
  .prices .name a { font-size: 15px; }
  .best-tag { display: block; width: max-content; margin: 3px 0 0 auto; }
  .filters input[type="search"] { margin-left: 0; flex-basis: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .chip, .prices th button { transition: background-color .15s, color .15s; }
}
