/* Portal laboral · CSS base. Mobile-first, breakpoint 780px. Sin fuentes externas (tipografía del sistema).
   Sobrio y legible; a propósito sin aspecto de web institucional. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1b2430;
  --ink-soft: #46515f;
  --line: #d9d6cd;
  --brand: #1f3a5f;
  --brand-ink: #ffffff;
  --accent: #e8b04a;
  --link: #174a8b;
  --warn-bg: #fff6df;
  --warn-line: #e3c36e;
  --radius: 8px;
  --gutter: 16px;
  --max: 1040px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181e; --surface: #1b212a; --ink: #e9edf2; --ink-soft: #b2bcc8; --line: #323b47;
    --brand: #0f1d31; --link: #8db8f2; --warn-bg: #2b2412; --warn-line: #6d5a1f;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
main.wrap { padding-block: 24px 48px; }
a { color: var(--link); text-underline-offset: 2px; }
a:focus-visible, summary:focus-visible, .table-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; height: auto; }

h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: 1.75rem; margin-top: .4em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p, ul, ol, dl { margin: 0 0 1em; }
.lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 62ch; }
.cita { color: var(--ink-soft); font-size: .9em; }
.nota { color: var(--ink-soft); font-size: .95em; }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #000; padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; top: 8px; }

/* cabecera y pie */
.site-header { background: var(--brand); color: var(--brand-ink); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-block: 12px; }
.brand { color: var(--brand-ink); font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.nav-main { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.nav-main a { color: var(--brand-ink); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav-main a[aria-current="page"], .nav-main a:hover { border-bottom-color: var(--accent); }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 24px; font-size: .92rem; color: var(--ink-soft); }
.footer-aviso { max-width: 70ch; }
.footer-links, .footer-legal { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 12px; }

/* migas */
.crumbs ol { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: .9rem; color: var(--ink-soft); }
.crumbs li + li::before { content: "/"; margin: 0 8px; color: var(--line); }

/* avisos */
.aviso { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 14px; font-size: .95rem; }

/* datos clave */
.datos-clave { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.datos-clave > div { padding: 10px 14px; border-top: 1px solid var(--line); }
.datos-clave > div:first-child { border-top: 0; }
.datos-clave dt { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.datos-clave dd { margin: 2px 0 0; }

/* tablas: scroll horizontal dentro del contenedor y primera columna fija */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 0 0 1.2em; }
.tabla-salarial { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 560px; font-size: .95rem; font-variant-numeric: tabular-nums; }
.tabla-salarial th, .tabla-salarial td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: top; }
.tabla-salarial thead th { background: var(--bg); position: sticky; top: 0; font-size: .85rem; }
.tabla-salarial th:first-child, .tabla-salarial td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 150px; max-width: 220px; white-space: normal; box-shadow: 1px 0 0 var(--line); }
.tabla-salarial thead th:first-child { background: var(--bg); z-index: 2; }
.tabla-salarial td:last-child { text-align: left; white-space: normal; min-width: 140px; }
.tabla-salarial tbody tr:last-child > * { border-bottom: 0; }

/* FAQ */
.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; }
.faq details p { padding: 0 14px 12px; margin: 0; }

.lista { padding-left: 1.2em; }
.relacionados ul { padding-left: 1.2em; }

