/* =====================================================================
   CV · Marco Sebastián Ortega Molina — base.css
   Sistema compartido (home + páginas de proyecto).
   Dirección 1 "escritorio oscuro" en versión sobria: ventanas con barra
   de título, biseles de 1px, sombras duras, un solo acento rojo.

   Índice
     1. Tokens            6. Botones            11. Íconos (pixel / logos)
     2. Reset y base      7. Chips, LED, tags   12. Encabezado de sección
     3. Tipografía        8. Ventana (.win)     13. Barra de tareas
     4. Layout            9. Header y nav       14. Revelado y movimiento
     5. Foco y skip link 10. Idioma (ES/EN/FR)  15. Impresión
   ===================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Paleta de Marco (fija, no tocar) */
  --bg: #0a0a0a;
  --bg-2: #121211;
  --fg: #f3f1ea;
  --muted: #8d8d85;
  --line: rgba(var(--ink-rgb), .14);
  --line-strong: rgba(var(--ink-rgb), .32);
  --red: #ff2020;
  --red-hover: #ff4444;
  --red-glow: rgba(255, 32, 32, .35);

  /* Tokens derivados (02 §1.3 y 06 §5) */
  --bg-3: #1a1a18;          /* barras de título, caras de control */
  --bg-4: #242421;          /* botones/controles en relieve */
  --fg-2: #cfcdc4;          /* cuerpo secundario (12.4:1 sobre --bg) */
  --on-red: #0a0a0a;        /* texto sobre rojo: 5.17:1 (AA) */
  --bevel-hi: rgba(var(--ink-rgb), .12);
  --bevel-lo: rgba(0, 0, 0, .7);
  --bevel: inset 1px 1px 0 var(--bevel-hi), inset -1px -1px 0 var(--bevel-lo);
  --bevel-pressed: inset 1px 1px 0 var(--bevel-lo), inset -1px -1px 0 rgba(var(--ink-rgb), .16);
  --shadow-hard: 4px 5px 0 var(--shade);
  --shadow-hard-red: 4px 5px 0 rgba(255, 32, 32, .28);
  --ring-red: 0 0 0 1px var(--red), 0 0 16px var(--red-glow);

  /* Valores que cambian entre tema oscuro y claro (el claro está en la sección 16) */
  --ink-rgb: 243, 241, 234;   /* tinta: líneas, rejillas y brillos tenues */
  --bg-rgb: 10, 10, 10;
  --bg2-rgb: 18, 18, 17;
  --paper: #0d0d0c;           /* fondo de visores y capturas */
  --shade: #000;              /* sombra dura de las ventanas */
  --red-ink: #ff2020;         /* rojo para TEXTO (en claro, uno más oscuro que pasa AA) */
  /* avatar en oscuro: cabeza rellena de rojo con las líneas negras (en claro, ver sección 16: solo línea roja) */
  --avatar-relleno: #ff2020; --avatar-trazo: #0b0b0b; --avatar-linea: #ff2020;

  /* Tipografía */
  /* fuentes autoalojadas (css/fonts.css) + respaldos con métricas ajustadas */
  --font-display: 'Space Grotesk', 'Space Grotesk Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'Space Mono Fallback', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-body: 'Inter', 'Inter Fallback', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Espaciado (densidad 4) */
  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px;
  --space-5: 32px; --space-6: 48px; --space-7: 64px;

  /* Layout */
  --maxw: 1240px;
  --gutter: 28px;
  --radius: 2px;
  --header-h: 92px;        /* lo actualiza app.js con ResizeObserver */
  --section-y: 96px;

  /* Movimiento */
  --intro-ease: cubic-bezier(.16, 1, .3, 1);
  --ease-step: steps(2, end);
  --dur-fast: .16s;
  --dur: .24s;

  color-scheme: dark;
}
@media (max-width: 560px) {
  :root { --gutter: 20px; --section-y: 64px; }
}
@media (max-width: 380px) {
  :root { --gutter: 16px; }
}

/* ---------- 2. RESET Y BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 12px);
  background: var(--bg);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  min-height: 100vh;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  /* textura de "escritorio": malla de puntos casi invisible */
  background-image: radial-gradient(circle at 1px 1px, rgba(var(--ink-rgb), .035) 1px, transparent 1.5px);
  background-size: 6px 6px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
