/* Base: reinicio suave, tipografía y estructura de página. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 var(--text-base)/1.5 var(--font-text);
  font-feature-settings: "cv11";
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* Un solo peso: la jerarquía la dan el tamaño y el interlineado. */
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0 0 var(--s-4); text-wrap: balance; }
h1 { font-size: var(--text-2xl); line-height: 1.14; letter-spacing: -0.01em; }
h2 { font-size: var(--text-xl); line-height: 1.17; }
h3 { font-size: var(--text-lg); line-height: 1.3; }
p, li, dd { text-wrap: pretty; }
p { margin: 0 0 var(--s-4); }
strong, b { font-weight: 500; }
a { color: var(--c-link); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; text-decoration-color: var(--c-ink-2); transition: text-decoration-color var(--ease); }
a:hover { color: var(--c-ink); text-decoration-color: var(--c-ink); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }
.mono { font-variant-numeric: tabular-nums; }
.small { font-size: var(--text-sm); }
.muted { color: var(--c-ink-2); }
/* Etiqueta pequeña en mayúsculas (fecha, fuente, rótulos) */
.label-caps { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: var(--track-label); color: var(--c-ink-2); }

:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: var(--s-4); top: -100px;
  background: var(--c-ink); color: var(--c-surface); padding: var(--s-2) var(--s-3); z-index: 10; border-radius: var(--radius);
}
.skip:focus { top: var(--s-2); }

/* Barra superior: blanca, fija, con borde inferior */
.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-bottom: var(--border);
  background: var(--c-surface);
}
/* Logo: tres barras ascendentes en amarillo + nombre en Inter seminegrita (el único texto con peso: es la marca) */
.wordmark {
  display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap);
  font-size: var(--text-lg); font-weight: 900; line-height: 1; letter-spacing: -0.02em;
  color: var(--c-ink); text-decoration: none;
}
.logo-mark { width: 22px; height: auto; flex: none; fill: var(--c-accent); }
.wordmark:hover { color: var(--c-ink); }
.site-nav { display: flex; align-items: center; gap: var(--s-1); flex-wrap: wrap; }
.site-nav a, .site-nav .link-button {
  color: var(--c-ink); font-size: var(--text-sm); text-decoration: none; min-height: 36px; padding: 0 var(--s-2); border-radius: var(--radius);
  display: inline-flex; align-items: center; transition: background-color var(--ease);
}
.site-nav a:hover, .site-nav .link-button:hover { background: var(--c-wash); color: var(--c-ink); text-decoration: none; }
/* Página actual: fondo, texto en tinta y una raya amarilla debajo del ícono */
.site-nav a[aria-current="page"] { background: var(--c-wash); box-shadow: inset 0 0 0 1px var(--c-line); }
.site-nav a[aria-current="page"] .nav-icon { color: var(--c-ink); }
.site-nav a, .site-nav .link-button { gap: 6px; }
.nav-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; color: var(--c-ink-2); transition: color var(--ease); }
.site-nav a:hover .nav-icon, .site-nav .link-button:hover .nav-icon { color: var(--c-ink); }
/* Teléfono muy angosto: solo íconos con su nombre debajo, en letra pequeña */
@media (max-width: 26rem) {
  html:not(.js) .site-nav a, html:not(.js) .site-nav .link-button { flex-direction: column; gap: 2px; min-height: 44px; padding: 4px 8px; font-size: 0.6875rem; }
  .nav-icon { width: 18px; height: 18px; }
}
.site-nav .nav-strong { background: var(--c-accent); color: var(--c-accent-ink); }
.site-nav .nav-strong:hover { background: var(--c-accent-hover); }

main {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s-6) var(--s-4) var(--s-8);
}
main.wide { max-width: none; padding-bottom: var(--s-6); }

.site-footer {
  border-top: var(--border);
  background: var(--c-surface);
  padding: var(--s-5) var(--s-4);
  color: var(--c-ink-2);
  font-size: var(--text-sm);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); }
.site-footer a { color: var(--c-ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--c-ink); text-decoration: underline; }
.site-footer p { margin: 0; }
.lang-switch { margin: 0; }
.site-footer .link-button { color: var(--c-ink-2); min-height: 0; text-decoration: none; }
.site-footer .link-button:hover { color: var(--c-ink); text-decoration: underline; }

/* Selector de tema */
.theme-switch {
  display: inline-flex; gap: 2px; padding: 2px;
  border: var(--border); border-radius: var(--radius-field); background: var(--c-wash);
}
.theme-switch[hidden] { display: none; }
.theme-switch button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius); padding: 0;
  background: transparent; color: var(--c-ink-2); cursor: pointer; transition: background-color var(--ease), color var(--ease);
}
.theme-switch button:hover { color: var(--c-ink); }
.theme-switch button[aria-checked="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: inset 0 0 0 1px var(--c-line); }
.theme-switch button:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; }
.theme-switch svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.theme-switch [data-theme-value="dark"] svg { fill: currentColor; stroke: none; }

