/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9fc;
  --surface: #ffffff;
  --surface-2: #f3f1fa;
  --ink: #1b1830;
  --muted: #6b667f;
  --border: #e6e3f0;
  --accent: #7c5cff;
  --accent-ink: #ffffff;
  --accent-soft: #efeaff;
  --success: #1f9d6c;
  --success-soft: #e7f7f0;
  --danger: #d24545;
  --danger-soft: #fbeaea;
  --offer: #ff8a3d;
  --offer-soft: #fff1e6;
  --star: #f5a623;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-s: 0 1px 2px rgba(27,24,48,.06), 0 1px 1px rgba(27,24,48,.04);
  --shadow-m: 0 8px 24px rgba(27,24,48,.08);
  --shadow-l: 0 20px 50px rgba(27,24,48,.14);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Sora", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 1180px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
ul, ol { list-style: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--ink); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section-head { max-width: 640px; margin-bottom: 2rem; }
.eyebrow { display: inline-block; font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: .3rem .7rem; border-radius: 999px; margin-bottom: .9rem; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-split] { opacity: 1; transform: none; }

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.4rem); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }

/* =============================================================
   5. Components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: 999px; font-weight: 700; font-size: .98rem;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s var(--ease-out);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-s); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }
.btn-ghost { background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
.btn-sm { padding: .55rem 1.05rem; font-size: .88rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-s); transition: box-shadow .25s var(--ease-out), transform .25s var(--ease-out);
}

.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 700; padding: .3rem .6rem; border-radius: 999px; }
.badge-sample { background: var(--offer-soft); color: var(--offer); }
.badge-offer { background: var(--success-soft); color: var(--success); }
.badge-featured { background: var(--accent-soft); color: var(--accent); }

.rating { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; }
.rating-stars { color: var(--star); letter-spacing: 1px; font-size: 1rem; }
.rating-count { color: var(--muted); }

.price-current { font-family: var(--display); font-size: 1.6rem; font-weight: 800; }
.price-before { color: var(--muted); text-decoration: line-through; font-size: 1rem; margin-left: .5rem; }
.price-note { display: block; color: var(--muted); font-size: .82rem; margin-top: .3rem; }

.disclosure {
  font-size: .85rem; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-m); padding: 1rem 1.2rem;
}

/* =============================================================
   6. Sections — header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 100; background: rgba(250,249,252,.9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(10px)) { .site-header { background: var(--bg); } }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; }
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; font-size: 1.2rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #4b2fd6); display: grid; place-items: center; color: #fff; font-size: 1rem; flex: none; }
.nav-links { display: flex; align-items: center; gap: 1.6rem; }
.nav-links a { font-weight: 600; font-size: .95rem; color: var(--muted); transition: color .2s var(--ease-out); }
.nav-links a:hover { color: var(--ink); }
.nav-links a.nav-cta, .nav-links a.nav-cta:hover { color: var(--accent-ink); background: var(--accent); padding: .55rem 1.05rem; border-radius: 999px; font-weight: 700; }
.nav-toggle { display: none; }
@media (max-width: 719px) {
  .nav-links { position: fixed; inset: 62px 0 0 0; background: var(--bg); flex-direction: column; justify-content: flex-start; padding: 2rem 1.5rem; gap: 1.4rem; transform: translateX(100%); transition: transform .3s var(--ease-out); overflow-y: auto; }
  .nav-links.is-open { transform: none; }
  .nav-toggle { display: inline-flex; }
}

/* =============================================================
   6b. Hero
   ============================================================= */
.hero { padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem); }
.hero-grid { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } }
.hero h1 { margin-bottom: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-stats { display: flex; gap: 1.8rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stat strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.hero-stat span { color: var(--muted); font-size: .85rem; }
.hero-visual { position: relative; border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-l); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); padding: 1.4rem; }
.hero-visual img { border-radius: var(--radius-m); }

