/* =============================================================
   Cuota Clara — hoja de estilos única
   1 Tokens · 2 Reset · 3 Utilidades · 4 Tipografía · 5 Cabecera
   6 Hero · 7 Herramienta · 8 Resultados · 9 Gráfico y tabla
   10 Anuncios · 11 Contenido · 12 FAQ · 13 Más herramientas
   14 Footer · 15 Responsive · 16 Reduced-motion · 17 Oscuro
   ============================================================= */

/* ===================== 1. TOKENS ===================== */
:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-2: #fbfcfa;
  --ink: #14201a;
  --ink-2: #38443d;
  --muted: #667169;
  --line: #dfe6de;
  --line-2: #eaf0e8;
  --accent: #0b6e4f;
  --accent-2: #c98a2c;
  --accent-ink: #ffffff;
  --accent-soft: #e6f5ee;
  --ok: #0b6e4f;
  --ok-soft: #e6f5ee;
  --warn: #a15c07;
  --warn-soft: #fff8eb;
  --bad: #c72c2c;
  --bad-soft: #fef2f2;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 20, .06);
  --shadow: 0 4px 16px -4px rgba(15, 30, 20, .1), 0 1px 3px rgba(15, 30, 20, .06);
  --shadow-lg: 0 24px 56px -20px rgba(15, 30, 20, .22), 0 4px 16px -6px rgba(15, 30, 20, .1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1120px;
}

/* ===================== 2. RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(680px 420px at 88% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 62%),
    radial-gradient(560px 380px at -6% 18%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 60%),
    radial-gradient(520px 420px at 96% 62%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; line-height: 1.12; letter-spacing: -.02em; font-weight: 700; font-family: var(--display); }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ===================== 3. UTILIDADES ===================== */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.container + .container { margin-top: clamp(2rem, 5vw, 3.5rem); }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--ink); color: #fff;
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.section-sub { color: var(--muted); margin-top: .35rem; margin-bottom: 1.25rem; max-width: 60ch; }

/* ===================== 4. TIPOGRAFÍA BOTONES ===================== */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .93rem;
  transition: background .2s var(--ease-out), color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn-ghost {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  margin-top: 1rem;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-more { display: block; width: 100%; text-align: center; margin-top: .75rem; }

/* ===================== 5. CABECERA ===================== */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; }
.brand-name { font-size: 1.1rem; font-family: var(--display); }
.site-nav { display: none; gap: 1.4rem; font-size: .92rem; font-weight: 500; color: var(--ink-2); }
.site-nav a { padding: .25rem 0; border-bottom: 2px solid transparent; transition: border-color .2s var(--ease-out), color .2s var(--ease-out); }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
@media (min-width: 720px) { .site-nav { display: flex; } }

/* ===================== 6. HERO ===================== */
.hero { padding-block: clamp(1.75rem, 5vw, 3rem) 1.25rem; position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .75rem; border-radius: 99px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 1rem;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent); }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 2.85rem); max-width: 22ch; }
.hero-sub { margin-top: .8rem; max-width: 62ch; font-size: clamp(1rem, 1.7vw, 1.08rem); color: var(--muted); }
.hero-sub strong { color: var(--ink-2); font-weight: 600; }

/* ===================== 7. HERRAMIENTA ===================== */
.tool-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.1rem, 3vw, 1.9rem);
  overflow: hidden;
}
.tool-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.tool-card--compact { padding: clamp(1rem, 2.5vw, 1.6rem); box-shadow: var(--shadow); }
.noscript-note {
  margin-bottom: 1rem; padding: 1rem 1.15rem; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn);
}
.tool-grid { display: grid; gap: 1.75rem; }
@media (min-width: 900px) {
  .tool-grid { grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr); align-items: start; }
}

