/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f6f8fb;
  --bg-elevated: #ffffff;
  --text: #14202e;
  --text-muted: #55647a;
  --border: #dde3ec;
  --border-strong: #c3cddc;

  --brand: #1d4ed8;
  --brand-dark: #1638a3;
  --brand-tint: #eaf0ff;

  --accent: #0d9488;
  --accent-tint: #e3f6f3;

  --warn: #b45309;
  --warn-tint: #fef3e0;

  --danger: #b91c1c;
  --danger-tint: #fdeaea;

  --success: #15803d;
  --success-tint: #e9f8ee;

  --ad-bg: #f1f2f5;
  --ad-text: #6b7280;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(20, 32, 46, 0.06);
  --shadow: 0 6px 20px rgba(20, 32, 46, 0.08);
  --shadow-lg: 0 16px 40px rgba(20, 32, 46, 0.14);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151f;
    --bg-elevated: #161f2d;
    --text: #e9edf4;
    --text-muted: #9aa7ba;
    --border: #263145;
    --border-strong: #34415a;
    --brand-tint: #17223f;
    --accent-tint: #10312c;
    --warn-tint: #3a2a10;
    --danger-tint: #3a1616;
    --success-tint: #113321;
    --ad-bg: #1b2431;
    --ad-text: #93a0b3;
  }
}

/* =============================================================
   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 {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
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 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; font-weight: 700; }
ul, ol { padding-left: 1.2em; }
::selection { background: var(--brand); color: #fff; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 1.25rem; }
.container-narrow { width: 100%; max-width: 780px; margin-inline: auto; padding-inline: 1.25rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--brand); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }
.section { padding-block: 2.75rem; }
.section > h2 { margin-top: 2.75rem; }
.section > h2:first-child { margin-top: 0; }
.section-tight { padding-block: 1.5rem; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--brand); margin-bottom: .5rem;
}

/* =============================================================
   4. Header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246, 248, 251, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--bg); }
}
@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(15, 21, 31, 0.9); }
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: var(--header-h); flex-wrap: wrap; padding-block: .6rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-size: 1rem;
}
.main-nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.main-nav a {
  font-size: .95rem; font-weight: 600; color: var(--text-muted);
  padding: .3rem 0; border-bottom: 2px solid transparent;
  transition: color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--brand); border-color: var(--brand); }

/* =============================================================
   5. Hero
   ============================================================= */
.hero { padding-block: 2rem 1rem; scroll-margin-top: calc(var(--header-h) + 12px); }
.hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); max-width: 26ch; }
.hero p.lead { color: var(--text-muted); font-size: 1.1rem; max-width: 60ch; margin-top: .6rem; }

/* Single-page sections: keep anchor targets clear of the sticky header */
#calculadoras { scroll-margin-top: calc(var(--header-h) + 12px); }

/* Prevent the mobile browser's yellow/tan autofill tint from discoloring inputs */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

/* =============================================================
   5b. Compact indicators strip (always visible, below the header)
   ============================================================= */
.indicators-strip {
  background: var(--brand-tint); border-bottom: 1px solid var(--border);
}
.indicators-strip-inner {
  display: flex; align-items: center; flex-wrap: wrap; gap: .4rem 1.5rem;
  padding-block: .55rem; font-size: .85rem;
}
.strip-item { display: flex; align-items: center; gap: .35rem; }
.strip-label { color: var(--text-muted); font-weight: 600; }
.strip-value { font-weight: 800; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .strip-value { color: #9fbaff; } }
.strip-date { color: var(--text-muted); font-size: .78rem; }
.strip-warn {
  font-size: .78rem; font-weight: 600; color: var(--warn);
  background: var(--warn-tint); padding: .15rem .5rem; border-radius: 999px;
}

/* =============================================================
   5c. Tabbed calculator card
   ============================================================= */
.tabbed-card { padding-top: 0; overflow: hidden; }
.tab-list { display: flex; border-bottom: 1px solid var(--border); margin: -1.5rem -1.5rem 1.5rem; }
@media (min-width: 720px) { .tab-list { margin: -2rem -2rem 1.75rem; } }
.tab-btn {
  flex: 1 1 0; padding: 1rem .75rem; font-weight: 700; font-size: .95rem;
  color: var(--text-muted); border-bottom: 3px solid transparent; text-align: center;
  transition: color .15s var(--ease-out), background .15s var(--ease-out), border-color .15s var(--ease-out);
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.is-active { color: var(--brand); border-color: var(--brand); background: var(--bg-elevated); }
.tab-icon { margin-right: .35rem; }
.radio-row { display: flex; flex-direction: column; gap: .5rem; margin-top: .3rem; }
@media (min-width: 540px) { .radio-row { flex-direction: row; gap: 1.25rem; } }
.radio-option { display: flex; align-items: center; gap: .5rem; font-size: .92rem; font-weight: 500; }
.radio-option input { width: 18px; height: 18px; accent-color: var(--brand); }

/* =============================================================
   6. Tool card (shared shell for both calculators)
   ============================================================= */
.tool-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 1.5rem; margin-top: 1.25rem;
}
@media (min-width: 720px) { .tool-card { padding: 2rem; } }

.field-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-grid { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field.span-2 { grid-column: 1 / -1; }
.field label { font-size: .9rem; font-weight: 600; }
.field .hint { font-size: .8rem; color: var(--text-muted); }
.field input, .field select {
  font: inherit; padding: .65rem .8rem; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
  width: 100%; min-width: 0;
}
.field input:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); outline: none;
}
/* Radio/checkbox inputs must stay their natural small size — the width:100%
   above is meant only for text/number/date/select fields, but as a plain
   ".field input" rule it also matches these nested further down. */
.field input[type="radio"], .field input[type="checkbox"] {
  width: 18px; height: 18px; min-width: 18px; flex: none;
}
.checkbox-row { display: flex; align-items: flex-start; gap: .55rem; }
.checkbox-row input { width: 18px; height: 18px; margin-top: .2rem; accent-color: var(--brand); }
.checkbox-row label { font-size: .92rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.4rem; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem;
  transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out), background .15s;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(29, 78, 216, .28); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-top: .5rem; }