/* Trust block */
.trust-block { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.trust-item { padding: 1.4rem; }
.trust-item .num { font-family: var(--mono); color: var(--accent); font-weight: 700; }

/* Product grid + card */
.product-grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.product-card { display: flex; flex-direction: column; overflow: hidden; }
.product-card:hover { box-shadow: var(--shadow-m); transform: translateY(-3px); }
.product-card-media { position: relative; aspect-ratio: 1 / 1; background: var(--surface-2); }
.product-card-media img { width: 100%; height: 100%; object-fit: cover; }
.product-card-badges { position: absolute; top: .7rem; left: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.product-card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.product-card-cat { font-size: .78rem; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.product-card-name { font-size: 1.05rem; }
.product-card-name a::after { content: ""; position: absolute; inset: 0; }
.product-card-name a { position: relative; }
.product-card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; padding-top: .5rem; }

/* Category cards */
.category-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.category-card { padding: 1.5rem; display: flex; flex-direction: column; gap: .6rem; }
.category-card:hover { border-color: var(--accent); }
.category-count { color: var(--muted); font-size: .88rem; }

/* Filters bar */
.filters-bar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1.6rem; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-m); }
.filters-bar label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.filters-bar select { padding: .5rem .8rem; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface); font: inherit; }

/* =============================================================
   6c. Ficha (product page)
   ============================================================= */
.ficha-top { display: grid; gap: 2.4rem; }
@media (min-width: 960px) { .ficha-top { grid-template-columns: .9fr 1.1fr; } }
/* Generic AI-illustration figure (ficha) — see illustration_figure_html() in build_site.py */
.product-illustration { border-radius: var(--radius-l); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); margin: 0; }
.product-illustration img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.product-illustration figcaption { padding: .7rem 1rem; font-size: .78rem; line-height: 1.4; color: var(--muted); background: var(--surface); border-top: 1px solid var(--border); }

/* Small "Imagen ilustrativa" badge overlaid on cards/hero — see illustration_card_html() */
.illustration-badge { position: absolute; bottom: .6rem; right: .6rem; background: rgba(20,18,30,.72); color: #fff; font-size: .68rem; font-weight: 600; padding: .28rem .6rem; border-radius: 999px; letter-spacing: .01em; }
.ficha-head .ficha-marca { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .82rem; letter-spacing: .04em; }
.ficha-head h1 { margin: .35rem 0 .7rem; }
.ficha-precio { margin: 1.1rem 0 1.4rem; }
.ficha-badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; }
.ficha-actions { display: flex; gap: .8rem; flex-wrap: wrap; }

.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius-l); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-s); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ficha-radar { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 720px) { .ficha-radar { grid-template-columns: auto 1fr; } }
.radar-figure svg { width: 300px; height: 300px; max-width: 100%; }
.radar-legend { display: flex; flex-direction: column; gap: .5rem; }
.radar-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: .9rem; padding-block: .35rem; border-bottom: 1px dashed var(--border); }
.radar-legend-row strong { font-family: var(--mono); color: var(--accent); }

.specs-table { font-size: .95rem; }
.specs-table caption { text-align: left; font-weight: 700; padding-block: .6rem .3rem; color: var(--accent); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.specs-table tr { border-bottom: 1px solid var(--border); }
.specs-table th, .specs-table td { text-align: left; padding: .6rem .4rem; font-weight: 400; }
.specs-table th { color: var(--muted); font-weight: 600; width: 55%; }
.specs-extra summary { cursor: pointer; font-weight: 700; padding: .8rem 0; color: var(--accent); }

.editorial-cuerpo { max-width: 68ch; }
.editorial-cuerpo p + p { margin-top: 1rem; }
.pros-contras { display: grid; gap: 1.2rem; margin-top: 1.6rem; }
@media (min-width: 640px) { .pros-contras { grid-template-columns: 1fr 1fr; } }
.pros, .contras { padding: 1.2rem 1.3rem; border-radius: var(--radius-m); }
.pros { background: var(--success-soft); }
.contras { background: var(--danger-soft); }
.pros li, .contras li { position: relative; padding-left: 1.5rem; margin-bottom: .5rem; font-size: .93rem; }
.pros li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 800; }
.contras li::before { content: "✕"; position: absolute; left: 0; color: var(--danger); font-weight: 800; }
.ideal-para { margin-top: 1.4rem; padding: 1rem 1.2rem; background: var(--accent-soft); border-radius: var(--radius-m); }

