/* Base, componentes y footer. Requiere fonts.css y tokens.css. */

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 400 var(--fs-body)/var(--lh-body) var(--font-body); letter-spacing: var(--ls-body);
  color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* los marcos animados no deben generar scroll lateral */
}
main { flex: 1 0 auto; }
/* Envoltorio del scroll suavizado (ScrollSmoother): se comporta como el cuerpo para que el pie quede abajo en páginas cortas. */
#smooth-wrapper, #smooth-content { display: flex; flex-direction: column; flex: 1 0 auto; }
.smooth-on #smooth-content { min-height: 100vh; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: .2em; }
a:hover { color: var(--color-teal); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 400; line-height: var(--lh-tight); letter-spacing: 0; margin: 0 0 var(--space-4); color: var(--color-navy); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-h5); }
p { margin: 0 0 var(--space-4); }
.display { font-family: var(--font-display); font-size: var(--fs-display); line-height: 1; }
.display--italic { font-style: italic; }
.lead { font-size: var(--fs-lead); }
.small { font-size: var(--fs-small); }
.label { font-size: var(--fs-label); font-weight: 500; text-transform: uppercase; letter-spacing: var(--ls-label); }
.muted { color: var(--fg-muted); }

/* ---------- Contador tipo ruleta (odometer.js): cualquier <span data-count="100" data-suffix="+">100+</span> ---------- */
.odo { display: inline-flex; align-items: flex-start; height: 1.12em; overflow: hidden; vertical-align: top; }
.odo__col { display: block; width: .64em; height: 1.12em; overflow: hidden; text-align: center; }
.odo__strip { display: flex; flex-direction: column; will-change: transform; }
.odo__strip span { display: block; height: 1.12em; line-height: 1.12em; }
.odo__prefix { display: inline-block; height: 1.12em; line-height: 1.12em; font-size: .45em; margin-right: .3em; vertical-align: top; letter-spacing: 0; }
.odo__suffix { display: inline-block; height: 1.12em; line-height: 1.12em; }
[data-count] .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[data-count] { position: relative; }

/* ---------- Títulos con máscara (headings.js) ---------- */
.split-pending main :is(h1, h2):not([data-nosplit]) { visibility: hidden; }
/* la máscara recorta con overflow: se deja aire abajo para que no corte las astas descendentes (g, y, p) */
main [class*="line-mask"] { padding-bottom: .16em; margin-bottom: -.16em; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 46rem; }
.section { padding-block: var(--space-8); }
.section--cream { background: var(--bg-alt); }
.section--navy { background: var(--bg-dark); color: var(--fg-on-dark); }
.section--navy :is(h1, h2, h3, h4, h5) { color: var(--fg-on-dark); }
.section--navy a { color: var(--fg-on-dark); }
.stack > * + * { margin-top: var(--space-4); }
.grid { display: grid; gap: var(--space-6); }
@media (min-width: 48rem) { .grid--2 { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Botones ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font: 500 .6875rem/1 var(--font-body); letter-spacing: .3px; text-transform: uppercase; text-decoration: none;
  padding: 15px 34px; border: 1px solid var(--color-navy); border-radius: var(--radius);
  background: var(--color-navy); color: var(--color-white); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--color-teal); border-color: var(--color-teal); color: var(--color-navy); }
.btn--accent { background: var(--color-teal); border-color: var(--color-teal); color: var(--color-navy); }
.btn--accent:hover { background: var(--color-navy); border-color: var(--color-navy); color: var(--color-white); }
.btn--light { background: var(--color-white); border-color: var(--color-white); color: var(--color-black); }
.btn--light:hover { background: var(--color-teal); border-color: var(--color-teal); color: var(--color-navy); }
.btn--ghost { background: transparent; color: var(--color-navy); }
.btn--ghost:hover { background: var(--color-navy); border-color: var(--color-navy); color: var(--color-white); }
.tag { display: inline-block; padding: 7px 12px; border-radius: var(--radius); background: var(--color-teal); color: var(--color-navy); font-size: .6875rem; font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }

/* ---------- Formularios ---------- */
.q { border: 0; padding: 0; margin: 0 0 var(--space-6); min-width: 0; }
.q legend { font-family: var(--font-display); font-size: var(--fs-h5); line-height: 1.2; color: var(--color-navy); margin-bottom: var(--space-3); padding: 0; }
.q label { display: flex; gap: var(--space-2); align-items: baseline; margin: var(--space-2) 0; cursor: pointer; }
.q input[type=radio], .q input[type=checkbox], .check input { accent-color: var(--color-navy); }
.q textarea, .q input[type=email], .q input[type=text], .field {
  width: 100%; font: inherit; letter-spacing: inherit; padding: .7rem .8rem; color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--color-white);
}
.q textarea:focus, .q input:focus, .field:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--color-navy); }
.q__scale { display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; }
.q__scale label { margin: 0; }
.q__err, .form-err { color: var(--danger); font-size: var(--fs-small); margin: var(--space-2) 0 0; }
.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

/* ---------- Consentimiento ---------- */
.consent {
  position: fixed; inset: auto 0 0 0; z-index: 1000; background: var(--color-navy); color: var(--color-white);
  border-top: 1px solid var(--line-on-dark); padding: var(--space-4) var(--gutter);
  display: flex; gap: var(--space-5); flex-wrap: wrap; align-items: center; justify-content: center; font-size: var(--fs-small);
}
.consent p { margin: 0; max-width: 46rem; }
.consent__actions button { flex: none; }
.consent { max-height: 80vh; overflow-y: auto; }
.consent a { color: var(--color-white); }
.consent__actions { display: flex; gap: var(--space-2); }
.consent__actions button {
  font: 500 .6875rem/1 var(--font-body); letter-spacing: .3px; text-transform: uppercase; padding: 13px 28px;
  border-radius: var(--radius); border: 1px solid var(--color-white); cursor: pointer;
}
.consent__actions [data-consent=accept] { background: var(--color-white); color: var(--color-black); }
.consent__actions [data-consent=reject] { background: transparent; color: var(--color-white); }
.consent__actions button:hover { background: var(--color-teal); border-color: var(--color-teal); color: var(--color-navy); }

