/* base.css — «La cara primero»: escenario partido, campos de color y tarjetas.
   Orden de carga: tokens.css → fonts.css → base.css */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--step-body); line-height: 1.5; font-kerning: normal; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; background: var(--surface); }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--margin); top: -4rem; background: var(--bg); color: var(--ink); padding: 0.75rem 1rem; z-index: 10; }
.skip:focus { top: 0.75rem; }
.nums { font-variant-numeric: tabular-nums; }
.small { font-size: var(--step-small); line-height: 1.45; }
.muted { color: var(--muted); }
strong { font-weight: 600; }

/* ---------- idioma: se muestra sólo el idioma activo ---------- */
html[data-lang="en"] [lang="es"], html[data-lang="es"] [lang="en"] { display: none !important; }

/* ---------- botones: píldora, una sola forma ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 1.4rem; border-radius: var(--pill); font-size: var(--step-small); font-weight: 600; text-decoration: none; background: var(--accent); color: var(--accent-ink); transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease, opacity var(--t-hover) var(--ease-out); }
.btn--accent { background: var(--accent); color: var(--accent-ink); }
.btn--dark { background: #2c3768; color: var(--field-dark-ink); }
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.97); }
.btn--text { display: inline-flex; align-items: center; min-height: 48px; font-size: var(--step-small); font-weight: 600; color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.22em; transition: transform var(--t-press) var(--ease-out), opacity var(--t-hover) var(--ease-out); }
.btn--text:hover { opacity: 0.72; }
.btn--text:active { transform: scale(0.97); }

/* ---------- escenario partido: cara fija (izquierda) + columna de lectura (derecha) ---------- */
.stage { display: grid; grid-template-columns: var(--split) 1fr; }
.stage__face { position: sticky; top: 0; height: 100svh; background: var(--sky); display: grid; place-items: center; align-content: center; gap: 1rem; padding: var(--margin); }
.stage__face img { width: min(100%, 440px); aspect-ratio: 4/5; object-fit: cover; object-position: 50% 28%; border-radius: var(--radius-lg); animation: face-in 600ms var(--ease-out) both; }
.stage__where { font-size: var(--step-small); color: var(--muted); }
.stage__status { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.875rem; background: var(--bg); border-radius: var(--pill); font-size: var(--step-small); font-weight: 600; line-height: 1.3; text-align: center; }
.stage__status::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--accent); }
.stage__read { --read-pad: clamp(1.5rem, 4vw, 4.5rem); min-width: 0; padding-inline: var(--read-pad); }

/* ---------- barra de nombre ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; min-height: 68px; padding-block: 0.5rem; padding-inline: var(--read-pad); margin-inline: calc(-1 * var(--read-pad)); background: var(--bg); }
.topbar__name { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; letter-spacing: -0.01em; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.topbar__name:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.topbar__nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; font-size: var(--step-small); flex: none; }
.navlinks { display: flex; align-items: center; gap: 1.25rem; }
.topbar__nav a { text-decoration: none; }
.topbar__nav a:hover { text-decoration: underline; }
.topbar__nav .topbar__cv { padding: 0.55rem 1.25rem; white-space: nowrap; }
#inicio, #work, #match, #studies, #about, #contact { scroll-margin-top: 5.5rem; }
.lang { font-size: var(--step-small); font-weight: 600; letter-spacing: 0.02em; padding: 0.5rem 0.25rem; }
.menu-btn { display: none; font-size: var(--step-small); font-weight: 600; padding: 0.5rem 0; }

/* la fila completa de enlaces no cabe por debajo de ~1120 px: ahí se usa Menú */
@media (max-width: 69.99em) {
  .topbar, .topbar__nav { flex-wrap: wrap; row-gap: 0.25rem; gap: 0.875rem; }
  .topbar__nav .navlinks { display: none; }
  .topbar__nav.is-open { flex: 1 1 100%; }
  .topbar__nav.is-open .navlinks { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; flex: 1 1 100%; order: 3; padding: 0.5rem 0; }
  .menu-btn { display: inline-block; }
  .topbar__nav.is-open .navlinks { animation: menu-in 220ms var(--ease-out); }
}

/* ---------- móvil (< 900 px): una columna, la cara arriba como tarjeta ---------- */
@media (max-width: 56.24em) {
  .stage { grid-template-columns: 1fr; }
  .stage__read { --read-pad: var(--margin); }
  .stage__face { position: static; height: auto; }
  .stage__face img { width: 100%; aspect-ratio: 4/3; object-position: 50% 25%; }
}

/* ---------- campos de color a sangre dentro de la columna de lectura ---------- */
.field { margin-inline: calc(-1 * var(--read-pad)); padding: var(--section) var(--read-pad); }
.field > * { max-width: var(--read); }
.field--sand { background: var(--sand); color: var(--ink); }
.field--sky { background: var(--sky); color: var(--ink); }
.field--sun { background: var(--sun); color: var(--ink); }
.field--navy { background: var(--navy); color: var(--field-dark-ink); }
.field--navy :focus-visible { outline-color: var(--field-dark-ink); }