main { flex: 1; display: block; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
ul[role="list"], ol[role="list"], .list-reset { list-style: none; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
::selection { background: var(--red); color: var(--on-red); }

/* Scrollbar: pista --bg, pulgar --bg-4 con bisel, rojo en hover */
html { scrollbar-color: var(--bg-4) var(--bg); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--bg-4);
  border: 2px solid var(--bg);
  box-shadow: var(--bevel);
}
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* i18n: evita el destello del inglés si el idioma inicial es otro.
   Falla segura: si el JS no aplica el idioma en 1.2s, se muestra igual. */
html.i18n-pending body { visibility: hidden; animation: i18n-failsafe 0s linear 1.2s forwards; }
@keyframes i18n-failsafe { to { visibility: visible; } }

/* ---------- 3. TIPOGRAFÍA ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.02em;
  text-wrap: balance;
}
p { text-wrap: pretty; }
.mono { font-family: var(--font-mono); }
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.hit { color: var(--red-ink); }      /* remate en rojo (firma del CV) */
.dim { color: var(--muted); }    /* palabra atenuada */
.u-mark {                          /* énfasis sin cursiva sintética */
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: .14em;
}
.lead { font-size: clamp(17px, 1.5vw, 19px); color: var(--fg-2); line-height: 1.65; max-width: 68ch; }
.small { font-size: 13px; color: var(--muted); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 4. LAYOUT ---------- */
.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section {
  position: relative;
  padding-block: var(--section-y);
  border-top: 1px solid var(--line);
}
.stack-y > * + * { margin-top: var(--space-4); }

/* ---------- 5. FOCO Y SKIP LINK ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px dashed var(--red);
  outline-offset: 3px;
}
/* sobre superficies rojas el anillo va en hueso */
.btn--primary:focus-visible,
.is-red:focus-visible,
.filter[aria-pressed="true"]:focus-visible,
:root[lang="es"] .lang__btn[data-lang-set="es"]:focus-visible,
:root[lang="en"] .lang__btn[data-lang-set="en"]:focus-visible,
:root[lang="fr"] .lang__btn[data-lang-set="fr"]:focus-visible { outline-color: var(--fg); }
@supports not selector(:focus-visible) {
  :focus { outline: 2px dashed var(--red); outline-offset: 3px; }
}
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--red);
  color: var(--on-red);
  font: 700 13px/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) ease;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; outline-color: var(--fg); }

/* ---------- 6. BOTONES ---------- */
.btn {
  --btn-bg: var(--bg-4);
  --btn-fg: var(--fg);
  --btn-bd: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius);
  box-shadow: var(--bevel), 3px 4px 0 var(--shade);
  font: 700 13px/1.1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
              color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.btn .pi { width: 18px; height: 18px; }
.btn--primary {
  --btn-bg: var(--red);
  --btn-fg: var(--on-red);
  --btn-bd: var(--red);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .32), inset -1px -1px 0 rgba(0, 0, 0, .35), 3px 4px 0 var(--shade);
}
.btn--ghost { --btn-bg: var(--bg-3); }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 12px; gap: 8px; }
.btn--block { width: 100%; }
@media (hover: hover) {
  .btn:hover { --btn-bd: var(--red); box-shadow: var(--bevel), var(--shadow-hard-red); transform: translateY(-1px); }
  .btn--ghost:hover .pi, .btn--ghost:hover .btn__arrow { color: var(--red-ink); }
  .btn--primary:hover { --btn-bg: var(--red-hover); --btn-bd: var(--red-hover); box-shadow: inset 1px 1px 0 rgba(255,255,255,.32), inset -1px -1px 0 rgba(0,0,0,.35), 0 4px 20px var(--red-glow), 3px 4px 0 var(--shade); }
}
.btn:active { transform: translate(2px, 3px); box-shadow: var(--bevel-pressed); }
.btn__arrow { display: inline-block; transition: transform var(--dur-fast) var(--ease-step); }
@media (hover: hover) { .btn:hover .btn__arrow { transform: translateX(3px); } }

/* Enlace de texto con flecha (externo) */
.link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
}
.link .pi { width: 16px; height: 16px; color: var(--muted); }
.link:hover { color: var(--fg); }
.link:hover .pi { color: var(--red-ink); }
.link__text { border-bottom: 1px dotted var(--line-strong); padding-bottom: 1px; }
.link:hover .link__text { border-bottom-color: var(--red); }

/* ---------- 7. CHIPS, LED, TAGS ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 9px 4px 7px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--bevel);
  font: 400 12px/1.2 var(--font-mono);
  color: var(--fg-2);
  white-space: nowrap;
  transition: border-color var(--dur) ease, color var(--dur) ease, box-shadow var(--dur) ease;
}
.chip > img { width: 16px; height: 16px; flex: none; }
.chip > .pi { width: 16px; height: 16px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; }

.led {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px rgba(255, 32, 32, .18), 0 0 8px var(--red-glow);
  vertical-align: middle;
}
.led--blink { animation: led-blink 2.4s var(--ease-step) infinite; }
.led--off { background: var(--bg-4); box-shadow: inset 0 0 0 1px var(--line-strong); }
@keyframes led-blink { 50% { opacity: .35; } }

/* Etiqueta tipo "categoría" (LED + texto) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-2);
}

/* ---------- 8. VENTANA (.win) ----------
   <article class="win">
     <div class="win__bar">
       <span class="win__icon" aria-hidden="true"></span>
       <span class="win__title">NOMBRE.EXE</span>
       <span class="win__ctrls" aria-hidden="true"><i></i><i></i><i></i></span>
     </div>
     <div class="win__body">…</div>
     <div class="win__status">…</div>
   </article>
   - Franja superior de 2px: gris en reposo, roja cuando la ventana está
     "activa" (.win--active, hover o foco dentro).
   - Los controles _ □ × son decorativos y visiblemente pasivos. */
