/* estilo.css — editorial data-story. Warm gold + deep ink. Condensed display + serif body.
   Bespoke "ed-" namespace. Light + dark. System fonts only (no external requests). */

:root {
  --paper: #f6efdf;
  --paper-2: #efe6d1;
  --panel: #fffaf0;
  --ink: #1b1510;
  --ink-soft: #4a4034;
  --gold: #a9761a;
  --gold-deep: #7c5410;
  --gold-glow: #e9c463;
  --rule: #d8cbaf;
  --rule-strong: #b9a67f;
  --accent-a: #a9761a;
  --accent-b: #6e5a3a;
  --accent-c: #4f6b52;
  --shadow: 0 1px 0 rgba(120,90,20,.08), 0 8px 30px rgba(60,44,10,.08);
  --maxw: 1080px;
  --readw: 42rem;
  --disp: "Impact", "Haettenschweiler", "Arial Narrow Bold", "Franklin Gothic Bold", "Arial Narrow", sans-serif;
  --serif: Georgia, "Times New Roman", "Nimbus Roman", serif;
  --mono: "SFMono-Regular", "Consolas", "Liberation Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14110b;
    --paper-2: #1b170f;
    --panel: #211b12;
    --ink: #f1e9d7;
    --ink-soft: #c3b79b;
    --gold: #e0b64a;
    --gold-deep: #f0cd6e;
    --gold-glow: #7a5e1e;
    --rule: #362d1d;
    --rule-strong: #574828;
    --accent-a: #e0b64a;
    --accent-b: #c7ad80;
    --accent-c: #8fb894;
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 10px 34px rgba(0,0,0,.45);
  }
}
:root[data-theme="dark"] {
  --paper: #14110b;
  --paper-2: #1b170f;
  --panel: #211b12;
  --ink: #f1e9d7;
  --ink-soft: #c3b79b;
  --gold: #e0b64a;
  --gold-deep: #f0cd6e;
  --gold-glow: #7a5e1e;
  --rule: #362d1d;
  --rule-strong: #574828;
  --accent-a: #e0b64a;
  --accent-b: #c7ad80;
  --accent-c: #8fb894;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 10px 34px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.075rem;
  line-height: 1.65;
  overflow-x: hidden;
}

.ed-container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.2rem); }

/* ── Skip link ──────────────────────────────────────────────────────────────── */
.ed-skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 50; }
.ed-skip:focus { left: .5rem; top: .5rem; }

a { color: var(--gold-deep); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 2px; }

/* ── Masthead ───────────────────────────────────────────────────────────────── */
.ed-masthead { border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 20; }
.ed-masthead-in { display: flex; align-items: center; gap: 1rem; padding-block: .55rem; }
.ed-brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-family: var(--disp); letter-spacing: .02em; }
.ed-brand-mark { font-size: 1.6rem; color: var(--gold); line-height: 1; }
.ed-brand-txt { display: flex; flex-direction: column; font-size: 1.35rem; line-height: .95; text-transform: uppercase; }
.ed-brand-sub { font-family: var(--serif); font-style: italic; text-transform: none; font-size: .62rem; letter-spacing: .01em; color: var(--ink-soft); }
.ed-nav { display: flex; flex-wrap: wrap; gap: .1rem .3rem; margin-left: auto; }
.ed-navlink { font-family: var(--disp); text-transform: uppercase; letter-spacing: .04em; font-size: .92rem; color: var(--ink-soft); text-decoration: none; padding: .35rem .5rem; border-bottom: 2px solid transparent; }
.ed-navlink:hover { color: var(--ink); }
.ed-navlink[aria-current="page"] { color: var(--gold-deep); border-bottom-color: var(--gold); }
.ed-themetoggle { margin-left: .25rem; background: transparent; border: 1.5px solid var(--rule-strong); color: var(--ink); width: 2.1rem; height: 2.1rem; border-radius: 50%; cursor: pointer; font-size: 1rem; line-height: 1; }
.ed-themetoggle:hover { border-color: var(--gold); }
@media (max-width: 720px) { .ed-nav { order: 3; width: 100%; margin-left: 0; } .ed-themetoggle { margin-left: auto; } }

