/* ==========================================================
   Calculadora de Cuota de Autónomos 2026 · style.css
   CSS puro · Mobile First · Sin frameworks ni fuentes externas
   ========================================================== */

:root {
  /* Paleta */
  --navy-900: #071a33;
  --navy-800: #0b2545;
  --navy-700: #13315c;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --accent: #0f766e;
  --accent-700: #115e59;
  --accent-soft: #e6f6f4;
  --danger: #b42318;
  --danger-soft: #fef3f2;

  /* Semánticas */
  --bg: var(--white);
  --text: var(--slate-700);
  --text-strong: var(--navy-800);
  --muted: var(--slate-500);
  --border: var(--slate-200);

  /* Sistema */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 37, 69, .06), 0 1px 3px rgba(11, 37, 69, .08);
  --shadow-md: 0 8px 22px rgba(11, 37, 69, .10);
  --container: 1100px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

img, svg { max-width: 100%; height: auto; }
[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: .15em; }
a:hover { color: var(--accent-700); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: .6rem 1rem;
  color: var(--white);
  background: var(--accent);
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- Contenedor principal ---------- */
.wrap {
  width: 100%;
  max-width: var(--container); /* 1100px */
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---------- Cabecera y navegación ---------- */
.site-header {
  background: var(--navy-800);
  position: relative;
  z-index: 50;
}

.nav {
  width: 100%;
  max-width: var(--container); /* 1100px */
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.brand {
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.01em;
  text-decoration: none;
}
.brand span { color: #5eead4; }
.brand:hover { color: var(--white); }

.nav-links {
  display: flex;
  gap: .25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-links a {
  display: block;
  padding: .45rem .8rem;
  color: rgba(255, 255, 255, .88);
  font-size: .92rem;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 999px;
  transition: background-color .2s ease, color .2s ease;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--white);
  background: rgba(255, 255, 255, .14);
}

/* ---------- Pan superior ---------- */
.intro { padding: 2rem 0 1.5rem; }

h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--text-strong);
}

.intro p {
  max-width: 80ch;
  margin: 0 0 1rem;
  font-size: 1.05rem;
}

/* ---------- Calculadora (grid) ---------- */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  margin: 1rem 0 2rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  border-color: var(--slate-300);
  box-shadow: var(--shadow-md);
}
.card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .14), var(--shadow-md);
}

.card-title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  line-height: 1.3;
  color: var(--text-strong);
}

/* Campos */
.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  margin-bottom: .4rem;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-strong);
}

.input-wrap { position: relative; }

.input-wrap input {
  width: 100%;
  padding: .85rem 2.75rem .85rem .95rem;
  font: inherit;
  font-size: 1.05rem; /* evita el zoom automático en iOS */
  color: var(--text-strong);
  background: var(--slate-50);
  border: 1.5px solid var(--slate-300);
  border-radius: var(--radius-sm);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.input-wrap input::placeholder { color: var(--slate-500); opacity: .7; }
.input-wrap input:hover {
  background: var(--white);
  border-color: var(--slate-500);
}
.input-wrap input:focus {
  outline: none;
  background: var(--white);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .18);
}
.input-wrap input[aria-invalid="true"] { border-color: var(--danger); }
.input-wrap input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .16); }

.suffix {
  position: absolute;
  right: .95rem;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

.hint {
  display: block;
  margin-top: .35rem;
  font-size: .85rem;
  color: var(--muted);
}

.error {
  margin: 0 0 1rem;
  padding: .7rem .9rem;
  font-size: .9rem;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
}

/* Botón */
.btn {
  display: block;
  width: 100%;
  padding: .95rem 1.25rem;
  font: inherit;
  font-weight: 700;
  color: var(--white);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .2s ease, transform .1s ease, box-shadow .2s ease;
}
.btn:hover {
  background: var(--accent-700);
  box-shadow: 0 6px 16px rgba(15, 118, 110, .28);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--navy-800); outline-offset: 3px; }

/* Resultados */
.placeholder {
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
}