.win {
  --win-strip: var(--line-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--bevel), var(--shadow-hard);
}
.win--active, .win:focus-within { --win-strip: var(--red); }
@media (hover: hover) { .win:hover { --win-strip: var(--red); } }
.win__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 2px 8px 0 12px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: inset 0 2px 0 var(--win-strip), inset 0 3px 0 rgba(0, 0, 0, .4);
  transition: box-shadow var(--dur) ease;
}
.win__icon {
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--red);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, .35), inset 2px 2px 0 rgba(255, 255, 255, .25);
}
.win__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 12px/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg);
}
.win__title small { font-weight: 400; color: var(--muted); letter-spacing: .04em; text-transform: none; font-size: 12px; }
.win__ctrls { display: inline-flex; gap: 4px; flex: none; opacity: .55; cursor: default; }
.win__ctrls > i {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  background: var(--bg-4);
  box-shadow: var(--bevel);
  border-radius: 1px;
}
.win__ctrls > i::before, .win__ctrls > i::after { content: ""; position: absolute; background: var(--muted); }
.win__ctrls > i:nth-child(1)::before { left: 5px; right: 5px; bottom: 5px; height: 2px; }
.win__ctrls > i:nth-child(2)::before { inset: 4px; background: none; border: 1px solid var(--muted); border-top-width: 2px; }
.win__ctrls > i:nth-child(3)::before,
.win__ctrls > i:nth-child(3)::after { left: 50%; top: 50%; width: 10px; height: 2px; transform: translate(-50%, -50%) rotate(45deg); }
.win__ctrls > i:nth-child(3)::after { transform: translate(-50%, -50%) rotate(-45deg); }
.win__ctrls--mini > i { width: 14px; height: 14px; }
.win__ctrls--mini > i:nth-child(1)::before { left: 4px; right: 4px; bottom: 4px; }
.win__ctrls--mini > i:nth-child(2)::before { inset: 3px; }
.win__ctrls--mini > i:nth-child(3)::before, .win__ctrls--mini > i:nth-child(3)::after { width: 8px; }
.win__body { padding: var(--space-4); flex: 1; min-width: 0; }
.win__status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  background: var(--bg-3);
  box-shadow: inset 0 1px 0 var(--bevel-hi);
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.win__status-right { margin-left: auto; color: var(--muted); font-weight: 400; letter-spacing: .06em; }
/* Barra de menú decorativa (Archivo · Edición · Ver · Ayuda) */
.win__menu {
  display: flex;
  gap: 18px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  font: 400 12px/1.4 var(--font-mono);
  color: var(--muted);
  user-select: none;
}
.win__menu > span::first-letter { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 9. HEADER Y NAVEGACIÓN ----------
   Una sola rejilla: fila 1 = barra de título (marca, ← kairomx.tech,
   idioma, controles); fila 2 = barra de menú (navegación).
   En ≤860px queda una fila de 56px y la nav se abre como menú. */
.site-header {
  --tb-h: 40px;
  --mb-h: 48px;
  position: sticky;
  top: 0;
  z-index: 100;
  background:
    linear-gradient(var(--bg-3) 0 var(--tb-h), var(--line) var(--tb-h) calc(var(--tb-h) + 1px), rgba(var(--bg2-rgb), .96) calc(var(--tb-h) + 1px));
  border-bottom: 1px solid var(--line-strong);
  box-shadow: inset 0 2px 0 var(--red), 0 6px 0 rgba(0, 0, 0, .35);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
}
.site-header__in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  grid-template-rows: var(--tb-h) var(--mb-h);
  grid-template-areas:
    "brand back lang theme ctrls"
    "nav   nav  nav  nav   nav";
  align-items: center;
  column-gap: 16px;
}
.brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-height: 44px;
  padding-top: 2px;
  font: 700 16px/1 var(--font-display);
  letter-spacing: .02em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.brand__icon {
  width: 14px; height: 14px; flex: none;
  background: var(--red);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .35), inset 3px 3px 0 rgba(255, 255, 255, .25);
}
.brand__sep { color: var(--muted); margin-inline: .35em; font-weight: 500; }
.brand__ext { color: var(--red-ink); }
.titlebar__back {
  grid-area: back;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 2px 4px 0;
  font: 400 12px/1 var(--font-mono);
  letter-spacing: .04em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.titlebar__back:hover { color: var(--fg); }
@media (pointer: coarse) { .titlebar__back { min-height: 44px; } }
.site-header .win__ctrls { grid-area: ctrls; padding-top: 2px; }

.site-nav { grid-area: nav; align-self: stretch; }
.nav { display: flex; align-items: stretch; height: 100%; list-style: none; gap: 2px; margin-left: -12px; }
.nav__item--mobile { display: none; }
.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 100%;
  min-height: 44px;
  padding: 0 12px;
  font: 500 15px/1 var(--font-display);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.nav__link .pi { width: 18px; height: 18px; transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-step); }