.field-row { display: grid; gap: .9rem; grid-template-columns: minmax(0, 1fr); margin-bottom: 1rem; }
@media (min-width: 560px) { .field-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field input[type="number"], .field input[type="range"] {
  padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-variant-numeric: tabular-nums;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.field input[type="number"]:focus, .input-suffix:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none;
}
.input-suffix { position: relative; display: flex; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.input-suffix input { flex: 1; border: 0; background: transparent; padding: .65rem .5rem .65rem .8rem; font-variant-numeric: tabular-nums; min-width: 0; }
.input-suffix input:focus { outline: none; }
.input-suffix span { padding-right: .8rem; color: var(--muted); font-size: .88rem; font-weight: 600; }
.field input[type="range"] { padding: 0; accent-color: var(--accent); background: transparent; border: 0; }

.check-row { display: flex; align-items: center; gap: .6rem; margin: 1rem 0 .25rem; font-weight: 600; font-size: .92rem; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.extra-panel, .scenario-b { margin-top: .75rem; padding: .9rem; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--line); }
.scenario-b-label { font-weight: 700; font-size: .85rem; color: var(--accent); margin-bottom: .6rem; text-transform: uppercase; letter-spacing: .04em; }

/* ===================== 8. RESULTADOS ===================== */
.tool-results { display: flex; flex-direction: column; gap: 1rem; }
.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.summary-item {
  padding: .8rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: .25rem;
}
.summary-item--big { grid-column: 1 / -1; background: var(--accent-soft); border-color: var(--accent); }
.summary-item--ok { grid-column: 1 / -1; background: var(--ok-soft); }
.summary-label { font-size: .78rem; color: var(--muted); font-weight: 600; }
.summary-value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-item--big .summary-value { font-size: 1.6rem; color: var(--accent); }

.compare-block { border-top: 1px dashed var(--line); padding-top: 1rem; }
.compare-delta { margin-top: .75rem; font-size: .92rem; color: var(--ink-2); }
.compare-delta p { padding: .5rem .7rem; background: var(--ok-soft); border-radius: var(--radius-sm); margin-bottom: .4rem; }

.privacy-badge { margin-top: 1.1rem; font-size: .86rem; color: var(--ok); }
.honest-limit { margin-top: .4rem; font-size: .82rem; color: var(--muted); }

/* ===================== 9. GRÁFICO Y TABLA ===================== */
.chart-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: clamp(1rem, 2.5vw, 1.5rem); margin-top: 1rem; box-shadow: var(--shadow);
}
.chart-card canvas { width: 100%; }
.chart-legend { display: flex; gap: 1.25rem; margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; }
.dot--accent { background: var(--accent); }
.dot--warn { background: var(--warn); }

.yearly-table-wrap, .monthly-wrap { margin-top: 1.25rem; overflow-x: auto; }
.amort-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.amort-table th, .amort-table td { padding: .55rem .7rem; text-align: right; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.amort-table th:first-child, .amort-table td:first-child { text-align: left; }
.amort-table thead th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
.amort-table tbody tr:hover { background: var(--surface-2); }

/* ===================== 10. ANUNCIOS ===================== */
.ad-slot {
  margin-block: clamp(1.5rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .3rem;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: var(--surface-2); margin-inline: auto; overflow: hidden;
}
.ad-slot::after {
  content: "Espacio reservado · sin anuncios activos aún";
  font: 500 .66rem/1 var(--sans); text-transform: none; letter-spacing: 0; color: var(--muted); opacity: .75;
}
.ad-slot--banner { width: 100%; max-width: 970px; min-height: 90px; }
.ad-slot--infeed { width: 100%; min-height: 120px; }

/* ===================== 11. CONTENIDO ===================== */
.section-tint {
  background: var(--surface-2);
  border-block: 1px solid var(--line-2);
  padding-block: clamp(2rem, 5vw, 3.5rem);
  margin-top: clamp(2rem, 5vw, 3.5rem);
}
.section-tint + .container { margin-top: clamp(2rem, 5vw, 3.5rem); }
.prose-section h2, .container > h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); margin-bottom: .9rem; }
.prose-section p { max-width: 72ch; color: var(--ink-2); margin-bottom: .9rem; }
.how-it-works { list-style: none; display: grid; gap: .9rem; margin-bottom: 1.25rem; counter-reset: step; }
.how-it-works li { position: relative; padding-left: 2.4rem; color: var(--ink-2); max-width: 68ch; }
.how-it-works li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -.1rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  color: #fff; font-weight: 700; font-size: .85rem;
  display: grid; place-items: center;
}

/* ===================== 12. FAQ ===================== */
.faq-list { display: grid; gap: .6rem; }
.faq-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .95rem 1.1rem; box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.faq-item:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.faq-item summary { font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); transition: transform .2s var(--ease-out); flex-shrink: 0; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: .7rem; color: var(--ink-2); }

/* ===================== 13. MÁS HERRAMIENTAS ===================== */
.more-tools-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.more-tool-card {
  display: block; padding: 1.1rem; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease-out), transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.more-tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.more-tool-name { display: block; font-weight: 700; margin-bottom: .3rem; }
.more-tool-desc { display: block; font-size: .88rem; color: var(--muted); }

/* ===================== 14. FOOTER ===================== */
.site-footer { margin-top: clamp(2.5rem, 6vw, 4rem); padding-block: 1.75rem; border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: .9rem; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); }
.footer-nav { display: flex; gap: 1.1rem; }
.footer-nav a:hover { color: var(--accent); }

/* ===================== 15. RESPONSIVE ===================== */
@media (max-width: 539px) {
  .summary-grid { grid-template-columns: 1fr; }
}

/* ===================== 16. REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===================== 17. OSCURO ===================== */
@media (prefers-reduced-motion: reduce) { }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1512;
    --surface: #161f1a;
    --surface-2: #1c2620;
    --ink: #eef3ee;
    --ink-2: #c3ccc4;
    --muted: #8b978d;
    --line: #2a352d;
    --line-2: #232d26;
    --accent: #34d399;
    --accent-2: #e5a94a;
    --accent-ink: #06231a;
    --accent-soft: #123528;
    --ok: #34d399;
    --ok-soft: #123528;
    --warn: #f0b429;
    --warn-soft: #2e2410;
    --bad: #f87171;
    --bad-soft: #2e1414;
    --shadow: 0 4px 20px -6px rgba(0, 0, 0, .45);
    --shadow-lg: 0 28px 64px -20px rgba(0, 0, 0, .6), 0 6px 20px -8px rgba(0, 0, 0, .4);
  }
  .summary-item--big .summary-value { color: var(--accent); }
}