/* ---------- titulares de sección ---------- */
.field h2, .letter h2 { font-family: var(--font-display); font-weight: 600; font-size: var(--step-head); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(2rem, 5vw, 4rem) 0; }
.hero__title { font-family: var(--font-display); font-weight: 700; font-size: var(--step-display); line-height: 1.02; letter-spacing: -0.03em; text-wrap: balance; }
.hero__lede { margin-top: clamp(1rem, 2vw, 1.5rem); font-size: var(--step-lead); line-height: 1.35; max-width: 34ch; }
.hero__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.75rem; margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* ---------- áreas: 2×2 de tarjetas ---------- */
.intro { padding-block: clamp(2.5rem, 4vw, 3.5rem) clamp(3rem, 6vw, 6rem); }
.areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); }
.area { background: var(--sand); border-radius: var(--radius); padding: 1.5rem; }
.area__title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-lead); line-height: 1.2; margin-bottom: 0.5rem; }
.area p { font-size: var(--step-body); line-height: 1.5; }
@media (max-width: 39.99em) { .areas { grid-template-columns: 1fr; } }

/* ---------- trabajo: tarjetas ---------- */
.jobs { display: grid; gap: var(--gutter); }
.ledger__row { position: relative; background: var(--bg); border-radius: var(--radius); padding: 1.5rem; }
.ledger__year { font-size: var(--step-small); color: var(--muted); }
.ledger__name { font-family: var(--font-display); font-weight: 600; font-size: var(--step-lead); line-height: 1.2; margin-top: 0.25rem; }
.ledger__name a { text-decoration: none; }
.ledger__name a:hover { text-decoration: underline; }
.ledger__kind { font-family: var(--font-display); font-weight: 600; font-size: var(--step-body); line-height: 1.3; margin-top: 0.25rem; }
.ledger__more { margin-top: 0.875rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.ledger__row.is-open .ledger__more { display: block; }
.ledger__toggle { margin-top: 0.875rem; font-size: var(--step-small); font-weight: 600; color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.2em; transition: transform var(--t-press) var(--ease-out), opacity var(--t-hover) var(--ease-out); }
.ledger__toggle:hover { opacity: 0.72; }
.ledger__toggle:active { transform: scale(0.97); }
.ledger__label-less { display: none; }
.ledger__row.is-open .ledger__label-less { display: inline; }
.ledger__row.is-open .ledger__label-more { display: none; }
@media (hover: hover) and (pointer: fine) {
  .ledger__row { transition: transform var(--t-hover) var(--ease-out), background-color var(--t-hover) ease; }
  .ledger__row:hover { transform: translateY(-3px); }
}
.ledger__row:active { transform: scale(0.97); }

/* ---------- compara: la cosa viva ---------- */
.match textarea { display: block; width: 100%; min-height: 11rem; padding: 1rem; background: var(--bg); border: 0; border-radius: var(--radius); resize: vertical; font-size: var(--step-body); line-height: 1.45; }
.match textarea:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.match__bar { display: flex; align-items: center; gap: 1.25rem; margin-top: 1rem; flex-wrap: wrap; }
.match__result { display: block; margin-top: 1rem; font-family: var(--font-display); font-weight: 600; font-size: var(--step-lead); line-height: 1.25; min-height: 1.5em; }
.match__result:empty { margin-top: 0; min-height: 0; }
.match__terms { display: flex; flex-wrap: wrap; gap: 0.375rem 0.5rem; margin-top: 0.75rem; }
.match__terms:empty { margin-top: 0; }
.match__terms span { background: var(--bg); border-radius: var(--pill); padding: 0.25rem 0.75rem; font-size: var(--step-small); animation: chip-in 220ms var(--ease-out) both; animation-delay: calc(min(var(--i, 12), 12) * 30ms); }
mark.hit { background: #ffc489; color: var(--ink); }
.skills { margin-top: 2rem; }
.skills dt { font-family: var(--font-display); font-weight: 600; font-size: var(--step-small); letter-spacing: 0.01em; margin-top: 1.5rem; }
.skills dd { margin: 0.5rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.375rem 0.5rem; }
.chips li { background: var(--bg); border-radius: var(--pill); padding: 0.25rem 0.75rem; font-size: var(--step-small); line-height: 1.4; color: var(--ink); transition: transform var(--t-press) var(--ease-out); }
.chips li:active { transform: scale(0.97); }
.chips li.is-hit { background: #ffc489; color: var(--ink); animation: chip-in 220ms var(--ease-out) both; animation-delay: calc(min(var(--i, 12), 12) * 30ms); }
.chips a { text-decoration: underline; text-decoration-thickness: 1px; }
.chips--links li { padding: 0.375rem 0.875rem; transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease; }
.field .small.muted { color: var(--ink); margin-top: 1rem; }

/* ---------- estudios ---------- */
.studies { display: grid; gap: var(--gutter); }
.study { background: var(--bg); border-radius: var(--radius); padding: 1.5rem; }
.study__title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-lead); line-height: 1.2; }
.study__meta { margin-top: 0.375rem; font-size: var(--step-small); color: var(--muted); }
.group-title { font-family: var(--font-display); font-weight: 600; font-size: var(--step-small); letter-spacing: 0.01em; margin-top: 2.5rem; margin-bottom: 0.75rem; }

/* ---------- fotos elegidas (bloque 8.2b) ---------- */
.photo { max-width: var(--read); margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
.photo > span { display: block; }
.photo img { width: 100%; height: auto; border-radius: var(--radius); }
.photo figcaption { margin-top: 0.5rem; font-size: var(--step-small); color: var(--muted); }
.field--navy .photo figcaption { color: var(--field-dark-ink); }

/* ---------- sobre mí: la carta ---------- */
.letter { padding-block: var(--section); }
.letter p { font-size: var(--step-body); line-height: 1.6; max-width: var(--read); }
.letter p + p { margin-top: 1.15em; }
.letter__sign { font-style: italic; font-size: 1.3125rem; line-height: 1.4; color: var(--muted); }

/* ---------- contacto ---------- */
.contact__title { font-family: var(--font-display); font-weight: 700; font-size: var(--step-display); line-height: 1.02; letter-spacing: -0.03em; }
.contact__lede { font-size: var(--step-lead); line-height: 1.4; margin-top: 0.875rem; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: clamp(1.5rem, 2.5vw, 2rem); }
.contact__meta { margin-top: clamp(1.75rem, 3vw, 2.5rem); font-size: var(--step-small); }

/* ---------- pie ---------- */
.foot { margin-inline: calc(-1 * var(--read-pad)); margin-top: 0; padding: clamp(3rem, 6vw, 4.5rem) var(--read-pad) 2.5rem; background: var(--navy); color: var(--field-dark-ink); }
.foot__name { font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 12vw, 10rem); line-height: 0.95; letter-spacing: -0.04em; }
.foot nav { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: clamp(1.5rem, 3vw, 2.5rem); font-size: var(--step-small); }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot__r { margin-top: 1.5rem; font-size: var(--step-small); }
.foot__credits { margin-top: 0.75rem; font-size: var(--step-small); }
.foot__credits a { text-decoration: underline; text-decoration-thickness: 1px; }

/* ---------- entradas (sólo si hay JS: el contenido nunca queda oculto sin él) ---------- */
/* ---------- movimiento: la cara y las entradas; sólo transform y opacity ---------- */
@keyframes face-in { from { opacity: 0; transform: scale(0.96); } }
@keyframes chip-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes fade-in { from { opacity: 0; } }
html.js .reveal { opacity: 0; transform: translateY(20px); transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out); transition-delay: calc(var(--i, 0) * var(--stagger)); }
html.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: opacity 200ms ease; transition-delay: 0s; }
  html.js .reveal.is-in { opacity: 1; transform: none; }
  .stage__face img { animation: face-fade 200ms ease both; }
  .btn, .btn:active, .btn--text, .btn--text:active, .topbar__cv, .topbar__cv:active, .lang, .menu-btn, .ledger__toggle, .ledger__toggle:active, .chips li, .chips li:active, .chips--links li, .chips--links li:active { transition: opacity 200ms ease, background-color 200ms ease, color 200ms ease; transform: none; }
  .ledger__row, .ledger__row:hover, .ledger__row:active { transition: opacity 200ms ease, background-color 200ms ease; transform: none; }
  .topbar__nav.is-open .navlinks { animation: menu-fade 200ms ease; }
  .match__terms span, .chips li.is-hit { animation: fade-in 200ms ease both; animation-delay: 0s; }
}
@keyframes face-fade { from { opacity: 0; } }
@keyframes menu-fade { from { opacity: 0; } }

/* ---------- páginas secundarias (privacidad) ---------- */
.col { margin-inline: var(--margin); }
.page-top { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem var(--margin); }
.page-top a { text-decoration: none; font-size: var(--step-small); }
.page-top a:hover { text-decoration: underline; }
.doc { padding-top: 6rem; padding-bottom: var(--section); }
.doc h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--step-head); line-height: 1.05; letter-spacing: -0.02em; margin-bottom: 1.5rem; max-width: 20ch; }
.doc p { max-width: 56ch; }
.doc p + p { margin-top: 1.15em; }
@media (max-width: 39.99em) { .doc { padding-top: 3rem; } }

/* ---------- objetivos táctiles de 44 px ---------- */
.topbar__nav a, .foot a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 0.125rem; }
.lang, .menu-btn { min-height: 44px; min-width: 44px; }