.nav__link:hover { color: var(--fg); }
.nav__link:hover .pi { color: var(--red-ink); }
@media (hover: hover) { .nav__link:hover .pi { transform: translateY(-2px); } }
.nav__link.is-active, .nav__link[aria-current="true"] {
  color: var(--fg);
  background: var(--bg-3);
  box-shadow: var(--bevel-pressed), inset 0 -2px 0 var(--red);
}
.nav__link.is-active .pi, .nav__link[aria-current="true"] .pi { color: var(--red-ink); }

.menu-btn {
  grid-area: menu;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  background: var(--bg-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--bevel);
  font: 700 12px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.menu-btn__bars { position: relative; width: 16px; height: 12px; flex: none; }
.menu-btn__bars::before, .menu-btn__bars::after, .menu-btn__bars > i {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor;
  transition: transform var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.menu-btn__bars::before { top: 0; }
.menu-btn__bars > i { top: 5px; }
.menu-btn__bars::after { bottom: 0; }
.menu-btn[aria-expanded="true"] { background: var(--bg-3); box-shadow: var(--bevel-pressed); border-color: var(--red); }
.menu-btn[aria-expanded="true"] .menu-btn__bars::before { transform: translateY(5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__bars::after { transform: translateY(-5px) rotate(-45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__bars > i { opacity: 0; }

/* Íconos de nav ocultos en anchos medios para que quepa todo */
@media (max-width: 1120px) and (min-width: 861px) {
  .nav__link .pi { display: none; }
  .nav__link { padding: 0 11px; }
}

@media (max-width: 860px) {
  .site-header { --tb-h: 58px; background: var(--bg-3); }
  .site-header__in {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    grid-template-rows: var(--tb-h);
    grid-template-areas: "brand lang theme menu";
    column-gap: 8px;
  }
  .titlebar__back, .site-header .win__ctrls { display: none; }
  .menu-btn { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: var(--gutter);
    right: var(--gutter);
    display: none;
    background: var(--bg-2);
    border: 1px solid var(--line-strong);
    border-top: 0;
    box-shadow: var(--bevel), var(--shadow-hard);
    max-height: calc(100svh - var(--tb-h) - 24px);
    overflow-y: auto;
  }
  .site-nav.is-open { display: block; }
  .nav { flex-direction: column; height: auto; gap: 0; margin: 0; padding: 6px; }
  .nav__item--mobile { display: block; border-top: 1px dotted var(--line-strong); margin-top: 6px; padding-top: 6px; }
  .nav__link { height: auto; min-height: 48px; padding: 0 14px; font-size: 17px; }
  .nav__link .pi { width: 20px; height: 20px; }
  .nav__link.is-active, .nav__link[aria-current="true"] { box-shadow: var(--bevel-pressed), inset 3px 0 0 var(--red); }
}
@media (max-width: 420px) {
  .brand__sep, .brand__long { display: none; }
  /* la etiqueta "Menú" se oculta visualmente pero sigue nombrando al botón */
  .menu-btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .brand { font-size: 17px; }
}

/* ---------- 10. SELECTOR DE IDIOMA ---------- */
.lang {
  grid-area: lang;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--bevel-pressed);
  padding: 1px;
}
.lang__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 30px;
  padding: 0 8px;
  font: 700 12px/1 var(--font-mono);
  letter-spacing: .08em;
  color: var(--muted);
  border-radius: 1px;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.lang__btn:hover { color: var(--fg); background: var(--bg-3); }
/* El botón "pulsado" sale de <html lang>, que i18n.js fija antes del
   primer fotograma; aria-pressed (JS) lo comunica a los lectores. */
:root[lang="es"] .lang__btn[data-lang-set="es"],
:root[lang="en"] .lang__btn[data-lang-set="en"],
:root[lang="fr"] .lang__btn[data-lang-set="fr"] {
  background: var(--red);
  color: var(--on-red);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .3), inset -1px -1px 0 rgba(0, 0, 0, .3);
}
/* objetivos táctiles de 44px en pantallas táctiles o estrechas */
@media (pointer: coarse), (max-width: 860px) {
  .lang__btn { min-width: 44px; min-height: 44px; }
}

/* ---------- 11. ÍCONOS ----------
   Pixel (pixelarticons, MIT): se pintan con currentColor por máscara.
   <span class="pi pi--home" aria-hidden="true"></span>
   Logos (stack/): <img> en gris; recuperan su color al hover/foco del
   contenedor (.tile, .chip dentro de un .pcard, etc.). */
.pi {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--pi) center / 100% 100% no-repeat;
  mask: var(--pi) center / 100% 100% no-repeat;
  vertical-align: middle;
}
.pi--home       { --pi: url("../icons/pixel/inicio.svg"); }
.pi--folder     { --pi: url("../icons/pixel/proyectos.svg"); }
.pi--save       { --pi: url("../icons/pixel/tecnologias.svg"); }
.pi--user       { --pi: url("../icons/pixel/sobre-mi.svg"); }
.pi--mail       { --pi: url("../icons/pixel/contacto.svg"); }
.pi--robot      { --pi: url("../icons/pixel/ai-chatbot.svg"); }
.pi--github     { --pi: url("../icons/pixel/github-bit.svg"); }
.pi--linkedin   { --pi: url("../icons/pixel/linkedin-bit.svg"); }
.pi--mail-bit   { --pi: url("../icons/pixel/mail-bit.svg"); }
.pi--terminal   { --pi: url("../icons/pixel/terminal.svg"); }
.pi--sun        { --pi: url("../icons/pixel/sun.svg"); }
.pi--moon       { --pi: url("../icons/pixel/moon.svg"); }
.pi--prompt     { --pi: url("../icons/pixel/prompt-engineering.svg"); }
.pi--realtime   { --pi: url("../icons/pixel/real-time.svg"); }
.pi--vlans      { --pi: url("../icons/pixel/vlans.svg"); }
.pi--rssi       { --pi: url("../icons/pixel/rssi.svg"); }
.pi--rlhf       { --pi: url("../icons/pixel/rlhf.svg"); }
.pi--download   { --pi: url("../icons/pixel/descargar.svg"); }
.pi--external   { --pi: url("../icons/pixel/enlace.svg"); }
.pi--arrow      { --pi: url("../icons/pixel/arrow-right.svg"); }
.pi--play       { --pi: url("../icons/pixel/play.svg"); }
.pi--server     { --pi: url("../icons/pixel/server.svg"); }
.pi--cpu        { --pi: url("../icons/pixel/cpu.svg"); }
.pi--globe      { --pi: url("../icons/pixel/globe.svg"); }
.pi--phone      { --pi: url("../icons/pixel/smartphone.svg"); }
.pi--monitor    { --pi: url("../icons/pixel/monitor.svg"); }
.pi--code       { --pi: url("../icons/pixel/code.svg"); }
.pi--copy       { --pi: url("../icons/pixel/copy.svg"); }
.pi--check      { --pi: url("../icons/pixel/check.svg"); }
.pi--pin        { --pi: url("../icons/pixel/map-pin.svg"); }
.pi--file       { --pi: url("../icons/pixel/file-text.svg"); }
.pi--signal     { --pi: url("../icons/pixel/signal.svg"); }
.pi--close      { --pi: url("../icons/pixel/close.svg"); }
.pi--zoom       { --pi: url("../icons/pixel/zoom-in.svg"); }
.pi--image      { --pi: url("../icons/pixel/image.svg"); }
.pi--menu       { --pi: url("../icons/pixel/menu.svg"); }
.pi--chart      { --pi: url("../icons/pixel/chart-bar-big.svg"); }

/* Logo de marca: gris/atenuado en reposo, color al activar el contenedor.
   El filtro va en el <img>, así los SVG multicolor conservan su color. */
.logo {
  flex: none;
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: grayscale(1) brightness(1.15) contrast(.85);
  opacity: .6;
  transition: filter var(--dur) ease, opacity var(--dur) ease;
}
.logo--wide { width: 34px; }   /* n8n, Motion: logos anchos */
.logo--dark { filter: grayscale(1) brightness(1.9) contrast(.85); }  /* logos oscuros (MySQL): visibles en reposo */

/* Ficha de ícono (tile): ícono + nombre.
   Hover / foco dentro / grupo enfocado = color de marca + anillo rojo. */
.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 9px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--bevel);
  font: 400 13px/1.25 var(--font-mono);
  color: var(--fg-2);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, color var(--dur) ease, transform var(--dur-fast) var(--ease-step);
}
.tile > .pi { width: 22px; height: 22px; color: var(--muted); transition: color var(--dur) ease; }
/* Sin cortes a mitad de palabra: se parte por espacios y, si hace
   falta, con guion según <html lang> (hyphens: auto). */
.tile__label { min-width: 0; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
@media (max-width: 420px) { .tile { font-size: 12px; } }
/* Hover = color de marca + anillo rojo en esa ficha.
   Foco en el grupo (o grupo en pantalla en táctil) = logos a color,
   bordes neutros: más sobrio que encender todas las fichas. */
.tile:hover {
  border-color: var(--red);
  box-shadow: var(--bevel), var(--ring-red);
  color: var(--fg);
}
.tiles:focus-visible .tile, .is-lit .tile { color: var(--fg); border-color: var(--line-strong); }
.tile:hover .logo,
.tiles:focus-visible .logo,
.is-lit .tile .logo,
.chip--lit .logo { filter: none; opacity: 1; }
/* Tema claro: los logos color hueso o blancos (Next.js, Vercel, Expo, three.js,
   MCP, GitHub, Copilot, OpenRouter) desaparecen sobre el fondo crema;
   se invierten a casi negro, en reposo y activos. GSAP (verde claro) se oscurece en reposo (D-1219). */
@media screen {
  :root[data-theme="light"] .logo:is([src$="/nextjs.svg"], [src$="/vercel.svg"], [src$="/expo.svg"], [src$="/threejs.svg"], [src$="/mcp.svg"], [src$="/github.svg"], [src$="/github-copilot.svg"], [src$="/openrouter.svg"]) { filter: invert(1) grayscale(1) contrast(.85); }
  :root[data-theme="light"] :is(.tile:hover, .tiles:focus-visible, .is-lit .tile, .chip--lit, .pcard:hover, .pcard:focus-within, .arch-win:hover, .arch-win:focus-within) .logo:is([src$="/nextjs.svg"], [src$="/vercel.svg"], [src$="/expo.svg"], [src$="/threejs.svg"], [src$="/mcp.svg"], [src$="/github.svg"], [src$="/github-copilot.svg"], [src$="/openrouter.svg"]) { filter: invert(1); }
  :root[data-theme="light"] .logo[src$="/gsap.svg"] { filter: grayscale(1) brightness(.6) contrast(1.2); }
  :root[data-theme="light"] :is(.tile:hover, .tiles:focus-visible, .is-lit .tile, .chip--lit, .pcard:hover, .pcard:focus-within, .arch-win:hover, .arch-win:focus-within) .logo[src$="/gsap.svg"] { filter: brightness(.8); }
}
.tile:hover > .pi,
.tiles:focus-visible .tile > .pi,
.is-lit .tile > .pi { color: var(--red-ink); }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr));
  gap: 8px;
  list-style: none;
  border-radius: var(--radius);
}
.tiles:focus-visible { outline-offset: 3px; }

