/* Taller Cuenta — estilos. Tokens primero; los componentes solo usan tokens. */
:root {
  --bg: #f1f4f1;
  --surface: #ffffff;
  --surface-2: #f7f9f7;
  --ink: #15201b;
  --muted: #56635c;
  --line: #d3dbd5;
  --mat: #1e6a50;
  --mat-ink: #ffffff;
  --mat-soft: #e1eee7;
  --grid: rgba(30, 106, 80, 0.16);
  --grid-strong: rgba(30, 106, 80, 0.38);
  --print: #c2176b;
  --print-soft: rgba(194, 23, 107, 0.14);
  --ok: #1e7a45;
  --warn: #9a5800;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --focus: #1e6a50;
  --radius: 10px;
  --font-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "Martian Mono", ui-monospace, "Cascadia Mono", "Consolas", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #151d1a; --surface-2: #19231f; --ink: #e3ebe6; --muted: #9aa9a1; --line: #2a3530;
    --mat: #4db38a; --mat-ink: #07130e; --mat-soft: #1a2b24; --grid: rgba(77, 179, 138, 0.14); --grid-strong: rgba(77, 179, 138, 0.34);
    --print: #f0579f; --print-soft: rgba(240, 87, 159, 0.18); --ok: #5bc48a; --warn: #e0a040; --bad: #f07a6e; --bad-soft: #3a1c19; --focus: #4db38a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #151d1a; --surface-2: #19231f; --ink: #e3ebe6; --muted: #9aa9a1; --line: #2a3530;
  --mat: #4db38a; --mat-ink: #07130e; --mat-soft: #1a2b24; --grid: rgba(77, 179, 138, 0.14); --grid-strong: rgba(77, 179, 138, 0.34);
  --print: #f0579f; --print-soft: rgba(240, 87, 159, 0.18); --ok: #5bc48a; --warn: #e0a040; --bad: #f07a6e; --bad-soft: #3a1c19; --focus: #4db38a;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}
img, svg { max-width: 100%; }
a { color: var(--mat); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; line-height: 1.15; margin: 0; }
p { margin: 0; }
.wrap { max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-data); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Cabecera ---------- */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark .bm-bg { fill: var(--mat); }
.brand-mark .bm-grid { stroke: var(--mat-ink); stroke-opacity: 0.3; stroke-width: 1; fill: none; }
.brand-mark .bm-print { fill: var(--print); }
.brand-name { font-family: var(--font-display); font-weight: 800; font-stretch: 125%; font-size: 1.12rem; letter-spacing: -0.01em; text-transform: uppercase; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--mat); }
.preview-flag { font-family: var(--font-data); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 99px; padding: 2px 8px; }

/* ---------- Intro de la herramienta ---------- */
.tool-intro { padding-block: 28px 18px; display: grid; gap: 10px; }
.tool-intro h1 { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: clamp(1.9rem, 1.2rem + 3vw, 3.1rem); letter-spacing: -0.02em; max-width: 20ch; }
.tool-intro p { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { font: inherit; font-size: 0.9rem; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; cursor: pointer; }
.chip:hover { border-color: var(--mat); }
.chip[aria-pressed="true"] { background: var(--mat); color: var(--mat-ink); border-color: var(--mat); }

/* ---------- Calculadora ---------- */
.calc { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); padding-bottom: 32px; }
@media (min-width: 960px) { .calc { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } }

