/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --rojo: #7a1315;
  --rojo-oscuro: #5c0e10;
  --rojo-claro: #fbe9e9;
  --blanco: #ffffff;
  --gris-50: #f7f8fa;
  --gris-100: #eef0f3;
  --gris-200: #e2e5ea;
  --gris-400: #9aa1ac;
  --gris-600: #5b6270;
  --texto: #1f2328;
  --azul: #2563eb;
  --azul-claro: #eaf1ff;
  --verde: #15803d;
  --verde-claro: #e8f7ee;
  --whatsapp: #22a559;
  --radio: 14px;
  --radio-sm: 9px;
  --sombra: 0 4px 16px rgba(20, 10, 10, 0.06);
  --sombra-md: 0 12px 32px rgba(20, 10, 10, 0.10);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Manrope", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================
   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 {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto);
  background: var(--gris-50);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--rojo-claro); color: var(--rojo-oscuro); }
:focus-visible { outline: 2px solid var(--rojo); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 900px; margin-inline: auto; padding-inline: 1rem; }

.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--rojo); color: var(--blanco);
  z-index: 9999; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================
   3. Header
   ============================================================= */
.site-header { background: var(--blanco); border-bottom: 1px solid var(--gris-200); position: sticky; top: 0; z-index: 40; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding-block: .8rem; gap: .75rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--texto); font-weight: 700; }
.brand-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--rojo); color: var(--blanco); flex-shrink: 0; }
.brand-text strong { color: var(--rojo); }
.header-tag { font-size: .78rem; color: var(--gris-600); background: var(--gris-100); padding: .3rem .6rem; border-radius: 999px; white-space: nowrap; }
@media (max-width: 539px) { .header-tag { display: none; } }

/* =============================================================
   4. Hero
   ============================================================= */
.hero { padding-block: 1.8rem .6rem; text-align: center; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.5rem); max-width: 22ch; margin-inline: auto; color: var(--texto); }
.hero-sub { margin-top: .7rem; color: var(--gris-600); font-size: 1.05rem; max-width: 46ch; margin-inline: auto; }

/* =============================================================
   5. Tool card
   ============================================================= */
.tool-section { padding-block: 1rem 1.5rem; }
.tool-card {
  background: var(--blanco);
  border: 1px solid var(--gris-200);
  border-radius: var(--radio);
  box-shadow: var(--sombra-md);
  overflow: hidden;
}
.tabs { display: flex; background: var(--gris-50); border-bottom: 1px solid var(--gris-200); }
.tab-btn {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .9rem .5rem; font-weight: 600; font-size: .92rem; color: var(--gris-600);
  border-bottom: 3px solid transparent; transition: color .2s var(--ease-out), border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.tab-btn:hover { color: var(--rojo); background: var(--rojo-claro); }
.tab-btn.is-active { color: var(--rojo); border-bottom-color: var(--rojo); background: var(--blanco); }
@media (max-width: 539px) { .tab-btn span, .tab-btn { font-size: .82rem; } .tab-btn { padding: .8rem .3rem; } }

.tab-panel { padding: 1.25rem 1.1rem 1.6rem; }
.tab-panel[hidden] { display: none; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }

.field { display: flex; flex-direction: column; gap: .35rem; font-size: .92rem; font-weight: 600; color: var(--texto); }
.field span { font-size: .85rem; }
.field input, .field select {
  font: inherit; font-weight: 500; padding: .68rem .8rem; border: 1.5px solid var(--gris-200);
  border-radius: var(--radio-sm); background: var(--gris-50); color: var(--texto);
  transition: border-color .15s var(--ease-out), background .15s var(--ease-out);
}
.field input:focus, .field select:focus { border-color: var(--rojo); background: var(--blanco); outline: none; }

.field-toggle { grid-column: 1 / -1; background: var(--gris-50); border: 1px solid var(--gris-200); border-radius: var(--radio-sm); padding: .75rem .9rem; }
.field-standalone { grid-column: 1 / -1; background: var(--gris-50); border: 1px solid var(--gris-200); border-radius: var(--radio-sm); padding: .75rem .9rem; }
.switch-label { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: .92rem; cursor: pointer; }
.switch-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--rojo); cursor: pointer; flex-shrink: 0; }
.field-sub { margin-top: .75rem; }

.disclaimer {
  font-size: .85rem; color: var(--rojo-oscuro); background: var(--rojo-claro);
  border: 1px solid #f2c9c9; border-radius: var(--radio-sm); padding: .7rem .9rem; margin-bottom: 1rem;
}

.form-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: 999px; font-weight: 700; font-size: .94rem;
  transition: transform .15s var(--ease-out), background .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--rojo); color: var(--blanco); box-shadow: 0 6px 16px rgba(122,19,21,.28); }
.btn-primary:hover { background: var(--rojo-oscuro); }
.btn-ghost { background: var(--gris-100); color: var(--texto); }
.btn-ghost:hover { background: var(--gris-200); }
.btn-whatsapp { background: var(--whatsapp); color: var(--blanco); }
.btn-whatsapp:hover { filter: brightness(0.93); }

/* =============================================================
   6. Resultado
   ============================================================= */