.similares { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-top: 1rem; }

/* =============================================================
   6d. Comparador
   ============================================================= */
.comparador-picker { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1.6rem; }
.comparador-picker select { flex: 1; min-width: 220px; padding: .7rem 1rem; border-radius: var(--radius-s); border: 1px solid var(--border); font: inherit; }
.comparador-slots { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.6rem; }
.comparador-slot { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .5rem .4rem 1rem; font-size: .88rem; font-weight: 600; }
.comparador-slot button { width: 22px; height: 22px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); font-weight: 800; display: grid; place-items: center; font-size: .8rem; }
.comparador-radar-wrap { display: flex; justify-content: center; margin-bottom: 2rem; }
.comparador-radar-wrap canvas { max-width: 100%; }
.comparador-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-m); background: var(--surface); }
.comparador-table { min-width: 640px; }
.comparador-table th, .comparador-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); text-align: left; font-size: .92rem; }
.comparador-table thead th { background: var(--surface-2); position: sticky; top: 0; }
.comparador-table td.best { color: var(--success); font-weight: 700; background: var(--success-soft); }
.comparador-table .col-buy { white-space: nowrap; }
.comparador-empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted); }

/* =============================================================
   6d-2. Comparativas populares (home) + páginas 1 vs 1
   ============================================================= */
.comparison-grid { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.comparison-card { display: flex; flex-direction: column; gap: .8rem; align-items: flex-start; }
.comparison-card h3 { font-size: 1.05rem; }
.vs-scores { margin-top: 1rem; }
.vs-scores-legend { display: flex; justify-content: flex-end; gap: 1.4rem; font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: .4rem; }
.vs-score-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 1rem; padding-block: .5rem; border-bottom: 1px dashed var(--border); }
.vs-score-label { font-size: .88rem; font-weight: 600; }
.vs-score-bars { display: flex; flex-direction: column; gap: .35rem; }
.vs-bar { display: flex; align-items: center; gap: .6rem; }
.vs-bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.vs-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; }
.vs-bar-fill-b { background: var(--accent-2, #ff8a5c); }
.vs-bar-val { font-family: var(--mono); font-size: .78rem; color: var(--muted); width: 34px; text-align: right; }
.vs-products-grid { display: grid; gap: 1.4rem; margin-top: 1rem; }
@media (min-width: 780px) { .vs-products-grid { grid-template-columns: 1fr 1fr; } }
.vs-product-block h4 { margin-bottom: .4rem; }
.vs-product-block .pros-contras { margin-top: .6rem; }

/* =============================================================
   6e. Ofertas / rankings
   ============================================================= */
.oferta-row { display: flex; align-items: center; gap: 1.2rem; padding: 1rem; }
.oferta-row .thumb { width: 76px; height: 76px; border-radius: var(--radius-m); overflow: hidden; flex: none; background: var(--surface-2); }
.oferta-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.oferta-discount { font-family: var(--mono); font-weight: 700; color: var(--success); }

/* Guides / legal */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2rem; margin-bottom: .8rem; }
.prose p + p, .prose ul { margin-top: .9rem; }
.prose ul li { padding-left: 1.3rem; position: relative; margin-bottom: .4rem; }
.prose ul li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }
.guide-list { display: grid; gap: 1rem; margin-top: 1.6rem; }
.guide-list .card { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.2rem; }
.guide-list .rank { font-family: var(--display); font-size: 1.6rem; color: var(--accent); font-weight: 800; width: 2.2rem; flex: none; }

/* =============================================================
   6f. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem; margin-top: 3rem; background: var(--surface); }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; align-items: flex-start; }
.footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: .9rem; }
.footer-links a:hover { color: var(--accent); }
.footer-legal { max-width: 640px; color: var(--muted); font-size: .82rem; margin-top: 1.4rem; }

/* =============================================================
   7. Effects
   ============================================================= */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* =============================================================
   8. Responsive helpers
   ============================================================= */
@media (min-width: 540px) { }
@media (min-width: 720px) { }
@media (min-width: 960px) { }
@media (min-width: 1280px) { }

/* =============================================================
   9. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .reveal { transition-duration: .01s; }
}

/* View transitions */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .45s; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