/* ---------- Páginas legales ---------- */
.legal { max-width: 46rem; margin-inline: auto; padding: var(--space-8) var(--gutter); }
.legal h2 { margin-top: var(--space-7); font-size: var(--fs-h3); }
.legal h3 { margin-top: var(--space-6); font-size: var(--fs-h4); }
.legal ul, .legal ol { padding-left: 1.25rem; margin: 0 0 var(--space-4); }
.legal li { margin-bottom: var(--space-2); }
.legal table { border-collapse: collapse; width: 100%; font-size: var(--fs-small); display: block; overflow-x: auto; }
.legal th, .legal td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; vertical-align: top; }
.legal__source { margin-top: var(--space-7); color: var(--fg-muted); font-size: var(--fs-small); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-dark); color: var(--fg-on-dark); }
.site-footer a { color: var(--fg-on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--color-teal); }
.site-footer__main { display: grid; gap: var(--space-7); padding-block: var(--space-8) var(--space-7); }
@media (min-width: 48rem) { .site-footer__main { grid-template-columns: 1.2fr 1fr; gap: var(--space-9); } }
.site-footer__logo { display: block; width: 100px; height: 100px; margin-bottom: var(--space-5); }
.site-footer__logo img { display: block; width: 100%; height: 100%; }
.site-footer__contact { margin: 0 0 var(--space-5); font-size: var(--fs-lead); }
.site-footer__contact a { text-decoration: underline; text-underline-offset: .2em; }
.social { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; padding: 0; margin: 0; }
.social a { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; }
.social svg { width: 22px; height: 22px; fill: currentColor; }
.site-footer__title { font-family: var(--font-display); font-size: 1.75rem; line-height: 1.1; color: var(--fg-on-dark); margin: 0 0 var(--space-5); }
.site-footer__links { list-style: none; padding: 0; margin: 0; }
.site-footer__links li + li { margin-top: var(--space-3); }
.site-footer__links a { font-size: var(--fs-lead); }
.site-footer__note { margin: var(--space-5) 0 0; color: var(--fg-on-dark-muted); font-size: var(--fs-small); max-width: 26rem; }
.site-footer__bar { border-top: 1px solid var(--line-on-dark); }
.site-footer__bar .container { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); justify-content: space-between; align-items: center; padding-block: var(--space-5); }
.site-footer__bar p, .site-footer__bar a { margin: 0; font-size: var(--fs-label); font-weight: 400; text-transform: uppercase; letter-spacing: var(--ls-label); }
.site-footer__legal { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); list-style: none; padding: 0; margin: 0; }

/* ---------- Mis respuestas ---------- */
.answers { margin: var(--space-5) 0; padding: 0; }
.answers__row { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.answers dt { font-family: var(--font-display); font-size: var(--fs-h5); line-height: 1.25; color: var(--color-navy); margin: 0 0 var(--space-2); }
.answers dd { margin: 0; }

/* ---------- Ventana de ajustes de cookies ---------- */
html.consent-open { overflow: hidden; }
.cmodal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: var(--space-4); background: rgba(21, 27, 52, .6); }
.cmodal__panel { position: relative; width: 100%; max-width: 32rem; max-height: 90vh; overflow-y: auto; background: var(--color-white); color: var(--fg); border-radius: var(--radius); padding: var(--space-6); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.cmodal__panel h2 { font-size: var(--fs-h3); margin: 0 var(--space-6) var(--space-3) 0; }
.cmodal__panel p { font-size: var(--fs-small); color: var(--fg-muted); }
.cmodal__close { position: absolute; top: var(--space-3); right: var(--space-3); width: 36px; height: 36px; border: 0; background: transparent; font-size: 1.75rem; line-height: 1; color: var(--color-navy); cursor: pointer; border-radius: var(--radius); }
.cmodal__close:hover { background: var(--bg-alt); }
.cmodal__opt { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); margin-top: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font-size: var(--fs-small); }
.cmodal__opt input { margin-top: .2em; accent-color: var(--color-navy); }
.cmodal__opt strong { display: block; font-size: 1rem; color: var(--color-navy); margin-bottom: 2px; }
.cmodal__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-5); }
.cmodal__btn { font: 500 .6875rem/1 var(--font-body); letter-spacing: .3px; text-transform: uppercase; padding: 13px 20px; border-radius: var(--radius); border: 1px solid var(--color-navy); background: transparent; color: var(--color-navy); cursor: pointer; }
.cmodal__btn:hover { background: var(--color-navy); color: var(--color-white); }
.cmodal__btn--primary { background: var(--color-navy); color: var(--color-white); }
.cmodal__btn--primary:hover { background: var(--color-teal); border-color: var(--color-teal); color: var(--color-navy); }
.cmodal__list { margin: var(--space-2) 0 0; padding-left: 1.1rem; color: var(--fg-muted); font-weight: 400; }
.cmodal__list li { margin-bottom: 2px; }
.cmodal__opt strong { font-weight: 600; }
.cmodal__opt > span { font-weight: 400; }
.cmodal__note { margin: var(--space-4) 0 0; }
