/* Plantilla común de micronichos.
   Concepto: guía de compra con aire de etiqueta de laboratorio. Datos en monoespaciada, texto largo en serif legible.
   Los colores de acento se sobrescriben por nicho desde config.py. */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #16191d;
  --muted: #5a6168;
  --line: #dde1e3;
  --soft: #eef1f4;
  --accent: #2443c9;
  --accent-ink: #ffffff;
  --cta: #e2560f;
  --cta-hover: #c24608;
  --on-cta: #ffffff;
  --good: #2f7d4f;
  --bad: #b23a3a;
  --star: #e0a100;

  --f-display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Newsreader", Georgia, "Times New Roman", serif;
  --f-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 8px;
  --wrap: 1120px;
  --text: 68ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111417; --surface: #181c20; --ink: #e8ebee; --muted: #a2aab1; --line: #2a3036; --soft: #1f2429;
    --accent: #7d95ff; --accent-ink: #0d1020; --cta: #f06a24; --cta-hover: #ff7d3b; --on-cta: #ffffff;
    --good: #6fc795; --bad: #f08c8c; --star: #f2c14e; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111417; --surface: #181c20; --ink: #e8ebee; --muted: #a2aab1; --line: #2a3036; --soft: #1f2429;
  --accent: #7d95ff; --accent-ink: #0d1020; --cta: #f06a24; --cta-hover: #ff7d3b; --on-cta: #ffffff;
  --good: #6fc795; --bad: #f08c8c; --star: #f2c14e; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.14rem/1.65 var(--f-body); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; }
h3 { font-size: 1.22rem; font-weight: 700; }
.eyebrow { font: 600 0.78rem/1 var(--f-data); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.data { font-family: var(--f-data); font-variant-numeric: tabular-nums; }

/* Cabecera */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font: 800 1.2rem/1 var(--f-display); letter-spacing: -0.02em; }
.logo-mark { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font: 700 0.78rem/1 var(--f-data); }
.nav { display: flex; gap: 0.3rem 1.2rem; flex-wrap: wrap; font: 600 0.95rem/1.2 var(--f-display); }
.nav a { color: var(--ink); text-decoration: none; padding-block: 0.4rem; }
.nav a:hover, .nav a[aria-current] { color: var(--accent); }
@media (max-width: 640px) { .site-header .wrap { padding-block: 0.6rem; } .nav { width: 100%; gap: 0.2rem 1rem; font-size: 0.9rem; } }

/* Hero */
.hero { padding-block: clamp(2rem, 5vw, 3.5rem) 1.5rem; }
.hero .wrap { display: grid; gap: 1rem; }
.hero .lead { font-size: 1.25rem; color: var(--muted); max-width: 60ch; margin: 0; }
.meta { font: 500 0.82rem/1.4 var(--f-data); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }

/* Botón de oferta: texto blanco sobre color sólido */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45em; font: 700 1rem/1 var(--f-display); text-decoration: none; padding: 0.95rem 1.3rem; border-radius: var(--radius); border: 0; cursor: pointer; transition: background .15s; }
.btn-cta { background: var(--cta); color: var(--on-cta); }
.btn-cta:hover { background: var(--cta-hover); }
.btn-cta small { font: 500 0.78rem/1 var(--f-data); opacity: 0.9; }
.btn-line { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-line:hover { border-color: var(--ink); }

/* Selección rápida */
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 900px) { .picks { grid-template-columns: 1fr; } }

/* Tarjeta de producto */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; display: grid; gap: 0.75rem; align-content: start; min-width: 0; }
.card .badge { justify-self: start; font: 600 0.72rem/1 var(--f-data); letter-spacing: 0.06em; text-transform: uppercase; background: var(--ink); color: var(--bg); padding: 0.4rem 0.55rem; border-radius: 4px; }
.card .img { background: #ffffff; border-radius: 6px; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; max-width: 100%; }
.card .img img { width: 100%; height: 100%; object-fit: contain; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; font-size: 1.02rem; }
.specs { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.3rem; font: 500 0.84rem/1.35 var(--f-data); color: var(--muted); }
.specs b { color: var(--ink); font-weight: 600; }
.stars { font: 600 0.84rem/1 var(--f-data); color: var(--muted); }
.stars span { color: var(--star); letter-spacing: 1px; }
.card .acciones { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.2rem; }
.card .acciones .btn { flex: 1 1 auto; }

/* Tarjeta horizontal dentro de artículos */
.card.wide { grid-template-columns: 180px 1fr; align-items: start; gap: 1.2rem; margin-block: 1.6rem; }
.card.wide .img { width: 180px; }
.card.wide .body { display: grid; gap: 0.6rem; min-width: 0; }
@media (max-width: 560px) { .card.wide { grid-template-columns: 1fr; } .card.wide .img { width: 100%; max-width: 260px; } }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-block: 1.4rem; }

/* Comparativa: sin scroll lateral; en móvil cada fila pasa a tarjeta */
.compare { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 0.98rem; margin-block: 1.4rem; table-layout: fixed; }
.compare th, .compare td { text-align: left; padding: 0.75rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.compare thead th { font: 600 0.74rem/1.2 var(--f-data); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--soft); }
.compare td.n { font-family: var(--f-display); font-weight: 700; }
.compare td.n a { color: var(--ink); text-decoration: none; }
.compare td .btn { padding: 0.6rem 0.8rem; font-size: 0.88rem; width: 100%; }
.compare td.d { font: 500 0.86rem/1.35 var(--f-data); }
@media (max-width: 760px) {
  .compare, .compare tbody, .compare tr, .compare td { display: block; width: 100%; }
  .compare thead { display: none; }
  .compare tr { border-bottom: 1px solid var(--line); padding: 0.6rem 0; }
  .compare td { border: 0; padding: 0.3rem 0.9rem; }
  .compare td[data-l]::before { content: attr(data-l) ": "; font: 600 0.74rem/1 var(--f-data); text-transform: uppercase; color: var(--muted); }
}