/* formularios y calculadoras (campos grandes, base para la Fase 3) */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select { font: inherit; min-height: 48px; width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
button, .btn { font: inherit; min-height: 48px; padding: 8px 20px; border: 0; border-radius: var(--radius); background: var(--brand); color: var(--brand-ink); cursor: pointer; }

/* huecos de anuncio: altura reservada, VACÍOS e inactivos (sin borde, sin texto, sin scripts).
   Al activarlos en la Fase 8 no hay CLS porque el espacio ya existe. */
.ad-slot { display: block; width: 100%; max-width: 336px; margin: 24px auto; contain: layout size; }
.ad-slot--leaderboard { height: 100px; }   /* 320x100 en móvil */
.ad-slot--rectangle { height: 280px; }     /* 300x250 + margen */

@media (min-width: 780px) {
  :root { --gutter: 24px; }
  main.wrap { padding-block: 40px 72px; }
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.55rem; }
  .datos-clave { grid-template-columns: repeat(2, 1fr); }
  .datos-clave > div { border-top: 1px solid var(--line); }
  .datos-clave > div:nth-child(-n+2) { border-top: 0; }
  .datos-clave > div:nth-child(odd) { border-right: 1px solid var(--line); }
  .tabla-salarial { min-width: 0; }
  .ad-slot { max-width: 970px; }
  .ad-slot--leaderboard { height: 100px; }   /* 728x90 / 970x90 */
  .ad-slot--rectangle { height: 280px; }
}

@media print {
  .site-header, .site-footer .footer-links, .ad-slot, .skip { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
  .table-scroll { overflow: visible; border: 0; }
  .tabla-salarial th:first-child, .tabla-salarial td:first-child { position: static; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---- Calculadoras (calc-ui.js) ---- */
.cards{list-style:none;padding:0;display:grid;gap:12px}
.cards li{border:1px solid var(--line,#d7dde6);border-radius:10px;padding:14px 16px}
.pl-calc{border:1px solid var(--line,#d7dde6);border-radius:12px;padding:16px;margin:18px 0}
.pl-calc__form{display:grid;gap:14px}
.pl-calc__grupo{display:grid;gap:6px;border:0;padding:0;margin:0}
.pl-calc__campo{font-size:1.05rem;padding:12px;min-height:48px;width:100%;box-sizing:border-box;border:1px solid var(--line,#b9c3d1);border-radius:8px;background:transparent;color:inherit}
.pl-calc__ayuda{font-size:.85rem;opacity:.75}
.pl-calc__error,.pl-calc__resumen-errores{color:#b3261e;font-size:.9rem}
.pl-calc__acciones{display:flex;gap:10px;flex-wrap:wrap}
.pl-calc__boton{font-size:1rem;min-height:48px;padding:0 20px;border-radius:8px;border:0;background:#1f3a5f;color:#fff;cursor:pointer}
.pl-calc__boton--secundario{background:transparent;color:inherit;border:1px solid currentColor}
.pl-calc__hijos{display:grid;gap:10px}
.pl-calc__resultado{margin-top:18px}
.pl-calc__cifras{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:12px 0}
.pl-calc__cifra{border:1px solid var(--line,#d7dde6);border-radius:10px;padding:10px 12px}
.pl-calc__tabla{width:100%;border-collapse:collapse;font-size:.92rem}
.pl-calc__tabla th,.pl-calc__tabla td{padding:8px;border-bottom:1px solid var(--line,#d7dde6);text-align:left;vertical-align:top}
.pl-calc__aviso,.pl-calc__no-soportado{font-size:.88rem;padding:10px 12px;border-radius:8px;background:rgba(232,176,74,.15)}
.pl-calc__fuentes{font-size:.82rem;opacity:.8}
@media print{.pl-calc__form,.pl-calc__no-imprimir,.ad-slot,header,footer,nav{display:none!important}.pl-calc{border:0;padding:0}}

/* ---- Portada ---- */
.buscador{margin:18px 0 28px;padding:16px;border:1px solid var(--line,#d7dde6);border-radius:12px}
.buscador label{display:block;margin-bottom:6px;font-weight:600}
.resultados{list-style:none;padding:0;margin:8px 0}
.resultados li{padding:10px 0;border-bottom:1px solid var(--line,#d7dde6)}
.resultados a{display:block;min-height:44px;line-height:44px}

/* Reserva de altura para que el contenido de debajo no salte al montar la calculadora (CLS) */
[data-pl-calc]{min-height:80vh}
.calc-ficha [data-pl-calc]{min-height:0}
.aviso--borrador{background:rgba(179,38,30,.12);border:1px solid #b3261e;padding:10px 12px;border-radius:8px}