.hero-result {
  margin-bottom: 1rem;
  padding: 1.25rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  border-radius: var(--radius-sm);
}
.hero-label {
  display: block;
  font-size: .8rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: .85;
}
.hero-value {
  display: block;
  margin: .2rem 0;
  font-size: clamp(2.1rem, 8vw, 3rem);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-sub { font-size: .9rem; opacity: .85; }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1rem;
}
.stat {
  padding: .85rem;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  transition: background-color .2s ease;
}
.stat:hover { background: var(--accent-soft); }
.stat-label {
  display: block;
  font-size: .78rem;
  color: var(--muted);
}
.stat-value {
  display: block;
  margin: .1rem 0;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: .8rem; color: var(--muted); }

.details { margin: 0; }
.details > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  font-size: .93rem;
  border-bottom: 1px solid var(--border);
}
.details > div:last-child { border-bottom: 0; }
.details dt { color: var(--muted); }
.details dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.aviso {
  margin: .75rem 0 0;
  padding: .6rem .8rem;
  font-size: .88rem;
  color: var(--navy-700);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.disclaimer {
  margin: 1rem 0 0;
  font-size: .8rem;
  color: var(--muted);
}

/* ---------- Pan inferior (contenido SEO) ---------- */
.content { padding: 0 0 3rem; }

.content h2 {
  margin: 2.5rem 0 .75rem;
  padding-bottom: .4rem;
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  line-height: 1.3;
  color: var(--text-strong);
  border-bottom: 2px solid var(--accent-soft);
}
.content h3 {
  margin: 1.5rem 0 .4rem;
  font-size: 1.1rem;
  line-height: 1.35;
  color: var(--navy-700);
}
.content p {
  max-width: 80ch;
  margin: 0 0 1rem;
}

/* Tabla de tramos */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tabla {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: .92rem;
}
.tabla caption {
  caption-side: bottom;
  padding: .6rem .8rem;
  text-align: left;
  font-size: .85rem;
  color: var(--muted);
}
.tabla th,
.tabla td {
  padding: .65rem .8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.tabla thead th {
  font-weight: 600;
  white-space: nowrap;
  color: var(--white);
  background: var(--navy-800);
  border-bottom: 0;
}
.tabla tbody th { font-weight: 700; color: var(--text-strong); }
.tabla tbody tr { transition: background-color .15s ease; }
.tabla tbody tr:nth-child(even) { background: var(--slate-50); }
.tabla tbody tr:hover { background: var(--slate-100); }
.tabla tbody tr.is-active { background: var(--accent-soft); }
.tabla tbody tr.is-active th { box-shadow: inset 4px 0 0 var(--accent); }
.tabla .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* FAQ */
.faq-item {
  margin: 0 0 .75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.faq-item:hover {
  border-color: var(--slate-300);
  box-shadow: var(--shadow-sm);
}
.faq-item h3 { margin: 0 0 .35rem; }
.faq-item p { margin: 0; }

/* ---------- Pie ---------- */
.site-footer {
  padding: 1.5rem 0;
  font-size: .85rem;
  color: rgba(255, 255, 255, .8);
  background: var(--navy-900);
}
.site-footer p { max-width: 80ch; margin: 0; }

/* ---------- Tablet y escritorio ---------- */
@media (min-width: 768px) {
  html { scroll-padding-top: 5rem; }

  .wrap { padding: 0 1.5rem; }

  .site-header {
    position: sticky;
    top: 0;
  }
  .nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.5rem;
  }
  .nav-links { overflow: visible; }

  .intro { padding: 3rem 0 2rem; }

  .calc-grid {
    grid-template-columns: 1fr 1fr; /* dos columnas en escritorio */
    gap: 1.75rem;
  }
  .card { padding: 1.75rem; }

  .btn { width: auto; min-width: 12rem; }
}

@media (min-width: 1100px) {
  .intro p { font-size: 1.1rem; }
}

/* ---------- Accesibilidad: movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}