/* Artículo: una sola columna a todo el ancho. El texto corrido se limita a ~75 caracteres
   para que se lea bien; tablas, tarjetas, comparativas y calculadora usan todo el ancho. */
.layout { padding-block: 1rem 4rem; }
.prose { min-width: 0; }
.prose > * + * { margin-top: 1.05em; }
.prose > p, .prose > ul, .prose > ol, .prose > h2, .prose > h3, .prose > h4, .prose > blockquote { max-width: 75ch; }
.prose h2 { margin-top: 2.2em; scroll-margin-top: 1rem; }
.prose h3 { margin-top: 1.7em; scroll-margin-top: 1rem; }
.prose p, .prose li { margin-block: 0; }
.prose ul, .prose ol { padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.prose blockquote { margin: 1.4rem 0; padding: 1rem 1.2rem; background: var(--soft); border-radius: var(--radius); font-size: 1.04rem; }
.prose blockquote p + p { margin-top: 0.6em; }
.prose table:not(.compare) { width: 100%; border-collapse: collapse; font-size: 0.98rem; table-layout: fixed; }
.prose table:not(.compare) th, .prose table:not(.compare) td { border-bottom: 1px solid var(--line); padding: 0.6rem 0.5rem; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.prose table:not(.compare) th { font: 600 0.76rem/1.2 var(--f-data); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.prose strong { font-weight: 700; }

/* Índice dentro del artículo, tras el primer párrafo */
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; font: 500 0.98rem/1.4 var(--f-display); margin-block: 1.6rem; }
.prose > .toc { margin-top: 1.6rem; }
.toc p { margin: 0 0 0.7rem; }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2 260px; column-gap: 2.5rem; }
.toc li { break-inside: avoid; padding-block: 0.2rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.crumbs { font: 500 0.82rem/1.4 var(--f-data); color: var(--muted); padding-top: 1.2rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; }
.crumbs a { color: var(--muted); }

.disclosure { font: 500 0.82rem/1.45 var(--f-data); color: var(--muted); border-left: 3px solid var(--cta); padding: 0.3rem 0 0.3rem 0.8rem; max-width: 70ch; }

/* Secciones de portada */
.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section-head { display: grid; gap: 0.6rem; margin-bottom: 1.3rem; }
.alt { background: var(--surface); border-block: 1px solid var(--line); }
.topics { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.6rem 2rem; }
.topic h3 { font-size: 0.8rem; font-family: var(--f-data); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.6rem; }
.topic ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.topic a { font: 600 1.05rem/1.3 var(--f-display); color: var(--ink); text-decoration: none; }
.topic a:hover { color: var(--accent); }

/* Ficha de producto */
.ficha { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; padding-block: 1rem 2rem; }
@media (max-width: 860px) { .ficha { grid-template-columns: 1fr; } }
.galeria { display: grid; gap: 0.6rem; }
.galeria .principal { background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 1 / 1; max-width: 100%; display: grid; place-items: center; overflow: hidden; }
.galeria .principal img { width: 100%; height: 100%; object-fit: contain; }
.miniaturas { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.miniaturas button { width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: #ffffff; cursor: pointer; overflow: hidden; }
.miniaturas button[aria-pressed="true"] { border: 2px solid var(--accent); }
.miniaturas img { width: 100%; height: 100%; object-fit: contain; }
.ficha-info { display: grid; gap: 1rem; min-width: 0; }
.datos { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.datos th, .datos td { text-align: left; padding: 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.datos th { font: 600 0.78rem/1.4 var(--f-data); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); width: 38%; padding-right: 0.8rem; }
.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .proscons { grid-template-columns: 1fr; } }
.proscons > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.proscons h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.proscons ul { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.4rem; font-size: 1.02rem; }
.pros h3 { color: var(--good); }
.cons h3 { color: var(--bad); }

/* Calculadora */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; display: grid; gap: 0.9rem; margin-block: 1.6rem; }
.calc label { font: 600 0.95rem/1.2 var(--f-display); }
.calc .fila { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.calc input { font: 600 1.1rem/1 var(--f-data); width: 7rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.calc .res { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.8rem; }
.calc .res div { background: var(--soft); border-radius: 6px; padding: 0.8rem; }
.calc .res b { display: block; font: 700 1.6rem/1.1 var(--f-data); }
.calc .res span { font: 500 0.8rem/1.3 var(--f-data); color: var(--muted); }

/* Pie */
.site-footer { background: var(--ink); color: var(--bg); padding-block: 2.5rem; margin-top: 2rem; }
.site-footer a { color: var(--bg); opacity: 0.85; }
.site-footer a:hover { opacity: 1; }
.site-footer p { margin: 0; max-width: 75ch; font-size: 0.98rem; opacity: 0.85; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1.6rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h3 { font: 600 0.78rem/1 var(--f-data); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.8rem; opacity: 0.7; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; font: 500 0.95rem/1.3 var(--f-display); }
.site-footer ul a { text-decoration: none; }
.legal { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid color-mix(in srgb, var(--bg) 20%, transparent); display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; font: 500 0.82rem/1.4 var(--f-data); }

/* Ajustes del ancho completo */
.toc ol { display: block; }
.picks .card .img, .grid .card .img { aspect-ratio: 4 / 3; }
.prose h2 + p, .prose h3 + p { margin-top: 0.6em; }
.aviso-final { margin-top: 2.5rem; }
