/* Estructura: cabecera fija, vistas (inicio, test, catálogo, ficha, comparador) y barra de comparación. Cada ficha define su propia paleta. */
:root {
  --bg: #F1EEF4;
  --surface: #FBFAFD;
  --fg: #1F1727;
  --muted: #655A73;
  --line: #DCD5E4;
  --accent: #4A2C7A;
  --accent-fg: #FFFFFF;
  --amber: #8F5C0C;
  --amber-soft: #F3E3C0;
  --good: #1F6B45;
  --warn: #9A4A12;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14101B; --surface: #1D1727; --fg: #EFE9F6; --muted: #A99EB8; --line: #33293F;
    --accent: #C7A6F2; --accent-fg: #1A1226; --amber: #E8B25A; --amber-soft: #3A2D18;
    --good: #6FD3A0; --warn: #F0A266; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14101B; --surface: #1D1727; --fg: #EFE9F6; --muted: #A99EB8; --line: #33293F;
  --accent: #C7A6F2; --accent-fg: #1A1226; --amber: #E8B25A; --amber-soft: #3A2D18;
  --good: #6FD3A0; --warn: #F0A266; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.55; padding-inline: 20px; }
.wrap { max-width: 1120px; margin-inline: auto; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cabecera */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); margin-inline: -20px; padding-inline: 20px; }
.top .in { max-width: 1120px; margin-inline: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { font-family: var(--display); font-size: 30px; text-decoration: none; color: var(--fg); line-height: 1; }
.top nav { display: flex; gap: 6px; font-size: 14px; font-weight: 600; }
.top nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; }
.top nav a:hover { color: var(--fg); }
.top nav a[aria-current="page"] { color: var(--accent-fg); background: var(--accent); }
.badge { font-size: 11px; background: var(--amber); color: var(--bg); border-radius: 99px; padding: 0 6px; min-width: 18px; text-align: center; }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 999px; padding: 14px 26px; font-weight: 700; font-size: 16px; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--fg); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.small { padding: 9px 16px; font-size: 14px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--muted); font-weight: 600; padding: 8px 0; }
.linkbtn:hover { color: var(--fg); }