/* ---------- 12. ENCABEZADO DE SECCIÓN ----------
   <header class="sec-head">
     <span class="sec-head__icon"><span class="pi pi--folder" aria-hidden="true"></span></span>
     <p class="sec-head__kicker"><span class="sec-head__num">01</span> / PROYECTOS.DIR</p>
     <h2 class="sec-head__title">Lo que he <span class="hit">construido.</span></h2>
   </header> */
.sec-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "icon kicker" "icon title";
  column-gap: 18px;
  row-gap: 6px;
  align-items: center;
  padding-bottom: 22px;
  margin-bottom: var(--space-6);
  border-bottom: 2px dotted var(--line-strong);
}
.sec-head__icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--bevel), 3px 4px 0 var(--shade);
  color: var(--fg);
}
.sec-head__icon .pi { width: 28px; height: 28px; }
.sec-head__kicker {
  grid-area: kicker;
  align-self: end;
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.sec-head__num { color: var(--red-ink); }
.sec-head__title {
  grid-area: title;
  align-self: start;
  font-size: clamp(30px, 4.2vw, 54px);
  line-height: 1.02;
  letter-spacing: -.025em;
}
.sec-head__intro { margin-top: -24px; margin-bottom: var(--space-6); }
@media (max-width: 560px) {
  .sec-head { column-gap: 14px; margin-bottom: var(--space-5); }
  .sec-head__icon { width: 44px; height: 44px; }
  .sec-head__icon .pi { width: 24px; height: 24px; }
  .sec-head__intro { margin-top: -12px; margin-bottom: var(--space-5); }
}

/* ---------- 13. BARRA DE TAREAS (footer) ---------- */
.taskbar {
  position: relative;
  margin-top: auto;
  background: var(--bg-2);
  border-top: 1px solid var(--line-strong);
  box-shadow: inset 0 1px 0 var(--bevel-hi);
}
.taskbar__in {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding-block: 8px;
}
.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px 0 10px;
  background: var(--bg-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--bevel), 2px 3px 0 var(--shade);
  font: 700 15px/1 var(--font-display);
  letter-spacing: .04em;
  color: var(--fg);
  text-decoration: none;
  flex: none;
}
.start-btn__icon {
  width: 16px; height: 16px;
  background: var(--red);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, .35), inset 3px 3px 0 rgba(255, 255, 255, .25);
}
.start-btn:hover { border-color: var(--red); }
.start-btn:active { box-shadow: var(--bevel-pressed); transform: translate(1px, 2px); }
.taskbar__sep { width: 2px; align-self: stretch; margin-block: 6px; background: var(--line); box-shadow: 1px 0 0 #000; flex: none; }
/* La lista de accesos puede encogerse (los títulos se truncan con …,
   como los botones de una barra de tareas real); nunca empuja la bandeja
   fuera de la columna. El padding deja ver el anillo de foco. */
.taskbar__nav { flex: 1 1 auto; min-width: 0; display: flex; }
.taskbar__apps { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; overflow: hidden; list-style: none; padding: 5px; margin: -5px; }
.taskbar__apps > li { display: flex; flex: 0 1 auto; min-width: 0; }
.taskbar__app {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 0 12px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--bevel);
  font: 400 12px/1 var(--font-mono);
  letter-spacing: .06em;
  color: var(--fg-2);
  text-decoration: none;
  white-space: nowrap;
}
.taskbar__app .pi { width: 16px; height: 16px; color: var(--muted); }
.taskbar__app > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.taskbar__app:hover { color: var(--fg); border-color: var(--line-strong); }
.taskbar__app:hover .pi { color: var(--red-ink); }
.taskbar__app.is-active { background: var(--bg); box-shadow: var(--bevel-pressed); color: var(--fg); }
.taskbar__app.is-active .pi { color: var(--red-ink); }
.tray {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  min-height: 44px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--bevel-pressed);
  font: 400 12px/1.2 var(--font-mono);
  color: var(--fg-2);
  white-space: nowrap;
  flex: none;
}
.tray .pi { width: 16px; height: 16px; color: var(--muted); }
.tray__place { display: inline-flex; align-items: center; gap: 6px; }
.tray__clock { display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 700; }
.tray__tz { color: var(--red-ink); font-weight: 700; letter-spacing: .08em; }
.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-block: 14px 18px;
  border-top: 1px solid var(--line);
  font: 400 12px/1.5 var(--font-mono);
  color: var(--muted);
}
.colophon a { display: inline-block; padding-block: 13px; margin-block: -13px; color: var(--fg-2); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.colophon a:hover { color: var(--fg); text-decoration-color: var(--red); }

/* Botón "Pausar animaciones" (WCAG 2.2.2): constante en la barra de
   tareas de todas las páginas y, en la home, también en el hero.
   Es un botón de alternancia: etiqueta fija + aria-pressed. */
.motion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  background: var(--bg-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--bevel), 2px 3px 0 var(--shade);
  font: 700 12px/1.1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg-2);
  touch-action: manipulation;
}
.motion-btn:hover { color: var(--fg); border-color: var(--red); }
.motion-btn[aria-pressed="true"] { background: var(--bg); box-shadow: var(--bevel-pressed); color: var(--fg); border-color: var(--red); }
.motion-btn--icon { padding: 0; width: 44px; }
.motion-ico { position: relative; display: inline-block; width: 12px; height: 12px; flex: none; }
.motion-ico::before, .motion-ico::after { content: ""; position: absolute; top: 0; bottom: 0; width: 4px; background: currentColor; }
.motion-ico::before { left: 1px; }
.motion-ico::after { right: 1px; }
[aria-pressed="true"] > .motion-ico::before {
  left: 2px; bottom: auto; width: 0; height: 0; background: none;
  border-left: 10px solid var(--red); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
[aria-pressed="true"] > .motion-ico::after { display: none; }
/* con reduced motion del sistema no hay nada que pausar */
@media (prefers-reduced-motion: reduce) { .motion-btn { display: none !important; } }
/* animaciones en pausa: todo queda quieto y visible */
html.motion-paused .led--blink, html.motion-paused .tl__caret, html.motion-paused .caret,
html.motion-paused [data-loop], html.motion-paused .readme__caret,
html.motion-paused .cover::before { animation: none !important; }
html.motion-paused .cover::before { opacity: 0 !important; }
@media (max-width: 1400px) { .tray__place, .tray__place + .taskbar__sep { display: none; } }
@media (max-width: 1320px) {
  .taskbar__app .pi { display: none; }
  .taskbar__app { padding: 0 10px; }
}
@media (max-width: 1060px) { .taskbar__apps, .start-btn + .taskbar__sep { display: none; } }
@media (max-width: 560px) {
  .tray__place-text { display: none; }
  .start-btn__label-long { display: none; }
  /* títulos de ventana: solo ARCHIVO.EXT (el subtítulo truncado parecía un error) */
  .win__title small { display: none; }
  .win__status-right { display: none; }
}
.win__status > span { white-space: nowrap; }

/* ---------- Sin JavaScript ----------
   i18n.js añade html.js de inmediato. Sin JS: se ocultan los controles
   que no harían nada y la navegación se muestra como lista (también en
   móvil), así siempre hay forma de moverse por la página. */
html:not(.js) .menu-btn,
html:not(.js) .lang,
html:not(.js) .filters__group,
html:not(.js) [data-copy],
html:not(.js) [data-motion-toggle] { display: none !important; }
@media (max-width: 860px) {
  html:not(.js) .site-header { position: relative; }
  html:not(.js) .site-header__in { grid-template-rows: var(--tb-h) auto; grid-template-areas: "brand brand brand" "nav nav nav"; }
  html:not(.js) .site-nav { position: static; display: block; max-height: none; background: transparent; border: 0; box-shadow: none; }
  html:not(.js) .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; padding: 0 0 8px; }
  html:not(.js) .nav__link { min-height: 44px; padding: 0 10px; font-size: 15px; }
  html:not(.js) .nav__item--mobile { border: 0; margin: 0; padding: 0; }
}