/* ── Main / blocks ──────────────────────────────────────────────────────────── */
.ed-main { display: block; }
.ed-block { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.2rem); margin-block: clamp(2.2rem, 6vw, 3.6rem); }
.ed-block > p, .ed-block > ul, .ed-block > ol, .ed-block > h3 { max-width: var(--readw); }
.ed-block--wide > * { max-width: none; }

h1, h2, h3, h4 { font-family: var(--disp); font-weight: 400; letter-spacing: .01em; line-height: 1.02; text-transform: uppercase; color: var(--ink); }
h1 { font-size: clamp(2.4rem, 8vw, 4.6rem); margin: .2em 0 .3em; }
h2 { font-size: clamp(1.7rem, 4.5vw, 2.7rem); margin: 1.4em 0 .4em; border-top: 2px solid var(--ink); padding-top: .5em; }
h3 { font-size: clamp(1.2rem, 3vw, 1.55rem); margin: 1.2em 0 .3em; letter-spacing: .03em; color: var(--gold-deep); }
p { margin: 0 0 1.05em; }
strong { color: var(--ink); }
em, .ed-serif-i { font-style: italic; }

/* ── Lede / story opening ───────────────────────────────────────────────────── */
.ed-lede { max-width: var(--maxw); margin-inline: auto; padding: clamp(1.4rem,4vw,2.4rem) clamp(1rem,4vw,2.2rem) 0; }
.ed-kicker { font-family: var(--disp); text-transform: uppercase; letter-spacing: .14em; font-size: .85rem; color: var(--gold-deep); margin: 0 0 .4rem; }
.ed-dek { font-size: clamp(1.1rem, 2.4vw, 1.4rem); font-style: italic; color: var(--ink-soft); max-width: 46rem; }
.ed-split { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(1.2rem, 4vw, 2.6rem); align-items: start; margin-top: 1.4rem; }
@media (max-width: 820px) { .ed-split { grid-template-columns: 1fr; } }

/* ── Giant inline stat numbers (woven into the narrative) ────────────────────── */
.ed-bignum { display: inline-flex; align-items: baseline; gap: .25rem; font-family: var(--disp); color: var(--gold-deep); line-height: .9; vertical-align: baseline; }
.ed-bignum-n { font-size: clamp(2.2rem, 6vw, 3.6rem); letter-spacing: .01em; }
.ed-bignum-unit { font-size: clamp(1rem, 2vw, 1.4rem); text-transform: uppercase; color: var(--ink); }
.ed-bignum-sub { font-family: var(--serif); font-style: italic; font-size: .8rem; color: var(--ink-soft); }

/* ── Data-story scrollytelling: opening + numbered chapters ──────────────────── */
.ed-storyopen { max-width: var(--maxw); margin: 1.4rem auto 0; padding-inline: clamp(1rem,4vw,2.2rem); }
.ed-storyopen p { font-size: clamp(1.15rem, 2.7vw, 1.55rem); line-height: 1.5; max-width: 48rem; }
.ed-storyopen p .ed-bignum { margin: 0 .15rem; }
.ed-storyfig { max-width: var(--maxw); margin: 1.8rem auto; padding-inline: clamp(1rem,4vw,2.2rem); }

.ed-chapter { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.2rem); margin-block: clamp(2.4rem, 6vw, 3.8rem); }
.ed-chapter-head { display: flex; align-items: baseline; gap: clamp(.8rem, 3vw, 1.6rem); border-top: 3px solid var(--ink); padding-top: .7rem; margin-bottom: .8rem; }
.ed-chapter-n { font-family: var(--disp); font-size: clamp(2.8rem, 9vw, 5.2rem); line-height: .8; color: var(--gold-glow); flex: none; }
.ed-chapter-head > div { min-width: 0; }
.ed-chapter-tag { font-family: var(--disp); text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; color: var(--gold-deep); margin: 0 0 .1rem; }
.ed-chapter-head h2 { border: none; padding: 0; margin: 0; }
.ed-chapter > p, .ed-chapter > ul, .ed-chapter > ol, .ed-chapter > h3 { max-width: var(--readw); }