.resultado-card { margin-top: 1.4rem; }
.resultado-inner {
  background: var(--verde-claro); border: 1.5px solid #bfe6cd; border-radius: var(--radio);
  padding: 1.3rem 1.2rem;
}
.resultado-inner h3 { font-size: 1rem; color: var(--gris-600); font-weight: 700; }
.resultado-total { font-size: clamp(2rem, 6vw, 2.7rem); font-weight: 800; color: var(--verde); font-family: var(--display); margin: .2rem 0 1rem; }
.desglose { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .6rem; }
.desglose-item {
  display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem;
  padding: .6rem .75rem; background: var(--blanco); border-radius: 10px; border: 1px solid #d7ecdf;
}
.desglose-item.is-muted { opacity: .82; }
.desglose-label { font-size: .88rem; color: var(--gris-600); font-weight: 600; }
.desglose-valor { font-weight: 700; text-align: right; }
.desglose-nota { grid-column: 1 / -1; font-size: .78rem; color: var(--gris-600); }
.resultado-avisos { background: #fff7e6; border: 1px solid #f2dca0; border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0; font-size: .86rem; color: #7a5b06; }
.resultado-avisos[hidden] { display: none; }
.resultado-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }

.info-box { margin-top: 1.4rem; padding: 1rem 1.1rem; background: var(--azul-claro); border: 1px solid #cfe0fb; border-radius: var(--radio-sm); }
.info-box h3 { font-size: .95rem; color: var(--azul); margin-bottom: .35rem; }
.info-box p { font-size: .9rem; color: var(--gris-600); }

.privacy-badge { text-align: center; font-size: .85rem; color: var(--gris-600); margin-top: 1rem; }

/* =============================================================
   7. Ad slots
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center; min-height: 90px;
  border: 1.5px dashed var(--gris-400); border-radius: 10px; color: var(--gris-400);
  font-size: .78rem; letter-spacing: .08em; font-weight: 700; background: var(--gris-100);
}
.ad-slot-banner { margin: 1.2rem auto 0; max-width: 728px; }
.ad-slot-rect { min-height: 250px; max-width: 336px; margin: 1.4rem auto; }
.ad-slot-popup { min-height: 200px; margin-bottom: 1rem; }

.corner-ad {
  position: fixed; right: 12px; bottom: 12px; z-index: 30;
  display: none; align-items: center; gap: .5rem;
  background: var(--blanco); border: 1.5px dashed var(--gris-400); border-radius: 10px;
  padding: .5rem .6rem .5rem .8rem; box-shadow: var(--sombra-md);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; color: var(--gris-400);
  opacity: 0; transform: translateY(10px); transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
  max-width: 160px;
}
.corner-ad.is-visible { display: flex; opacity: 1; transform: translateY(0); }
.corner-ad-close { width: 22px; height: 22px; border-radius: 50%; background: var(--gris-100); display: grid; place-items: center; flex-shrink: 0; font-size: .7rem; }

.ad-dialog { border: none; border-radius: var(--radio); padding: 1.2rem; max-width: 380px; width: calc(100% - 2rem); box-shadow: var(--sombra-md); position: fixed; inset: 0; margin: auto; }
.ad-dialog::backdrop { background: rgba(20,10,10,.45); }
.ad-dialog-close { position: absolute; top: .6rem; right: .6rem; width: 30px; height: 30px; border-radius: 50%; background: var(--gris-100); display: grid; place-items: center; }

/* =============================================================
   8. Content sections
   ============================================================= */
.content-section { padding-block: 1.6rem; }
.content-section h2 { font-size: clamp(1.25rem, 2.6vw, 1.55rem); margin-bottom: .6rem; margin-top: 1.6rem; color: var(--rojo-oscuro); }
.content-section h2:first-child { margin-top: 0; }
.content-section p { color: var(--gris-600); margin-bottom: .8rem; max-width: 74ch; }

.steps { display: grid; gap: .9rem; margin-top: .8rem; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { display: flex; gap: .8rem; align-items: flex-start; background: var(--blanco); border: 1px solid var(--gris-200); border-radius: var(--radio-sm); padding: 1rem; }
.steps svg { color: var(--rojo); flex-shrink: 0; }
.steps strong { display: block; margin-bottom: .25rem; }
.steps p { font-size: .88rem; margin: 0; }

.faq-section details {
  background: var(--blanco); border: 1px solid var(--gris-200); border-radius: 10px;
  padding: .9rem 1.05rem; margin-bottom: .6rem;
}
.faq-section summary { font-weight: 700; cursor: pointer; list-style: none; }
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after { content: "+"; float: right; color: var(--rojo); font-weight: 800; }
.faq-section details[open] summary::after { content: "–"; }
.faq-section details p { margin-top: .6rem; color: var(--gris-600); }

/* =============================================================
   9. Footer
   ============================================================= */
.site-footer { background: var(--texto); color: #cfd3d9; padding-block: 1.6rem; margin-top: 1rem; }
.footer-inner { display: flex; flex-direction: column; gap: .6rem; font-size: .82rem; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { text-decoration: underline; color: #e7e9ec; }

/* =============================================================
   10. Print area (resumen PDF vía impresión del navegador)
   ============================================================= */
#print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; inset: 0; padding: 2rem; font-family: var(--sans); color: #111; }
  #print-area h1 { color: var(--rojo); font-size: 1.4rem; margin-bottom: .3rem; }
  .print-meta { font-size: .85rem; color: #444; margin-bottom: 1rem; }
  .print-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
  .print-table td { border: 1px solid #ccc; padding: .5rem .6rem; font-size: .88rem; }
  .print-total { font-size: 1.25rem; font-weight: 800; color: var(--verde); margin-bottom: 1rem; }
  .print-legal { font-size: .78rem; color: #555; border-top: 1px solid #ccc; padding-top: .8rem; }
}

/* =============================================================
   11. Reduced motion — solo lo intrusivo
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .corner-ad { transition: none; }
}