/* ---------- Colores forzados (alto contraste de Windows) ----------
   Los íconos son máscaras sobre background-color: sin esto se pintarían
   del color del fondo y desaparecerían. Los estados "pulsado" o
   "seleccionado" que solo se distinguían por el rojo llevan un contorno. */
@media (forced-colors: active) {
  .pi, .led, .win__icon, .brand__icon, .start-btn__icon, .tl__caret, .caret, .readme__caret,
  .menu-btn__bars::before, .menu-btn__bars::after, .menu-btn__bars > i,
  .motion-ico::before, .motion-ico::after, .osi i {
    forced-color-adjust: none;
    background-color: CanvasText;
  }
  [aria-pressed="true"] > .motion-ico::before { background: none; border-left-color: CanvasText; }
  .led--off { background-color: Canvas; box-shadow: inset 0 0 0 1px CanvasText; }
  :root[lang="es"] .lang__btn[data-lang-set="es"],
  :root[lang="en"] .lang__btn[data-lang-set="en"],
  :root[lang="fr"] .lang__btn[data-lang-set="fr"],
  .filter[aria-pressed="true"], .motion-btn[aria-pressed="true"],
  .gal__tab[aria-selected="true"], .gal__thumb[aria-current="true"],
  .nav__link[aria-current="true"], .taskbar__app.is-active {
    outline: 2px solid Highlight;
    outline-offset: -4px;
  }
  .win__bar { border-bottom: 1px solid CanvasText; }
}