.form { display: grid; gap: 14px; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px 16px; min-width: 0; }
legend { font-family: var(--font-display); font-weight: 700; font-stretch: 110%; font-size: 1.02rem; padding-inline: 6px; }
.legend-note { color: var(--muted); font-size: 0.88rem; margin: 2px 0 10px; }
.fields { display: grid; gap: 12px 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field label { font-size: 0.9rem; font-weight: 600; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.input-unit { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.input-unit:focus-within { border-color: var(--mat); box-shadow: 0 0 0 2px var(--mat-soft); }
.input-unit input, .input-unit select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-family: var(--font-data); font-size: 0.95rem; padding: 8px 10px; }
.input-unit input:focus, .input-unit select:focus { outline: none; }
.input-unit select { font-family: var(--font-body); font-size: 0.9rem; padding-inline: 8px 4px; text-overflow: ellipsis; }
.input-unit .unit { display: flex; align-items: center; padding-inline: 10px; font-family: var(--font-data); font-size: 0.75rem; color: var(--muted); border-left: 1px solid var(--line); white-space: nowrap; }
.field.has-error .input-unit { border-color: var(--bad); }
.field .error { color: var(--bad); font-size: 0.82rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 0.88rem; border: 0; background: var(--surface-2); color: var(--muted); padding: 7px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--mat); color: var(--mat-ink); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 14px; cursor: pointer; border: 1px solid var(--mat); background: var(--mat); color: var(--mat-ink); }
.btn.ghost { background: transparent; color: var(--mat); }
.btn:hover { filter: brightness(1.05); }
.status { font-size: 0.85rem; color: var(--muted); }

/* ---------- Resultados ---------- */
.results { display: grid; gap: 14px; }
@media (min-width: 960px) { .results { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.price-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.price-big { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-weight: 600; font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3rem); letter-spacing: -0.03em; line-height: 1; }
.price-sub { color: var(--muted); font-size: 0.9rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { border-top: 2px solid var(--line); padding-top: 6px; }
.kpi .v { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600; }
.kpi .k { font-size: 0.8rem; color: var(--muted); }
.kpi.profit { border-top-color: var(--print); }
.errors-box { background: var(--bad-soft); color: var(--bad); border-radius: 8px; padding: 12px 14px; font-size: 0.92rem; }
.errors-box ul { margin: 6px 0 0; padding-left: 18px; }

.breakdown { display: grid; gap: 6px; }
.brow { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.brow .bar { height: 10px; border-radius: 3px; background: var(--mat-soft); overflow: hidden; }
.brow .bar > span { display: block; height: 100%; background: var(--mat); border-radius: 3px; }
.brow.profit .bar > span { background: var(--print); }
.brow .amt { font-family: var(--font-data); font-variant-numeric: tabular-nums; font-size: 0.82rem; text-align: right; }

.mat-figure { margin: 0; display: grid; gap: 8px; }
.mat-figure figcaption { font-size: 0.85rem; color: var(--muted); }
.mat-svg { width: 100%; height: auto; display: block; }
.mat-svg .sheet-bg { fill: var(--surface-2); stroke: var(--grid-strong); }
.mat-svg .g-minor { stroke: var(--grid); stroke-width: 0.25; }
.mat-svg .g-major { stroke: var(--grid-strong); stroke-width: 0.4; }
.mat-svg .design { fill: var(--print-soft); stroke: var(--print); stroke-width: 0.5; }
.mat-svg .margin { fill: none; stroke: var(--muted); stroke-width: 0.3; stroke-dasharray: 1.2 1; }
.mat-svg text { fill: var(--muted); font-family: var(--font-data); font-size: 3.2px; }

.table-scroll { overflow-x: auto; }
table.qty { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.qty th, table.qty td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.qty th:first-child, table.qty td:first-child { text-align: left; }
table.qty th { font-weight: 600; color: var(--muted); font-size: 0.78rem; }
table.qty td { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
table.qty tr.current td { background: var(--mat-soft); font-weight: 600; }
.compare { font-size: 0.92rem; }
.compare.good { color: var(--ok); }
.compare.bad { color: var(--bad); }

.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.next-list li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.next-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.next-list a { font-weight: 600; }
.next-list span { color: var(--muted); font-size: 0.88rem; }
.guide-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.guide-links a { display: block; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; font-weight: 600; color: var(--ink); }
.guide-links a:hover { border-color: var(--mat); }
.guide-links .sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; margin-top: 4px; }
.related { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 20px; display: grid; gap: 10px; }
.tech-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tech-nav a { font-size: 0.9rem; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; text-decoration: none; color: var(--ink); background: var(--surface); }
.tech-nav a:hover { border-color: var(--mat); }

/* Barra fija en móvil con el precio */
.mobile-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mobile-bar .data { font-weight: 600; font-size: 1.1rem; }
.mobile-bar a { font-size: 0.9rem; }
@media (min-width: 960px) { .mobile-bar { display: none; } }
@media (max-width: 959px) { body.has-mobile-bar { padding-bottom: 64px; } }

/* ---------- Contenido editorial ---------- */
.band { border-top: 1px solid var(--line); padding-block: 36px; }
.band h2 { font-family: var(--font-display); font-weight: 800; font-stretch: 110%; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); margin-bottom: 12px; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols h3 { font-size: 1.02rem; margin-bottom: 4px; }
.cols p { color: var(--muted); font-size: 0.95rem; }
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1em; }
.prose h2 { margin-top: 1.8em; }
.prose h3 { margin-top: 1.4em; font-size: 1.12rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.35em; }
.prose code, .formula { font-family: var(--font-data); font-size: 0.88em; background: var(--mat-soft); padding: 1px 5px; border-radius: 4px; }
.formula { display: block; padding: 10px 12px; overflow-x: auto; white-space: nowrap; }
.article-head { padding-block: 32px 8px; display: grid; gap: 10px; }
.article-head h1 { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.8rem); letter-spacing: -0.02em; max-width: 24ch; }
.article-head .meta { color: var(--muted); font-size: 0.9rem; }
.callout { border-left: 3px solid var(--mat); background: var(--surface); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: 0.95rem; }
.example-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.example-table th, .example-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.example-table td.n { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* Aviso de enlaces y afiliación: visible, no escondido en el pie */
.disclosure { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 0.92rem; }
.disclosure strong { font-weight: 700; }

/* Selección de equipo */
.gear-list { display: grid; gap: 14px; }
.gear { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 10px; }
.gear-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: baseline; }
.gear h3 { font-size: 1.1rem; }
.stage { font-family: var(--font-data); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mat); border: 1px solid var(--mat); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.gear dl { display: grid; grid-template-columns: minmax(0, 8.5rem) minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: 0.92rem; }
.gear dt { color: var(--muted); }
.gear dd { margin: 0; }
.shop-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.shop { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; color: var(--ink); background: var(--surface-2); }
.shop:hover { border-color: var(--mat); }
.link-kind { font-family: var(--font-data); font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.link-kind.affiliate { color: var(--print); }
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.compare-table th, .compare-table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.compare-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }

/* Espacio publicitario simulado: separado de navegación y de enlaces de compra */
.ad-slot { margin-block: 28px; border: 1px dashed var(--line); border-radius: var(--radius); min-height: 110px; display: grid; place-items: center; text-align: center; padding: 12px; color: var(--muted); font-size: 0.8rem; background: repeating-linear-gradient(135deg, transparent 0 10px, var(--surface-2) 10px 20px); }
.ad-slot b { display: block; font-family: var(--font-data); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Pie ---------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding-block: 24px; font-size: 0.88rem; color: var(--muted); }
.site-foot .wrap { display: grid; gap: 10px; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (max-width: 520px) {
  .brow { grid-template-columns: minmax(0, 7.2rem) minmax(0, 1fr) auto; }
  .gear dl { grid-template-columns: minmax(0, 1fr); }
  .gear dt { margin-top: 4px; }
}