/* ── The code figure (inline highlighted callout) ───────────────────────────── */
.ed-codemark { margin: 0; background: var(--panel); border: 2px solid var(--ink); border-radius: 4px; padding: 1.1rem 1.2rem 1rem; box-shadow: var(--shadow); position: relative; }
.ed-codemark::before { content: "▍ FIGURA"; position: absolute; top: -.9rem; left: 1rem; background: var(--gold); color: #14110b; font-family: var(--disp); letter-spacing: .12em; font-size: .68rem; padding: .12rem .5rem; }
.ed-codemark-label { font-family: var(--disp); text-transform: uppercase; letter-spacing: .05em; font-size: 1.05rem; margin-bottom: .5rem; color: var(--ink); }
.ed-codemark-body { margin: .3rem 0 .8rem; }
.ed-codemark-hint { display: block; font-style: italic; font-size: .85rem; color: var(--ink-soft); margin-bottom: .25rem; }
.ed-codemark-value {
  display: block; font-family: var(--mono); font-size: clamp(1.3rem, 4vw, 1.9rem); font-weight: 700;
  color: var(--gold-deep); background: linear-gradient(transparent 55%, var(--gold-glow) 55%);
  padding: .1rem .3rem; letter-spacing: .02em; word-break: break-all;
  min-height: 2.2em; display: flex; align-items: center; /* fixed box → zero CLS on rotate */
}
.ed-codemark-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.ed-copy, .ed-open, .ed-cta {
  font-family: var(--disp); text-transform: uppercase; letter-spacing: .05em; font-size: 1rem;
  padding: .7rem 1.2rem; border-radius: 3px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem;
  border: 2px solid var(--ink);
}
.ed-copy, .ed-cta { background: var(--ink); color: var(--paper); }
.ed-copy:hover, .ed-cta:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff; }
.ed-copy.is-copied { background: var(--accent-c); border-color: var(--accent-c); }
.ed-open { background: transparent; color: var(--ink); }
.ed-open:hover { background: var(--gold); color: #14110b; border-color: var(--ink); }
.ed-codemark-note { font-size: .82rem; color: var(--ink-soft); margin: .8rem 0 0; }

/* ── Callouts / margin notes ────────────────────────────────────────────────── */
.ed-callout { border-left: 4px solid var(--gold); background: var(--paper-2); padding: .9rem 1.1rem; margin: 1.5rem 0; border-radius: 0 4px 4px 0; }
.ed-callout--warn { border-left-color: #b4522a; }
.ed-callout p:last-child { margin-bottom: 0; }
.ed-tag { display: inline-block; font-family: var(--disp); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; background: var(--gold); color: #14110b; padding: .05rem .45rem; border-radius: 2px; vertical-align: middle; }

/* ── Panels ─────────────────────────────────────────────────────────────────── */
.ed-panel { background: var(--panel); border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: 1.2rem 1.3rem; box-shadow: var(--shadow); }

/* ── Breadcrumb ─────────────────────────────────────────────────────────────── */
.ed-crumbs { max-width: var(--maxw); margin: 1rem auto 0; padding-inline: clamp(1rem,4vw,2.2rem); font-size: .82rem; color: var(--ink-soft); }
.ed-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0; }
.ed-crumbs li + li::before { content: "›"; margin-right: .35rem; color: var(--rule-strong); }
.ed-crumbs [aria-current="page"] { color: var(--ink); }

/* ── Savings-stack infographic (SVG) ────────────────────────────────────────── */
.ed-stack { margin: 1.6rem 0; }
.ed-stack svg { width: 100%; height: auto; max-width: 680px; background: var(--panel); border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: 6px; }
.ed-stack-name { font-family: var(--serif); font-size: 13px; fill: var(--ink); }
.ed-stack-val { font-family: var(--serif); font-size: 12px; fill: var(--ink-soft); }
.ed-stack-bar--a { fill: var(--accent-a); }
.ed-stack-bar--b { fill: var(--accent-b); }
.ed-stack-bar--c { fill: var(--accent-c); }
.ed-stack-axis { stroke: var(--rule-strong); stroke-width: 1; }
.ed-stack-total { font-family: var(--disp); font-size: 15px; fill: var(--ink); text-transform: uppercase; }
.ed-stack-total-n { fill: var(--gold-deep); }
.ed-stack-cap { font-size: .82rem; color: var(--ink-soft); margin-top: .5rem; max-width: var(--readw); }

/* ── Calculadora ────────────────────────────────────────────────────────────── */
.ed-calc { background: var(--panel); border: 2px solid var(--ink); border-radius: 4px; padding: 1.2rem 1.3rem; margin: 1.8rem 0; box-shadow: var(--shadow); }
.ed-calc-title { font-family: var(--disp); text-transform: uppercase; letter-spacing: .05em; font-size: 1.3rem; margin: 0 0 .8rem; }
.ed-calc-controls { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: 1rem; }
.ed-calc fieldset { border: 1px solid var(--rule-strong); border-radius: 4px; padding: .5rem .8rem .7rem; margin: 0; }
.ed-calc legend { font-family: var(--disp); text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; color: var(--gold-deep); padding-inline: .3rem; }
.ed-choice { display: block; padding: .2rem 0; cursor: pointer; }
.ed-calc-out { border-top: 2px solid var(--ink); padding-top: .6rem; }
.ed-calc-line { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--rule); }
.ed-calc-line b { font-family: var(--mono); }
.ed-calc-line--extra b { color: var(--accent-c); }
.ed-calc-total { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding-top: .7rem; margin-top: .3rem; }
.ed-calc-total span { font-family: var(--disp); text-transform: uppercase; font-size: 1.1rem; }
.ed-calc-total b { font-family: var(--disp); font-size: clamp(1.5rem, 4vw, 2.2rem); color: var(--gold-deep); }
.ed-calc-note { font-size: .8rem; color: var(--ink-soft); margin: .8rem 0 0; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.ed-tablewrap { overflow-x: auto; margin: 1.4rem 0; }
.ed-table { border-collapse: collapse; width: 100%; min-width: 30rem; font-size: .96rem; }
.ed-table caption { text-align: left; font-style: italic; color: var(--ink-soft); font-size: .85rem; margin-bottom: .5rem; }
.ed-table th, .ed-table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ed-table thead th { font-family: var(--disp); text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--ink); color: var(--ink); }
.ed-table tbody tr:hover { background: var(--paper-2); }

/* ── Steps (HowTo) ──────────────────────────────────────────────────────────── */
.ed-steps { list-style: none; counter-reset: step; padding: 0; margin: 1.4rem 0; max-width: var(--readw); }
.ed-step { position: relative; padding: 0 0 1.2rem 3.4rem; }
.ed-step::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -.1rem; width: 2.4rem; height: 2.4rem; background: var(--gold); color: #14110b; font-family: var(--disp); font-size: 1.5rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.ed-step h3 { margin: 0 0 .2rem; }

/* ── FAQ ────────────────────────────────────────────────────────────────────── */
.ed-faq { max-width: var(--readw); margin: 1.2rem 0; }
.ed-faq-item { border-bottom: 1px solid var(--rule); padding: .3rem 0; }
.ed-faq-q { font-family: var(--disp); text-transform: uppercase; letter-spacing: .02em; font-size: 1.1rem; cursor: pointer; padding: .6rem 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.ed-faq-q::-webkit-details-marker { display: none; }
.ed-faq-q::after { content: "+"; font-size: 1.4rem; color: var(--gold-deep); }
.ed-faq-item[open] .ed-faq-q::after { content: "–"; }
.ed-faq-a { padding-bottom: .8rem; }
.ed-faq-a p:last-child { margin-bottom: 0; }

/* ── Sources / disclosure / byline ──────────────────────────────────────────── */
.ed-sourcelist { max-width: var(--readw); }
.ed-sourcelist li { margin-bottom: .4rem; }
.ed-disclosure { max-width: var(--maxw); margin: 2rem auto; padding: 1rem 1.2rem; border: 1.5px dashed var(--rule-strong); border-radius: 4px; background: var(--paper-2); font-size: .9rem; }
.ed-disclosure p { margin: 0; }
.ed-byline { font-style: italic; color: var(--ink-soft); font-size: .95rem; border-left: 3px solid var(--gold); padding-left: .8rem; }

/* ── Blog ───────────────────────────────────────────────────────────────────── */
.ed-postlist { list-style: none; padding: 0; margin: 1.4rem 0; display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.ed-postcard { background: var(--panel); border: 1.5px solid var(--rule-strong); border-radius: 4px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.ed-postcard h3 { margin-top: .2rem; }
.ed-postcard a { text-decoration: none; }
.ed-postcard a:hover h3 { color: var(--ink); }
.ed-postmeta { font-size: .8rem; color: var(--ink-soft); font-style: italic; }

/* ── Article figure / annotation ────────────────────────────────────────────── */
.ed-figure { margin: 1.6rem 0; }
.ed-figure svg, .ed-figure img { max-width: 100%; height: auto; }
.ed-figure figcaption { font-size: .82rem; color: var(--ink-soft); font-style: italic; margin-top: .4rem; }
.ed-figure--photo img { border: 2px solid var(--ink); border-radius: 4px; display: block; }
.ed-figure--photo figcaption a { color: inherit; }
.ed-annot { font-size: .9rem; color: var(--ink-soft); }

/* ── Related / internal links ───────────────────────────────────────────────── */
.ed-related { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.4rem 0; padding: 0; list-style: none; }
.ed-related a { display: inline-block; border: 1.5px solid var(--rule-strong); border-radius: 3px; padding: .4rem .8rem; text-decoration: none; font-family: var(--disp); text-transform: uppercase; letter-spacing: .03em; font-size: .85rem; color: var(--ink); }
.ed-related a:hover { border-color: var(--gold); color: var(--gold-deep); }

/* ── Story illustration ─────────────────────────────────────────────────────── */
.ed-illus { width: 100%; height: auto; }
.ed-illus-frame { border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; background: var(--panel); }

hr.ed-rule { border: none; border-top: 2px solid var(--ink); margin: 2.2rem 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--paper-2); padding: .1em .35em; border-radius: 3px; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.ed-foot { border-top: 3px double var(--ink); margin-top: 3rem; background: var(--paper-2); }
.ed-foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 1.6rem; padding-block: 2rem 1rem; }
@media (max-width: 720px) { .ed-foot-grid { grid-template-columns: 1fr; } }
.ed-footcol a { display: block; color: var(--ink); text-decoration: none; padding: .18rem 0; }
.ed-footcol a:hover { color: var(--gold-deep); }
.ed-foot-h { font-size: 1rem; margin: 0 0 .4rem; border: none; padding: 0; }
.ed-foot-brand { font-family: var(--disp); text-transform: uppercase; font-size: 1.3rem; margin: 0 0 .4rem; }
.ed-foot-note { font-size: .85rem; color: var(--ink-soft); }
.ed-foot-legal { padding-block: .8rem 1.6rem; border-top: 1px solid var(--rule); font-size: .8rem; color: var(--ink-soft); }
.ed-foot-legal p { margin: .6rem 0 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
