/* Dinero al Claro · estilos base */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --text: #1c2430;
  --muted: #5b6573;
  --line: #e3e0d8;
  --brand: #0f6b4f;
  --brand-strong: #0a5039;
  --brand-soft: #e3f1ea;
  --accent: #d98e04;
  --accent-soft: #fdf2dc;
  --danger: #b4372f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .05), 0 6px 20px rgba(20, 30, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --max: 1120px;
  --read: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2028;
    --surface-2: #222a34;
    --text: #e8ebef;
    --muted: #a3acb8;
    --line: #2e3742;
    --brand: #3fbf8f;
    --brand-strong: #6fd6ad;
    --brand-soft: #1b3a2f;
    --accent: #f0b03c;
    --accent-soft: #3a2f17;
    --danger: #ef7d73;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); margin: 1.8em 0 .5em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .4em; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: var(--read); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Cabecera */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.12rem; }
.logo-mark { width: 30px; height: 30px; }
.logo span em { font-style: normal; color: var(--brand); }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-size: .96rem; font-weight: 500; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; color: var(--text); font: inherit; cursor: pointer; }
@media (max-width: 760px) {
  .panel { padding: 18px; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
}

/* Portada */
.hero { padding: 64px 0 40px; }
.hero .eyebrow { display: inline-block; background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; font-size: .85rem; padding: 4px 12px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-family: var(--serif); font-weight: 700; max-width: 16em; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

.btn { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 600; font-size: 1rem; border-radius: 12px; padding: 12px 20px; border: 1px solid transparent; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary, .btn-primary:hover { color: #0c1a14; } }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--text); }

.section { padding: 40px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 8px; transition: transform .15s ease, border-color .15s ease; }
a.card:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--text); }
.card .tag { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }
.card h3 { margin: 0; font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.card .icon { font-size: 1.6rem; line-height: 1; }

.band { background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Artículo */
.breadcrumbs { font-size: .9rem; color: var(--muted); margin: 28px 0 14px; }
.breadcrumbs a { color: var(--muted); }
.article-header .meta { color: var(--muted); font-size: .95rem; }
.article-body { padding-bottom: 32px; }
.article-body ul, .article-body ol { padding-left: 1.3em; margin: 0 0 1em; }
.article-body li { margin-bottom: .35em; }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 1.4em 0; }
.callout.warn { border-color: var(--accent); background: var(--accent-soft); }
.callout p:last-child { margin-bottom: 0; }
.key-points { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 1.2em 0 1.8em; }
.key-points h2 { font-size: 1.05rem; margin: 0 0 .5em; }
.key-points ul { margin: 0; }
table { width: 100%; border-collapse: collapse; margin: 1em 0 1.4em; font-size: .96rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); font-weight: 600; }
.table-wrap { overflow-x: auto; }
.cta-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 2em 0; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; box-shadow: var(--shadow); }
.cta-box p { margin: 0; font-weight: 600; }
.related { margin-top: 2em; }
.disclaimer { font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: 2em; }

/* Herramientas */
.tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; margin: 24px 0 40px; }
@media (max-width: 860px) { .tool { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 6px; }
.field .hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.input-wrap { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-wrap input, .input-wrap select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; padding: 11px 12px; outline: none; }
.input-wrap .unit { padding: 0 12px; color: var(--muted); font-size: .95rem; }
input[type="range"] { width: 100%; accent-color: var(--brand); margin-top: 8px; }
.results { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; }
.stat .label { font-size: .85rem; color: var(--muted); }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.main { background: var(--brand-soft); }
.stat.main .value { color: var(--brand-strong); }
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars { display: flex; height: 22px; border-radius: 8px; overflow: hidden; margin: 8px 0 14px; }
.bars div { height: 100%; }
.verdict { padding: 12px 16px; border-radius: 12px; font-weight: 600; margin-top: 8px; }
.verdict.ok { background: var(--brand-soft); color: var(--brand-strong); }
.verdict.warn { background: var(--accent-soft); color: var(--text); }

/* Quiz */
.quiz { max-width: 680px; margin: 24px auto 48px; }
.quiz-progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.quiz-progress div { height: 100%; background: var(--brand); width: 0; transition: width .3s ease; }
.quiz-count { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.quiz h2 { margin-top: 0; font-size: 1.35rem; }
.options { display: grid; gap: 10px; margin: 18px 0; }
.option { text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font: inherit; color: var(--text); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.option:hover:not(:disabled) { border-color: var(--brand); }
.option:disabled { cursor: default; }
.option.correct { border-color: var(--brand); background: var(--brand-soft); }
.option.wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.explain { background: var(--surface-2); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.explain strong { display: block; margin-bottom: 4px; }
.score { font-size: 3rem; font-weight: 800; color: var(--brand); line-height: 1; margin: 8px 0; }

/* Pie */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 28px; margin-top: 40px; font-size: .94rem; color: var(--muted); }
.footer-grid { display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
.site-footer h4 { color: var(--text); margin: 0 0 8px; font-size: .95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-bottom { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .85rem; }