/* Inicio */
.hero { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 32px; align-items: center; padding-block: 44px 40px; }
.hero h1 { font-size: clamp(46px, 8vw, 88px); }
.hero h1 em { color: var(--accent); }
.hero .lead { margin-top: 20px; font-size: 18px; color: var(--muted); max-width: 46ch; }
.hero .cta { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hero small { color: var(--muted); font-size: 13px; }
.shelf { display: flex; align-items: flex-end; justify-content: center; border-bottom: 2px solid var(--line); min-width: 0; padding-bottom: 4px; }
.shelf a { flex: 1 1 0; min-width: 0; display: block; }
.shelf a:nth-child(3) { flex-grow: 1.5; }
.shelf canvas, .shelf .svgb { width: 100%; height: auto; aspect-ratio: 5 / 6; display: block; }
.entries { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.entry { display: flex; flex-direction: column; gap: 10px; padding: 28px 24px 32px 0; text-decoration: none; color: var(--fg); border-right: 1px solid var(--line); min-width: 0; }
.entry:not(:first-child) { padding-left: 24px; }
.entry:last-child { border-right: 0; }
.entry h2 { font-size: clamp(28px, 3.6vw, 40px); }
.entry p { color: var(--muted); font-size: 15px; }
.entry span { font-weight: 700; font-size: 14px; color: var(--accent); }
.entry:hover h2 { color: var(--accent); }

/* Test */
.block { padding-block: 40px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.quiz { max-width: 720px; margin-inline: auto; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-block: 12px 28px; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.quiz h2 { font-size: clamp(30px, 5vw, 44px); }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 24px; }
.opt { text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt b { font-weight: 700; }
.opt span { color: var(--muted); font-size: 14px; }
.opt:hover { border-color: var(--accent); }
.opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.quiz .nav { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; gap: 12px; }
.result-head { max-width: 720px; }
.result-head h2 { font-size: clamp(40px, 7vw, 72px); margin-top: 8px; }
.result-head h2 em { color: var(--accent); }
.result-head p { margin-top: 14px; color: var(--muted); }
.picks { display: grid; gap: 20px; margin-top: 32px; }
.pick { display: grid; grid-template-columns: 150px 1fr; gap: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; min-width: 0; }
.pick:first-child { border-color: var(--accent); }
.pick .art { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pick .art canvas, .pick .art .svgb { width: 100%; height: auto; aspect-ratio: 5 / 6; }
.rank { font-family: var(--display); font-size: 40px; line-height: 1; color: var(--accent); }
.pick h3 { font-size: 34px; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); }
.pill.warn { color: var(--warn); }
.why { margin-top: 12px; }
.brand-line { color: var(--muted); font-size: 14px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 13px; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; color: var(--muted); }
.chip.fam { color: var(--fg); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.stats div span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stats div b { font-variant-numeric: tabular-nums; font-size: 18px; }
.alt { margin-top: 14px; font-size: 14px; background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.alt b { color: var(--good); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* Catálogo */
.cat-head h1 { font-size: clamp(38px, 6vw, 64px); }
.cat-head p.lead { color: var(--muted); margin-top: 12px; max-width: 60ch; }
.filters { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr); gap: 12px; margin-top: 28px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; min-width: 0; }
select, input[type=search] { background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 15px; width: 100%; min-width: 0; }
.count { margin-top: 18px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.card:hover { border-color: var(--accent); }
.cardlink { display: block; text-decoration: none; color: var(--fg); padding: 0 16px; }
.stage { position: relative; margin-inline: -16px; background: radial-gradient(ellipse at 50% 38%, var(--tint) 0%, transparent 70%); }
.stage::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 7%; height: 9%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.28), transparent 70%); z-index: 0; }
.stage canvas, .stage .svgb { position: relative; z-index: 1; width: 100%; height: auto; aspect-ratio: 5 / 6; display: block; }
.card h3 { font-size: 26px; margin-top: 10px; }
.card .meta { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .price { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 8px; font-variant-numeric: tabular-nums; }
.card .price b { font-size: 20px; }
.card .price span { color: var(--muted); font-size: 13px; }
.tag { display: inline-block; align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--warn); }
.cmp { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; }
.cmp input { width: 18px; height: 18px; accent-color: var(--accent); }
.empty { padding: 48px 0; color: var(--muted); }

/* Ficha */
.crumbs { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-block: 18px; font-size: 14px; font-weight: 600; }
.crumbs a { text-decoration: none; }
.pdp { position: relative; isolation: isolate; overflow: hidden; border-radius: 22px; background: var(--pgrad); color: var(--pfg); }
.pdp .amb { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.pdp-in { padding: clamp(20px, 4vw, 48px); }
.pdp-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 56px); align-items: start; }
.vtabs { display: inline-flex; gap: 4px; border: 1px solid var(--pline); border-radius: 99px; padding: 3px; margin-bottom: 12px; }
.vtabs button { background: none; border: 0; border-radius: 99px; padding: 6px 14px; font-weight: 700; font-size: 13px; color: var(--pmut); }
.vtabs button[aria-pressed="true"] { background: var(--pac); color: var(--pbg); }
.viewer { position: relative; aspect-ratio: 5 / 6; max-height: 70vh; margin-inline: auto; border-radius: 16px; background: radial-gradient(ellipse at 50% 42%, var(--psoft) 0%, transparent 72%); touch-action: pan-y; cursor: grab; }
.viewer:active { cursor: grabbing; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewer .floor { position: absolute; left: 24%; right: 24%; bottom: 8%; height: 7%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(0,0,0,.4), transparent 70%); }
.viewer .svgb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.viewer .svgb svg { height: 80%; width: auto; }
.photo { aspect-ratio: 5 / 6; max-height: 70vh; margin-inline: auto; border-radius: 16px; border: 1.5px dashed var(--pline); display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: var(--pmut); font-size: 15px; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.hint { text-align: center; font-size: 13px; color: var(--pmut); margin-top: 8px; }
.pdp .eyebrow { color: var(--pac); }
.pdp h1 { font-size: clamp(44px, 7vw, 84px); margin-top: 8px; }
.pdp .desc { margin-top: 16px; font-size: 18px; max-width: 52ch; }
.pdp .fams { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pdp .fams span { border: 1px solid var(--pac); color: var(--pac); border-radius: 99px; padding: 3px 14px; font-weight: 700; font-size: 13px; }
.sec { margin-top: 30px; }
.sec h2 { font-family: var(--body); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--pmut); margin-bottom: 10px; }
.sens { display: flex; flex-wrap: wrap; gap: 4px 22px; font-family: var(--display); font-size: clamp(28px, 4vw, 40px); line-height: 1.15; }
.sens span:not(:last-child)::after { content: "·"; margin-left: 22px; color: var(--pac); }
.pdp .uses { color: var(--pfg); max-width: 56ch; }
.pdp .chipsP { display: flex; flex-wrap: wrap; gap: 6px; }
.pdp .chipsP span { background: var(--psoft); border: 1px solid var(--pline); border-radius: 99px; padding: 3px 12px; font-size: 14px; }
.pyr { display: grid; gap: 0; border-top: 1px solid var(--pline); }
.pyr .row { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding-block: 12px; border-bottom: 1px solid var(--pline); align-items: baseline; }
.pyr .row b { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--pmut); }
.meter { display: flex; gap: 5px; margin-top: 6px; }
.meter i { width: 30px; height: 8px; border-radius: 99px; background: var(--pline); }
.meter i.on { background: var(--pac); }
.pdp .stats { border-top: 1px solid var(--pline); }
.pdp .stats div span { color: var(--pmut); }
.pdp .stats div b { font-size: 22px; }
.pdp .small { font-size: 13px; color: var(--pmut); margin-top: 10px; }
.pdp .notice { margin-top: 16px; font-size: 14px; border: 1px solid var(--pline); border-radius: 10px; padding: 10px 14px; background: var(--psoft); }
.altP { display: grid; grid-template-columns: 70px 1fr; gap: 14px; align-items: center; border: 1px solid var(--pline); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: var(--pfg); background: var(--psoft); margin-top: 10px; }
.altP canvas, .altP .svgb { width: 70px; height: auto; aspect-ratio: 5 / 6; display: block; }
.altP b { color: var(--pac); }
.pact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.pbtn { display: inline-flex; align-items: center; background: var(--pac); color: var(--pbg); border: 0; border-radius: 99px; padding: 12px 22px; font-weight: 700; font-size: 15px; text-decoration: none; }
.pbtn.ghost { background: transparent; color: var(--pfg); border: 1.5px solid var(--pline); }
.pbtn:hover { filter: brightness(1.1); }
.pdp :focus-visible { outline-color: var(--pac); }
.similar { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--pline); }
.simgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sim { display: flex; flex-direction: column; text-decoration: none; color: var(--pfg); border: 1px solid var(--pline); border-radius: 12px; overflow: hidden; background: var(--psoft); min-width: 0; }
.sim canvas, .sim .svgb { width: 100%; height: auto; aspect-ratio: 5 / 6; display: block; }
.sim div { padding: 4px 12px 12px; }
.sim b { font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.1; display: block; }
.sim span { color: var(--pmut); font-size: 13px; }

/* Comparador */
.cmp-head h1 { font-size: clamp(38px, 6vw, 64px); }
.cmp-head p.lead { color: var(--muted); margin-top: 12px; max-width: 60ch; }
.cmp-add { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 24px; }
.cmp-add label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; flex: 1 1 260px; max-width: 420px; }
.sel { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sel button { display: inline-flex; gap: 8px; align-items: center; border: 1.5px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.sel button:hover { border-color: var(--warn); }
.tablewrap { overflow-x: auto; margin-top: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child th, tr:last-child td { border-bottom: 0; }
th[scope="row"] { color: var(--muted); font-weight: 600; width: 130px; }
thead th { vertical-align: bottom; }
thead th a { text-decoration: none; color: var(--fg); }
thead .nm { font-family: var(--display); font-size: 24px; font-weight: 400; display: block; line-height: 1.05; }
thead canvas, thead .svgb { width: 96px; height: auto; aspect-ratio: 5 / 6; display: block; }
td { font-variant-numeric: tabular-nums; }
.best { color: var(--good); font-weight: 700; }
.bar { height: 6px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.meter.sm i { width: 22px; height: 6px; }
.meter.sm i { background: var(--line); }
.meter.sm i.on { background: var(--accent); }

/* Barra de comparación */
.tray { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px)); }
.tray .in { max-width: 1120px; margin-inline: auto; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.tray p { font-size: 14px; font-weight: 600; min-width: 0; }
.tray .acts { display: flex; gap: 10px; align-items: center; }

footer { border-top: 1px solid var(--line); margin-top: 56px; padding-block: 28px 56px; font-size: 13px; color: var(--muted); max-width: 78ch; }
.svgb svg { color: var(--fg); }

@media (max-width: 860px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .pdp-grid { grid-template-columns: 1fr; }
  .simgrid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding-block: 24px 32px; }
  .shelf { order: -1; }
  .entries { grid-template-columns: 1fr; }
  .entry, .entry:not(:first-child) { padding: 22px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .pick { grid-template-columns: 1fr; }
  .pick .art { flex-direction: row; justify-content: flex-start; }
  .pick .art canvas, .pick .art .svgb { width: 90px; }
  .panel { padding: 20px; }
  .top nav a { padding: 8px 9px; }
  .brand { font-size: 26px; }
  .pyr .row { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }

/* Páginas de texto (sobre, legales, contacto) */
.prose { max-width: 68ch; padding-block: 40px 16px; }
.prose h1 { font-size: clamp(38px, 6vw, 60px); margin-top: 8px; }
.prose h2 { font-size: 28px; margin-top: 36px; }
.prose p, .prose li { color: var(--fg); line-height: 1.65; font-size: 16px; }
.prose p { margin: 14px 0 0; }
.prose ul { margin: 12px 0 0; padding-left: 22px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose .draft { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--warn); border-radius: 10px; color: var(--warn); font-size: 14px; }
@media (min-width: 1001px) { .entries { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .top nav a { padding: 8px 6px; font-size: 14px; } .brand { font-size: 24px; } }
@media (max-width: 1000px) and (min-width: 641px) { .entries { grid-template-columns: repeat(2, 1fr); } .entry, .entry:not(:first-child) { padding: 24px 20px; border-bottom: 1px solid var(--line); } }
.prose .meta { color: var(--muted); font-size: 14px; margin-top: 10px; }
.prose .back { font-weight: 600; font-size: 14px; text-decoration: none; }
.glist { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 28px; }
.gcard { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); text-decoration: none; }
.gcard h2 { font-size: 26px; }
.gcard p { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.5; }
.gcard span { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: auto; }
.gcard:hover h2 { color: var(--accent); }
.prose a.gcard { text-decoration: none; color: var(--fg); }
.prose .gcard h2 { margin-top: 0; }
.prose .gcard p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.prose a.gcard span { color: var(--accent); }
.guide-rel { margin-top: 36px; }
.guide-rel h2 { font-size: 28px; }
.guide-more { margin-top: 40px; }
.guide-more h2 { font-size: 28px; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; }
footer nav a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
footer nav a:hover { color: var(--fg); }