/* ---------- 14. REVELADO Y MOVIMIENTO ----------
   app.js añade html.reveal-ready solo cuando el observador funciona, así
   que sin JS (o si falla) no se oculta nada. */
html.reveal-ready [data-reveal]:not(.is-in) { opacity: 0; translate: 0 18px; }
html.reveal-ready [data-reveal] {
  transition: opacity .6s var(--intro-ease), translate .6s var(--intro-ease);
  transition-delay: var(--reveal-delay, 0s);
}
/* Pausar animaciones decorativas fuera de pantalla */
[data-anim]:not(.is-onscreen) .led--blink,
[data-anim]:not(.is-onscreen) [data-loop] { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    transition-delay: 0s !important;
  }
  html.reveal-ready [data-reveal]:not(.is-in) { opacity: 1; translate: none; }
  .btn:hover, .tile:hover, .btn:active { transform: none !important; }
  /* el failsafe del i18n necesita conservar su retraso */
  html.i18n-pending body { animation: i18n-failsafe 0s linear 1.2s forwards !important; }
}

/* ---------- 15. IMPRESIÓN ---------- */
@media print {
  :root { --bg: #fff; --bg-2: #fff; --bg-3: #f3f3f3; --bg-4: #eee; --fg: #111; --fg-2: #222; --muted: #555; --line: #ccc; --line-strong: #999; }
  html, body { background: #fff !important; color: #111 !important; }
  body { background-image: none !important; }
  .site-header { position: static; box-shadow: none; background: #fff !important; backdrop-filter: none; }
  .site-nav, .menu-btn, .lang, .win__ctrls, .skip-link, canvas, .taskbar__apps, .motion-btn { display: none !important; }
  html.reveal-ready [data-reveal] { opacity: 1 !important; translate: none !important; }
  .win, .tile, .chip, .btn { box-shadow: none !important; }
  .hit { color: #c00000 !important; }
  .link[href^="http"]::after { content: " (" attr(href) ")"; font-size: 12px; color: #555; text-transform: none; }
  .pi, .led { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tl.is-pending { visibility: visible !important; }
  .tl__caret, .caret { display: none !important; }
  .section { break-inside: auto; border-top-color: #ccc; }
  .win { break-inside: avoid; }
  * { animation: none !important; transition: none !important; }
}

/* ---------- 16. TEMA (botón sol/luna y tema claro) ----------
   El tema vive en <html data-theme="light|dark"> (lo fija un script mínimo en
   <head> antes de pintar y js/theme.js lo mantiene). El claro solo se aplica
   en pantalla: el papel ya tiene su propia paleta (sección 15). */
.theme-btn {
  grid-area: theme;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: var(--bevel-pressed);
  color: var(--muted);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.theme-btn:hover { color: var(--fg); background: var(--bg-3); }
.theme-btn .pi { width: 18px; height: 18px; }
:root[data-theme="light"] .theme-btn__sun,
:root:not([data-theme="light"]) .theme-btn__moon { display: none; }
:root[data-theme="light"] .theme-btn__to-light,
:root:not([data-theme="light"]) .theme-btn__to-dark { display: none; }
@media (pointer: coarse), (max-width: 860px) {
  .theme-btn { min-width: 44px; min-height: 44px; }
}
@media screen {
  :root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4efe6; --bg-2: #fffdf8; --bg-3: #e9e2d4; --bg-4: #ddd5c4;
    --fg: #141412; --fg-2: #34332e; --muted: #5d5a51;
    --ink-rgb: 20, 20, 18; --bg-rgb: 244, 239, 230; --bg2-rgb: 255, 253, 248;
    --paper: #fffdf8; --shade: #cfc7b5;
    --red-hover: #e61c1c; --red-ink: #c00000; --red-glow: rgba(255, 32, 32, .25);
    --bevel-hi: rgba(255, 255, 255, .9); --bevel-lo: rgba(20, 20, 18, .25);
    /* avatar en claro: dibujo a línea roja, sin relleno */
    --avatar-relleno: transparent; --avatar-trazo: #ff2020; --avatar-linea: #ff2020;
  }
}