.btn-ghost { background: transparent; color: var(--brand); font-weight: 600; }
.btn-ghost:hover { text-decoration: underline; }

.form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; flex-wrap: wrap; }
.error-text { color: var(--danger); font-size: .88rem; font-weight: 600; display: none; }
.error-text.is-visible { display: block; }

/* Result zone */
.result-zone { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px dashed var(--border-strong); display: none; }
.result-zone.is-visible { display: block; }
.result-total {
  background: linear-gradient(135deg, var(--brand-tint), var(--accent-tint));
  border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem;
}
.result-total .label { font-size: .9rem; color: var(--text-muted); font-weight: 600; }
.result-total .amount { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; color: var(--brand-dark); margin-top: .15rem; }
@media (prefers-color-scheme: dark) { .result-total .amount { color: #9fbaff; } }

.result-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .result-grid { grid-template-columns: repeat(3, 1fr); } }
.result-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.result-item .label { font-size: .82rem; color: var(--text-muted); font-weight: 600; }
.result-item .value { font-size: 1.3rem; font-weight: 800; margin-top: .25rem; }
.result-item details { margin-top: .5rem; font-size: .82rem; color: var(--text-muted); }
.result-item details summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.result-item details summary::-webkit-details-marker { display: none; }

.disclaimer {
  margin-top: 1.25rem; font-size: .85rem; color: var(--text-muted);
  background: var(--warn-tint); border: 1px solid #f0d9ab; border-radius: var(--radius-sm);
  padding: .8rem 1rem;
}
@media (prefers-color-scheme: dark) { .disclaimer { border-color: #5a4620; } }

.privacy-badge {
  display: flex; align-items: flex-start; gap: .5rem; margin-top: 1.1rem;
  font-size: .85rem; color: var(--text-muted);
}
.privacy-badge svg { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: .1rem; }

.limits-note { font-size: .82rem; color: var(--text-muted); margin-top: .5rem; }

/* =============================================================
   7. Ad units (AdSense) — real ads, min-height reserved to avoid layout shift
   ============================================================= */
.ad-unit { margin-block: 1.75rem; overflow: hidden; }
.ad-unit--leaderboard { min-height: 100px; }
.ad-unit--incontent { min-height: 250px; }

.ad-popup {
  border: none; border-radius: var(--radius-lg); padding: 0; max-width: 380px; width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
}
.ad-popup::backdrop { background: rgba(15, 21, 31, .55); }
.ad-popup-inner { padding: 1.5rem; position: relative; }
.ad-popup-close {
  position: absolute; top: .6rem; right: .6rem; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: var(--ad-bg); font-size: 1.1rem;
  color: var(--text);
}
.ad-popup-body { min-height: 220px; margin-top: .75rem; overflow: hidden; }

.ad-corner {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 50; width: 240px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: .9rem 1rem; opacity: 0; transform: translateY(12px);
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-out);
}
.ad-corner.is-visible { opacity: 1; transform: translateY(0); }
.ad-corner-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ad-corner-head span { font-weight: 800; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ad-text); }
.ad-corner-close { font-size: 1rem; color: var(--text-muted); width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.ad-corner-body { margin-top: .5rem; min-height: 100px; overflow: hidden; }
@media (max-width: 539px) { .ad-corner { width: calc(100% - 2rem); right: 1rem; left: 1rem; } }

/* =============================================================
   8. Content sections (cómo funciona / casos de uso / FAQ)
   ============================================================= */
.steps-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin-top: 1.25rem; }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-sm);
}
.step-num {
  width: 32px; height: 32px; border-radius: 9px; background: var(--brand-tint); color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: .7rem;
}
.step-card h3 { font-size: 1.05rem; }
.step-card p { color: var(--text-muted); font-size: .92rem; margin-top: .4rem; }

.usecase-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.25rem; }
@media (min-width: 720px) { .usecase-grid { grid-template-columns: repeat(3, 1fr); } }
.usecase-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.2rem;
}
.usecase-card h3 { font-size: 1rem; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .usecase-card h3 { color: #9fbaff; } }
.usecase-card p { font-size: .9rem; color: var(--text-muted); margin-top: .4rem; }

.seo-copy { margin-top: 1.5rem; color: var(--text-muted); }
.seo-copy p { margin-top: .8rem; }
.seo-copy h2, .seo-copy h3 { color: var(--text); margin-top: 1.4rem; }

.faq-list { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.faq-item {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .3rem .3rem;
}
.faq-item summary {
  cursor: pointer; list-style: none; padding: .85rem 1rem; font-weight: 700; font-size: .96rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--brand); flex: none; font-weight: 400; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item .faq-answer { padding: 0 1rem 1rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; padding-block: 2rem; color: var(--text-muted); font-size: .88rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: flex-start; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.footer-links a:hover { color: var(--brand); }
.footer-note { margin-top: 1.25rem; font-size: .8rem; }

/* =============================================================
   10. Legal page skeleton
   ============================================================= */
.legal-page h1 { margin-bottom: .5rem; }
.legal-page h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.legal-page p { margin-top: .7rem; color: var(--text-muted); }

/* =============================================================
   11. Breakpoints reference
   ============================================================= */
/* 540 / 720 / 960 / 1280 / 1600 — used inline above, mobile-first */