/* Selector de idioma: mismo aspecto que el de tema */
.lang-seg {
  display: inline-flex; gap: 2px; padding: 2px; margin: 0;
  border: var(--border); border-radius: var(--radius-field); background: var(--c-wash);
}
.lang-seg button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; border: 0; border-radius: var(--radius); padding: 0 6px;
  background: transparent; color: var(--c-ink-2); cursor: pointer;
  font: inherit; font-size: var(--text-xs); letter-spacing: var(--track-label);
  transition: background-color var(--ease), color var(--ease);
}
.lang-seg button:hover { color: var(--c-ink); }
.lang-seg button[aria-current="true"] { background: var(--c-surface); color: var(--c-ink); box-shadow: inset 0 0 0 1px var(--c-line); }
.lang-seg button:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; }
.lang-seg-labels { display: flex; width: 100%; }
.lang-seg-labels button { flex: 1; height: 40px; font-size: var(--text-sm); letter-spacing: normal; }
.drawer-label-gap { margin-top: var(--s-4) !important; }

/* Teléfono: nombre y tema arriba, navegación debajo. Escritorio: todo en una fila. */
.site-header .lang-seg { order: 2; margin-left: auto; }
.theme-switch { order: 2; margin-left: auto; }
.site-header .site-nav { order: 3; width: 100%; justify-content: flex-end; margin-right: calc(var(--s-2) * -1); }

@media (min-width: 48rem) {
  .site-header { flex-wrap: nowrap; padding: var(--s-3) var(--s-6); }
  .site-header .site-nav { order: 2; width: auto; margin-left: auto; }
  .site-nav a, .site-nav .link-button { padding: 0 var(--s-3); }
  .theme-switch { order: 3; margin-left: 0; }
  .site-header .lang-seg { order: 3; margin-left: 0; }
  main { padding: var(--s-7) var(--s-6) var(--s-8); }
  .site-footer { padding: var(--s-5) var(--s-6); }
  h1 { font-size: var(--text-3xl); line-height: 1.05; letter-spacing: -0.02em; }
  h2 { font-size: var(--text-2xl); line-height: 1.14; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Teléfono con JavaScript: la barra muestra solo el nombre y el botón de menú;
   la navegación y el tema van en el menú lateral. Sin JavaScript se ve la barra completa. */
.menu-button {
  display: none; align-items: center; gap: 6px; margin-left: auto;
  min-height: 40px; padding: 0 var(--s-3); font: inherit; font-size: var(--text-sm);
  color: var(--c-ink); background: var(--c-surface); border: var(--border); border-radius: var(--radius-field); cursor: pointer;
}
.menu-button .nav-icon { color: var(--c-ink); }
@media (max-width: 47.99rem) {
  .js .site-header .site-nav, .js .site-header .theme-switch { display: none; }
  .js .menu-button:not([hidden]) { display: inline-flex; order: 3; margin-left: 0; }
  /* El idioma queda a la vista, junto al botón de menú */
  .js .site-header .lang-seg button { min-width: 38px; height: 36px; }
  .js .site-header { gap: var(--s-2); }
}
/* Teléfono angosto: el botón de menú queda solo con su ícono (el nombre sigue para lectores de pantalla) */
@media (max-width: 23rem) {
  .js .menu-button { padding: 0 10px; }
  .js .menu-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.drawer {
  margin: 0 0 0 auto; width: min(20rem, 86vw); height: 100%; max-height: 100%; max-width: none;
  padding: var(--s-4); border: 0; border-radius: var(--radius-card) 0 0 var(--radius-card);
  background: var(--c-surface); color: var(--c-ink);
}
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in 0.25s ease-out; }
.drawer::backdrop { background: var(--c-backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--s-3); margin-bottom: var(--s-3); border-bottom: var(--border); }
.drawer-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius); background: var(--c-wash); color: var(--c-ink); cursor: pointer; }
.drawer-close .nav-icon { color: var(--c-ink); }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a, .drawer-nav .link-button {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 44px; padding: 0 var(--s-3);
  border-radius: var(--radius-field); color: var(--c-ink); text-decoration: none; font-size: var(--text-base); text-align: left;
}
.drawer-nav form { display: block; }
.drawer-nav a:hover, .drawer-nav .link-button:hover { background: var(--c-wash); color: var(--c-ink); }
.drawer-nav a[aria-current="page"] { background: var(--c-wash); box-shadow: inset 0 0 0 1px var(--c-line); }
.drawer-nav a[aria-current="page"] .nav-icon { color: var(--c-ink); }
.drawer-nav .nav-icon { width: 18px; height: 18px; }
.drawer-nav .nav-strong { background: var(--c-accent); color: var(--c-accent-ink); }
.drawer-section { margin-top: auto; padding-top: var(--s-4); border-top: var(--border); }
.drawer-section .label-caps { margin: 0 0 var(--s-2); }
.theme-switch-labels { display: flex; width: 100%; }
.theme-switch-labels button { flex: 1; width: auto; height: 40px; gap: 6px; padding: 0 var(--s-2); font: inherit; font-size: var(--text-sm); }
.theme-label { white-space: nowrap; }

/* Sugerencias en el pie: ícono + texto */
.footer-feedback { display: inline-flex; align-items: center; gap: 6px; }
.footer-feedback .nav-icon { width: 15px; height: 15px; }
.footer-feedback[aria-current="page"] { color: var(--c-ink); }
