/* Las fuentes se sirven desde el propio dominio: ver fonts/. */

@font-face {
  font-family: "Carlito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/carlito-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Carlito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/carlito-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Mientras Carlito baja, el CV usa esta Arial ajustada a su ancho (medido
   con el texto del CV) y a su alto de renglon, asi el cambio de fuente no
   mueve el texto. En Windows no se usa: ahi esta Calibri. */
@font-face {
  font-family: "Carlito respaldo";
  font-weight: 400;
  src: local("Arial"), local("ArialMT");
  size-adjust: 90.8%;
  ascent-override: 104.8%;
  descent-override: 29.6%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Carlito respaldo";
  font-weight: 700;
  src: local("Arial Bold"), local("Arial-BoldMT");
  size-adjust: 86.7%;
  ascent-override: 109.8%;
  descent-override: 31%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/instrument-sans-latin.a03d4d5a.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00A3, U+00A5, U+00A7-00AB, U+00AE-00B0, U+00B4, U+00B6-00B8, U+00BA-00BB, U+00BF-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+2022, U+2026, U+2039-203A, U+20AC, U+2212;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.afc1a939.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+2022, U+2026, U+2039-203A, U+20AC, U+2212;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("/fonts/syne-latin.fc33b849.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+2013-2014, U+2018-2019, U+201C-201D, U+2022, U+2026, U+2039-203A, U+20AC, U+2212;
}

@font-face {
  font-family: "Syne";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("/fonts/syne-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  /* El violeta es solo el acento: fondos, bordes y grises son neutros. */
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1c1c21;
  --line: #2a2a31;
  /* El borde de un control es lo unico que dice que es un control, y la norma
     le pide 3:1 contra lo que tiene al lado. --line da 1,28:1 y queda para
     separadores y bordes de tarjeta, donde no hace falta. */
  --line-strong: #6c6c78;
  --text: #f2f2f5;
  --muted: #9d9ca8;
  --accent: #9a7cf0;
  --accent-2: #8b6be6;
  --accent-rgb: 154, 124, 240;
  /* Las etiquetas de proyecto son texto en --accent sobre este tinte, y el
     par tiene que llegar a 4,5:1. Cuanto mas sube la opacidad mas se aclara
     el fondo y menos contraste queda: al 7% da 5,21:1. */
  --accent-soft: rgba(154, 124, 240, 0.07);
  /* Lo que va escrito encima del acento. En el tema oscuro el acento es
     demasiado claro para el blanco: 3,22:1 contra el 4,5:1 que pide la
     norma. El fondo de la pagina encima del acento da 6,06:1. */
  --on-accent: #0c0c0e;
  --success: #49d486;
  --error: #f17474;

  --font-display: "Syne", sans-serif;
  --font-body: "Instrument Sans", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* La escala de tamanos: seis valores a mas de un pixel y medio uno del
     otro, la diferencia mas chica que se llega a ver. El 5 es el del cuerpo. */
  --texto-1: 0.7rem;
  --texto-2: 0.78rem;
  --texto-3: 0.88rem;
  --texto-4: 0.95rem;
  --texto-5: 1.0625rem;
  --texto-6: 1.2rem;

  /* Dos radios: el grande para paneles y tarjetas, el chico para controles. */
  --radius: 10px;
  --radius-sm: 8px;
  --container: 1080px;

  /* Vidrio, a lo Aero: un panel que deja ver lo que tiene atras desenfocado,
     con un brillo arriba y un filo claro en el borde de arriba. Casi siempre
     atras esta el fondo liso y apenas se nota; se ve cuando pasa algo
     detras, como la captura de un proyecto. */
  --glass: color-mix(in srgb, var(--surface) 60%, transparent);
  --glass-solid: color-mix(in srgb, var(--surface) 90%, transparent);
  --glass-clear: color-mix(in srgb, var(--surface) 20%, transparent);
  --glass-blur: blur(16px) saturate(150%);
  /* El escarchado de las tarjetas mientras se ve la captura de un proyecto. */
  --glass-frost: blur(32px) saturate(150%);
  --glass-shine: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 50%);
  --glass-edge: rgba(255, 255, 255, 0.1);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  :root {
    --glass: var(--surface);
    --glass-solid: var(--surface);
    --glass-clear: var(--surface);
  }
}

/* En una pantalla tactil detras de las tarjetas no pasa nada: las capturas
   de los proyectos aparecen solo con mouse. El desenfoque igual se calculaba
   en cada cuadro del scroll, y en un telefono eso se nota. */
@media (hover: none) {
  :root {
    --glass-blur: none;
    --glass-frost: none;
  }
}

/* Quien le pide al sistema menos transparencia tiene paneles opacos. */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --glass: var(--surface);
    --glass-solid: var(--surface);
    --glass-clear: var(--surface);
    --glass-blur: none;
    --glass-frost: none;
  }
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fafafb;
  --surface: #f2f2f5;
  --surface-2: #e8e8ed;
  --line: #d4d4dc;
  --line-strong: #83838f;
  --text: #161619;
  --muted: #53535e;
  --accent: #6a42dd;
  --accent-2: #5733c9;
  --accent-rgb: 106, 66, 221;
  --accent-soft: rgba(106, 66, 221, 0.1);
  --on-accent: #ffffff;
  --success: #157941;
  --error: #ce2222;
  --glass-shine: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 50%);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --shot-brillo: 1;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #fafafb;
    --surface: #f2f2f5;
    --surface-2: #e8e8ed;
    --line: #d4d4dc;
    --line-strong: #83838f;
    --text: #161619;
    --muted: #53535e;
    --accent: #6a42dd;
    --accent-2: #5733c9;
    --accent-rgb: 106, 66, 221;
    --accent-soft: rgba(106, 66, 221, 0.1);
    --on-accent: #ffffff;
    --success: #157941;
    --error: #ce2222;
    --glass-shine: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 50%);
    --glass-edge: rgba(255, 255, 255, 0.9);
    --shot-brillo: 1;
  }
}

/* Quien pide mas contraste en su sistema lo pide por algo. Los fondos no se
   tocan: suben el texto secundario, el acento y los bordes, hasta pasar 7:1
   contra cualquier superficie donde caen (el nivel AAA de la norma) y mas de
   5:1 los bordes, que solo necesitan 3. */
@media (prefers-contrast: more) {
  :root {
    --line: #3a3a44;
    --line-strong: #8a8a98;
    --muted: #b4b3c0;
    --accent: #b8a3f8;
    --accent-rgb: 184, 163, 248;
    --accent-soft: rgba(184, 163, 248, 0.07);
    /* Y paneles opacos: lo que se ve atras le resta contraste al texto. */
    --glass: var(--surface);
    --glass-solid: var(--surface);
    --glass-clear: var(--surface);
    --glass-blur: none;
    --glass-frost: none;
  }

  [data-theme="light"] {
    --line: #bcbcc8;
    --line-strong: #5d5d69;
    --muted: #43434d;
    --accent: #4a21b6;
    --accent-rgb: 74, 33, 182;
    --accent-soft: rgba(74, 33, 182, 0.08);
  }

  @media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
      --line: #bcbcc8;
      --line-strong: #5d5d69;
      --muted: #43434d;
      --accent: #4a21b6;
      --accent-rgb: 74, 33, 182;
      --accent-soft: rgba(74, 33, 182, 0.08);
    }
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  /* El ancho de la barra de scroll queda reservado siempre. Sin esto, cuando
     la regla de abajo esconde el desborde la barra se va y la pagina entera se
     corre diez pixeles de costado justo al abrir el visor. */
  scrollbar-gutter: stable;
}

/* El <dialog> nativo no bloquea el scroll de atras: con el visor abierto, la
   rueda o un dedo sobre el fondo deslizan la pagina por debajo del modal, que
   se queda quieto, y al cerrarlo uno aparece en otro lado. En un celular es
   peor, porque el fondo del visor es casi toda la pantalla. */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  /* El Safari de iOS agranda por su cuenta el texto de los bloques anchos al
     girar el telefono. El sitio ya decide sus tamanos y no quiere esa ayuda;
     100% la apaga sin tocar el zoom, que sigue a mano del visitante. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--texto-5);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Titulos con los renglones parejos, y parrafos que no terminan en una
   palabra sola. Donde no se soporta, corta como siempre. */
h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

svg,
button,
.brand,
.social a,
.nav-actions,
.menu-toggle,
.term-prompt,
.term-key {
  -webkit-user-select: none;
  user-select: none;
}

svg {
  pointer-events: none;
}

button,
a,
input,
textarea,
.cert-card {
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: clamp(1.25rem, 5vw, 3rem);
  padding-right: clamp(1.25rem, 5vw, 3rem);
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

/* main recibe el foco desde "Saltar al contenido", y cada seccion cuando el
   foco la sigue al scrollear (main.js). Son contenedores: el contorno seria
   un recuadro alrededor de media pagina. */
main:focus,
main > section:focus {
  outline: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  background-image: var(--glass-shine);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: var(--bg);
  }
}

.nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.9rem clamp(1.25rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  position: relative;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--texto-5);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* El logo mide 21 px de alto cuando la fuente baja en celular, y el minimo
   para algo que se toca con el dedo son 24. Esta capa agranda la zona
   tocable sin mover el texto ni la linea de abajo. */
.brand::before {
  content: "";
  position: absolute;
  inset: -0.3rem 0;
}

/* Una linea que se dibuja de izquierda a derecha, al ritmo en que se lee.
   Va absoluta y escalada para que no mueva nada de la barra. */
.brand::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3em;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease-out;
}

.brand:hover,
.brand:focus-visible {
  text-decoration: none;
}

.brand:hover::after,
.brand:focus-visible::after {
  transform: scaleX(1);
}

.brand-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--texto-4);
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

/* La seccion en la que estas. Subrayada y no solo en otro color: el color
   solo no alcanza para marcar algo. */
.nav-links a.active {
  text-decoration: underline 2px var(--accent);
  text-underline-offset: 6px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  position: absolute;
  opacity: 0;
  transform: rotate(-80deg) scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: none;
}

/* El cambio de tema: ui.js abre la vista nueva en un circulo, con un fundido
   propio y lento. El del navegador se apaga: dura un cuarto de segundo y se
   sumaria al otro. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.cambiando-tema,
.cambiando-tema *,
.cambiando-tema *::before,
.cambiando-tema *::after {
  transition: none !important;
}

.lang-toggle {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.3s ease;
}

.lang-toggle:hover {
  border-color: var(--accent);
}

.lang-toggle .is-active {
  color: var(--accent);
  font-weight: 500;
}

.lang-sep {
  margin: 0 0.3rem;
  opacity: 0.4;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 42px;
  height: 42px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-open .menu-toggle span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.menu-open .menu-toggle span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* Lo mismo sirve para un <a> y para un <button>. El boton trae del navegador
   un borde de 2 px en relieve y otro alto de linea: sin esto, el de enviar
   del formulario tenia un marco gris y media 4 px menos que los del inicio. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--texto-4);
  line-height: 1.3;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn[hidden] {
  display: none;
}

.btn-solid {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-solid:hover {
  background: var(--accent-2);
}

.btn-ghost {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

.btn-cv {
  padding: 0.45rem 1rem;
  font-size: var(--texto-3);
}

.hero {
  position: relative;
  padding-top: clamp(4rem, 12vh, 8rem);
  padding-bottom: clamp(3rem, 8vh, 6rem);
}

/* ---------- rotador de oficios ---------- */

.hero-role {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  line-height: 1.3;
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: 30ch;
  text-wrap: pretty;
}

/* El oficio va en su propio renglon y nunca se parte, asi el bloque no
   cambia de alto al cambiar de texto. Los textos entran desde 320 px, y el
   alto minimo lo sostiene mientras se borra. */
.role-rotator {
  display: block;
  min-height: 1.3em;
  white-space: nowrap;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
  cursor: pointer;
}

/* Mientras escribe, un cursor de bloque al final. */
.role-rotator.is-escribiendo::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.1em;
  background: currentColor;
}

/* ---------- ventana del inicio ---------- */

/* Una ventana de vidrio: el marco y la barra de titulo dejan ver lo de atras,
   como en Aero; la pantalla, donde va el texto, es opaca. */
.hero-term {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--glass);
  background-image: var(--glass-shine);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 20px 50px rgba(0, 0, 0, 0.3);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.8rem;
  background-image: var(--glass-shine);
  border-bottom: 1px solid var(--line);
}

/* Con mouse la ventana se arrastra de la barra por toda la pagina (main.js).
   Va por encima de todo menos la barra de navegacion (50), y vuelve a su
   lugar con una transicion que se apaga mientras se arrastra. */
.hero-term.es-arrastrable {
  position: relative;
  z-index: 20;
  transition: translate 0.3s ease-out;
}

.hero-term.es-arrastrable .term-bar {
  cursor: grab;
}

.hero-term.is-arrastrada {
  transition: none;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 30px 70px rgba(0, 0, 0, 0.45);
}

.hero-term.is-arrastrada .term-bar {
  cursor: grabbing;
}

/* Tres puntos y el nombre de la maquina: lo que dice que esto es una
   ventana. Son decorativos y no se anuncian. */
.term-dots {
  display: inline-flex;
  gap: 5px;
  pointer-events: none;
}

.term-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-strong);
}

.term-dots i:first-child {
  background: var(--accent);
}

.term-title {
  font-family: var(--font-mono);
  font-size: var(--texto-1);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-screen {
  position: relative;
  flex: 1 1 auto;
  height: 270px;
  overflow-y: auto;
  padding: 0.9rem;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  line-height: 1.7;
  scrollbar-width: thin;
}

.term-line,
.term-out-line {
  margin: 0;
  word-break: break-word;
}

.term-prompt {
  color: var(--accent);
  margin-right: 0.6ch;
}

/* El renglon donde se escribe la pregunta termina en un cursor de bloque. */
.term-typing .term-cmd::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent);
}

.term-typing.is-idle .term-cmd::after {
  animation: term-blink 1s steps(1) 4;
}

@keyframes term-blink {
  50% {
    opacity: 0;
  }
}

.term-cmd {
  color: var(--text);
  white-space: pre-wrap;
}

/* El renglon de abajo tiene un campo de texto de verdad, invisible y encima:
   lo que se escribe se copia a .term-cmd, que termina en el cursor de
   bloque. Tocar cualquier parte del renglon lo enfoca, porque es un label. */
.term-typing {
  position: relative;
  display: block;
  cursor: text;
}

.term-input {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  /* 16 px: con menos, Safari en el iPhone agranda la pagina al tocarlo. */
  font-size: 16px;
}

/* El campo no se ve, asi que el foco se marca en el renglon, y el cursor
   parpadea mientras se puede escribir, como el de cualquier campo. */
.term-typing:focus-within {
  outline: 1px solid rgba(var(--accent-rgb), 0.5);
  outline-offset: 4px;
  border-radius: 2px;
}

.term-typing:focus-within .term-cmd::after {
  animation: term-blink 1s steps(1) infinite;
}

/* La ayuda va en columnas: el comando y lo que hace. */
.out-pre {
  white-space: pre-wrap;
}

.term-done .term-cmd {
  color: var(--muted);
}

.term-out {
  margin: 0.15rem 0 0.8rem;
}

.term-out-line {
  color: var(--muted);
  opacity: 0;
  translate: -6px 0;
  animation: term-line-in 0.3s ease forwards;
  animation-delay: calc(var(--i) * 50ms);
}

.term-out-line.out-strong {
  color: var(--text);
}

.term-out-line a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.term-out-line a:hover {
  text-decoration-thickness: 2px;
}

.term-out-line.out-dim {
  opacity: 0;
  color: var(--muted);
  font-size: 0.94em;
  animation-name: term-line-in-dim;
}

@keyframes term-line-in {
  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes term-line-in-dim {
  to {
    opacity: 0.85;
    translate: 0 0;
  }
}

.term-hint {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.7rem 0.7rem 0;
  border-top: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: var(--texto-2);
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: break-word;
}

.term-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem 0.7rem;
}

.term-key {
  font-family: var(--font-body);
  font-size: var(--texto-2);
  padding: 0.4rem 0.7rem;
  min-height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease,
    translate 0.2s ease;
}

/* Solo con mouse: en el celular el hover queda pegado despues del toque y
   la pregunta parece seguir elegida. */
@media (hover: hover) {
  .term-key:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    translate: 0 -2px;
  }
}

/* La ultima pregunta hecha queda marcada, para saber de que es la respuesta. */
.term-key[aria-current="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.term-key:active {
  translate: 0 0;
}

/* ---------- datos del inicio ---------- */

.hero-facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem 1.25rem;
  margin: 0 0 1.9rem;
  padding: 1.1rem 0 0;
  border-top: 1px solid var(--line);
}

@media (min-width: 28.75em) {
  .hero-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.fact dt {
  font-family: var(--font-mono);
  font-size: var(--texto-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.fact dd {
  margin: 0;
  font-size: var(--texto-4);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.hero-grid {
  display: grid;
  gap: clamp(2.75rem, 7vw, 4.5rem);
  align-items: center;
}

@media (min-width: 56.25em) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  }
}

.hero-main {
  max-width: 44rem;
}

@supports (container-type: inline-size) {
  .hero-main {
    container-type: inline-size;
  }

  .hero-title {
    font-size: clamp(2.1rem, 12cqw, 4.2rem);
  }
}

.hero-bio {
  max-width: 52ch;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.social {
  display: flex;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social a {
  display: inline-flex;
  padding: 0.6rem;
  border-radius: var(--radius);
  color: var(--muted);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.social a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.section {
  padding-block: clamp(2.25rem, 5.5vh, 3.25rem);
}

/* En el celular, las secciones que estan lejos de la pantalla no se dibujan
   hasta que uno se acerca: la pagina mide ocho pantallas y el telefono las
   armaba todas al cargar. Solo en tactil: esto recorta lo que sobresale de la
   seccion, y con mouse cortaria la sombra de las tarjetas al levantarse. */
@media (hover: none) {
  .section {
    content-visibility: auto;
    contain-intrinsic-size: auto 900px;
  }

  /* En tactil las tarjetas de proyecto no se inclinan, asi que van planas
     y no ocupan cada una una capa 3D. Los selectores dobles le ganan a las
     reglas de las tarjetas, que estan mas abajo en la hoja. */
  .section .project-grid {
    perspective: none;
  }

  .project-grid .project-card {
    transform: none;
    transform-style: flat;
  }
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
  display: flex;
  align-items: baseline;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  margin-left: 1.25rem;
  transform: translateY(-0.35em);
}

.subsection-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--texto-6);
  margin: 3rem 0 1.5rem;
}

.profile-heading {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(1.65rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  max-width: 24ch;
  margin: 0 0 1.75rem;
}

.profile-text p {
  max-width: 62ch;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.profile-text p:last-child {
  margin-bottom: 0;
}

.profile-text .about-stack {
  font-family: var(--font-mono);
  font-size: var(--texto-3);
  color: var(--muted);
  max-width: 62ch;
  margin-top: 1.6rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

/* En pantalla ancha el titular va a la izquierda y el texto a la derecha: en
   una sola columna el texto llegaba a la mitad y la otra mitad quedaba vacia. */
@media (min-width: 56.25em) {
  .profile {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
  }

  .profile .section-title {
    grid-column: 1 / -1;
  }

  .profile-heading {
    margin: 0;
  }
}

/* ---------- habilidades ---------- */

/* Una ficha: el rubro a la izquierda y lo que abarca a la derecha, una fila
   por rubro. */
.skills-list {
  margin: 0;
  border-top: 1px solid var(--line);
}

.skill-row {
  display: grid;
  gap: 0.7rem 2rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 45em) {
  .skill-row {
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: baseline;
  }
}

.skill-row dt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--texto-5);
  line-height: 1.3;
}

.skill-row dd {
  margin: 0;
}

.skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.skill-chip {
  font-family: var(--font-mono);
  font-size: var(--texto-1);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.skill-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

@media (pointer: coarse) {
  /* Con el dedo, 44 px: el tamano de los controles de Apple y Android (la
     norma pide 24). El blanco crece por afuera, en un pseudo-elemento, y lo
     que se ve sigue midiendo lo mismo. */
  .theme-toggle,
  .lang-toggle,
  .menu-toggle,
  .viewer-close {
    position: relative;
  }

  .theme-toggle::after,
  .lang-toggle::after,
  .menu-toggle::after,
  .viewer-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}

/* ---------- formacion ---------- */

.timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0 0 0 2px;
  display: grid;
  gap: 1.75rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.timeline-item {
  padding-left: 1.4rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0.5em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.timeline-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--texto-6);
  margin: 0 0 0.15rem;
}

.timeline-place {
  font-size: var(--texto-4);
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 1.1rem;
}

.timeline-meta .cert-file {
  margin-top: 0;
}

.cert-list,
.certs-all-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 1rem;
}

.cert-card {
  display: flex;
  flex-direction: column;
  background-color: var(--glass);
  background-image: var(--glass-shine);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  padding: 1.25rem;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.3s ease,
    translate 0.3s ease-out;
}

.cert-card.is-openable:hover {
  translate: 0 -3px;
  border-color: var(--accent);
  background-color: var(--glass-solid);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Lo mismo que en los proyectos: la tarjeta bajo el mouse queda entera y las
   demas se apagan. Volver a encenderse espera un momento, asi cruzar el hueco
   entre dos tarjetas no las prende a todas de golpe. */
.cert-card > * {
  transition: opacity 0.3s ease 0.1s;
}

.certs-all-list:has(.cert-card.is-openable:hover) .cert-card:not(:hover) > * {
  opacity: 0.4;
  transition-delay: 0s;
}

.cert-year {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--accent);
  margin: 0 0 0.4rem;
}

.cert-name {
  font-size: var(--texto-4);
  font-weight: 600;
  margin: 0 0 0.3rem;
  line-height: 1.35;
}

.cert-inst {
  font-size: var(--texto-3);
  color: var(--muted);
  margin: 0;
}

.cert-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  /* Lo minimo que pide 2.5.8 para tocar con el dedo. */
  min-height: 24px;
  font-size: var(--texto-3);
  margin-top: 0.7rem;
}

/* La tarjeta es una columna: el nombre reserva dos renglones y el boton se va
   al pie, asi la institucion y el boton quedan a la misma altura en todas las
   tarjetas sin importar cuanto ocupe el titulo. */
.cert-card .cert-name {
  min-height: calc(1.35em * 2);
}

.cert-card .cert-file {
  margin-top: auto;
  padding-top: 0.7rem;
  align-self: flex-start;
}

/* El texto solo mide 16px de alto y como blanco tactil se queda corto: WCAG
   2.2 pide 24x24. El padding agranda el area de toque y el margen negativo lo
   devuelve a su lugar, asi no se mueve nada. */
.cert-open {
  font-family: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0.25rem 0;
  margin: -0.25rem 0;
  cursor: pointer;
  /* La opacidad es la de .cert-card > *, que esta regla pisaria. */
  transition: gap 0.2s ease, opacity 0.3s ease 0.1s;
}

.cert-open:hover {
  gap: 0.6rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cert-card.is-openable {
  cursor: pointer;
}

/* ---------- certificados: una cascada ---------- */

/* Las tarjetas, apiladas en la misma celda: la de adelante entera y tres
   asomando por debajo. --lugar (0 adelante) lo pone main.js, y cambiar de
   lugar ya es la animacion. Opacas, para que no se lea la de abajo. */
.cert-list {
  grid-template-columns: minmax(0, 1fr);
  max-width: 36rem;
  padding-bottom: 2.25rem;
  touch-action: pan-y;
}

.cert-list .cert-card {
  --hondo: min(var(--lugar, 0), 3);
  grid-area: 1 / 1;
  background-color: var(--surface);
  transform: translateY(calc(var(--hondo) * 0.75rem)) scale(calc(1 - var(--hondo) * 0.05));
  transform-origin: 50% 100%;
  opacity: calc(1 - min(var(--lugar, 0), 4) * 0.25);
  z-index: calc(10 - var(--lugar, 0));
  transition: transform 0.6s ease, opacity 0.6s ease, border-color 0.2s ease, background-color 0.2s ease,
    box-shadow 0.3s ease, translate 0.3s ease-out;
}

/* De las de atras solo asoma el borde: el texto aparece cuando la tarjeta
   llega adelante. --lugar se hereda, asi que los hijos lo leen. */
.cert-list .cert-card > * {
  opacity: calc(1 - min(var(--lugar, 0), 1));
}

/* La de adelante no se hunde de golpe: primero sube y se desvanece, y recien
   ahi pasa al fondo, donde ya no se ve. */
.cert-list .cert-card.se-va {
  animation: se-va 0.6s ease-in both;
}

@keyframes se-va {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
    z-index: 20;
  }

  50% {
    transform: translateY(-1.5rem) scale(1.02);
    opacity: 0;
    z-index: 20;
  }

  51%,
  100% {
    transform: translateY(2.25rem) scale(0.85);
    opacity: 0;
    z-index: 0;
  }
}

/* La barra de abajo: un tramo por tarjeta. El de la de adelante se llena de
   violeta en 4 segundos y, al llenarse, main.js pasa a la siguiente; pausar
   la cascada es pausar esta animacion. Con menos movimiento pedido no se
   llena sola, y la cascada solo se mueve a mano. */
.cascada-barra {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 36rem;
  margin-top: 0.5rem;
  padding-block: 0.75rem;
  cursor: pointer;
  touch-action: pan-y;
}

.cascada-tramos {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
}

.cascada-tramo {
  flex: 1 1 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.cascada-tramo i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.cascada-tramo.is-lleno i {
  transform: scaleX(1);
}

.cascada-tramo.is-actual i {
  animation: llenar 4s linear forwards;
}

.cascada-barra.is-quieta .is-actual i {
  animation-play-state: paused;
}

@keyframes llenar {
  to {
    transform: scaleX(1);
  }
}

/* En el celular, una mano al lado de la barra hace tres veces el gesto de
   deslizar cuando la cascada aparece, y se queda quieta. Con mouse no hace
   falta: la barra responde apenas se pasa por encima. */
.cascada-toque {
  display: none;
  flex: 0 0 auto;
  color: var(--accent);
}

@media (hover: none) {
  .cascada-toque {
    display: block;
  }

  .cascada-barra.is-vista .cascada-toque {
    animation: toque 1s ease-in-out 3;
  }
}

@keyframes toque {
  50% {
    translate: 6px 0;
    opacity: 0.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cascada-tramo.is-actual i,
  .cascada-barra.is-vista .cascada-toque {
    animation: none;
  }
}

/* En pantalla ancha la cascada ocupa todo el ancho, como la linea de tiempo
   de arriba, y cada tarjeta es una fila: el ano a la izquierda como los
   periodos de la formacion, el nombre y quien lo emitio en el medio, y el
   boton a la derecha. Angosta y a un costado dejaba media seccion vacia. */
@media (min-width: 48em) {
  .cert-list,
  .cascada-barra {
    max-width: none;
  }

  .cert-list .cert-card {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr) auto;
    grid-template-areas:
      "anio nombre boton"
      "anio lugar boton";
    align-items: center;
    column-gap: 1.5rem;
    row-gap: 0.25rem;
    padding: 1.5rem 1.75rem;
  }

  .cert-list .cert-year {
    grid-area: anio;
    margin: 0;
  }

  .cert-list .cert-name {
    grid-area: nombre;
    min-height: 0;
    margin: 0;
    font-size: var(--texto-5);
  }

  .cert-list .cert-inst {
    grid-area: lugar;
  }

  .cert-list .cert-file {
    grid-area: boton;
    align-self: center;
    margin: 0;
    padding-top: 0;
  }
}

/* ---------- todos los certificados, en cuadricula ---------- */

.certs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 3rem 0 1.5rem;
}

.certs-head .subsection-title {
  margin: 0;
}

.certs-expand {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--accent);
  background: none;
  border: none;
  /* El minimo para algo que se toca con el dedo son 24 px de alto. El
     padding los da y el margen negativo deja el texto donde estaba. */
  padding: 0.25rem 0;
  margin: -0.25rem 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}

.certs-expand:hover {
  text-decoration-color: currentColor;
}

.certs-all {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1180px, 94vw);
  max-width: none;
  max-height: 90vh;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  color: var(--text);
}

.certs-all::backdrop {
  background: rgba(4, 4, 6, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.certs-all-frame {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.certs-all-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 0.6rem 0.8rem;
  background-color: var(--surface-2);
  background-image: var(--glass-shine);
  border-bottom: 1px solid var(--line);
}


.certs-all-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--bg);
}

@media (max-width: 45em) {
  .certs-all {
    width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
  }

  .certs-all-frame {
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* ---------- visor de certificados ---------- */

.viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1000px, 94vw);
  max-width: none;
  max-height: 92vh;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  color: var(--text);
}

.viewer::backdrop {
  background: rgba(4, 4, 6, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.viewer,
.certs-all {
  opacity: 0;
  translate: 0 10px;
  scale: 0.98;
  transition:
    opacity 0.3s ease,
    translate 0.3s ease-out,
    scale 0.3s ease-out,
    overlay 0.3s allow-discrete,
    display 0.3s allow-discrete;
}

.viewer[open],
.certs-all[open] {
  opacity: 1;
  translate: 0 0;
  scale: 1;
}

@starting-style {
  .viewer[open],
  .certs-all[open] {
    opacity: 0;
    translate: 0 10px;
    scale: 0.98;
  }
}

.viewer::backdrop,
.certs-all::backdrop {
  opacity: 0;
  transition: opacity 0.3s ease, overlay 0.3s allow-discrete, display 0.3s allow-discrete;
}

.viewer[open]::backdrop,
.certs-all[open]::backdrop {
  opacity: 1;
}

@starting-style {
  .viewer[open]::backdrop,
  .certs-all[open]::backdrop {
    opacity: 0;
  }
}

.viewer-frame {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  padding: 0.6rem 0.8rem;
  background-color: var(--surface-2);
  background-image: var(--glass-shine);
  border-bottom: 1px solid var(--line);
}

/* Como la ventana del inicio: tres puntos y el nombre en letra de terminal.
   El "~/" es decorativo; el texto alternativo vacio hace que no se lea. */
.viewer-title,
.certs-all-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--texto-3);
  font-weight: 500;
  line-height: 1.4;
}

.viewer-title::before,
.certs-all-title::before {
  content: "~/" / "";
  margin-right: 0.5ch;
  color: var(--accent);
}

.viewer-pos {
  color: var(--muted);
}

.viewer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.viewer-close:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.viewer-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.viewer-body {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .viewer-nav {
    background: var(--surface);
  }
}

.viewer-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.viewer-nav[hidden] {
  display: none;
}

.viewer-prev {
  left: 0.6rem;
}

.viewer-next {
  right: 0.6rem;
}

/* La imagen y la leyenda van juntas en el medio. Sin align-content, las dos
   filas se reparten el alto y quedan separadas por un hueco. */
.viewer-body.is-image {
  display: grid;
  place-items: center;
  align-content: center;
  padding: 1rem;
}

/* Solo envuelve a la imagen para que el zoom se pueda hacer con el teclado:
   ni fondo, ni borde, ni espacio propio. Los gestos sobre la imagen los
   maneja main.js: pellizcar amplia la imagen y no la pagina entera. */
.viewer-zoom {
  display: block;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  line-height: 0;
  cursor: zoom-in;
  touch-action: none;
}

/* Lo que queda del 92% de alto del visor despues de la barra, los botones,
   el margen y la leyenda (11,5rem): el escaneo entra entero aun en pantallas
   bajas. */
.viewer-image {
  max-width: 100%;
  max-height: min(74vh, calc(92vh - 11.5rem));
  border-radius: var(--radius-sm);
  cursor: zoom-in;
}

/* Ampliada con el teclado, la imagen va a su tamano real y el visor se
   desplaza. Ajustarla al ancho no alcanzaba: casi todos los escaneos son
   apaisados y ya estaban al ancho, asi que ampliar no cambiaba nada. */
.viewer-zoom.is-zoomed,
.viewer-image.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
  touch-action: auto;
}

/* Como se usa la imagen: clic para la lupa, o pellizcar con el dedo. */
.viewer-leyenda {
  margin: 0.6rem 0 0;
  font-size: var(--texto-2);
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

/* La lupa: un cuadro con marco de vidrio estilo Aero que amplia lo que esta
   bajo el cursor. Posicion y aumento los pone main.js; el cursor se esconde
   porque el centro del cuadro ya lo marca. */
.viewer-lupa {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: min(240px, 40vmin);
  height: min(240px, 40vmin);
  padding: 7px;
  border-radius: 10px;
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.2) 40%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.05) 51%, rgba(255, 255, 255, 0.2)),
    rgba(var(--accent-rgb), 0.2);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  backdrop-filter: blur(10px) saturate(150%);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6),
    0 20px 40px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.viewer-lupa-vista {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background-color: var(--bg);
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.viewer-lupa.is-visible {
  opacity: 1;
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .viewer-lupa {
    background: var(--surface-2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.viewer-zoom.con-lupa,
.viewer-zoom.con-lupa .viewer-image {
  cursor: none;
}

/* Cerca del borde la lupa se sale del visor, y lo que se sale agranda el
   area de scroll: aparecerian barras al mover el mouse. Sin ampliar, todo
   entra y no hay nada que desplazar. */
.viewer-body.is-image:not(:has(.viewer-zoom.is-zoomed)) {
  overflow: hidden;
}

/* Centrada, lo que sobresale a la izquierda y arriba queda fuera del alcance
   del scroll: un desborde negativo no se puede desplazar. */
.viewer-body.is-image:has(.is-zoomed) {
  place-items: start;
  place-content: start;
}

.viewer-body.is-pdf {
  height: 74vh;
}

.viewer-body.is-pdf iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.viewer-body.is-hint {
  display: grid;
  place-items: center;
  padding: 2.5rem 1.5rem;
}

.viewer-hint {
  max-width: 40ch;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--texto-4);
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  flex: 0 0 auto;
  padding: 0.85rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.viewer-actions:empty {
  display: none;
}

.viewer-btn {
  padding: 0.5rem 1.1rem;
  font-size: var(--texto-3);
}

.viewer-todos {
  margin-left: auto;
}

/* En el celular el visor ocupa la pantalla entera, como el visor de fotos
   del telefono, y la imagen casi no deja margen: cada milimetro es escaneo. */
@media (max-width: 45em) {
  .viewer {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
  }

  .viewer-frame {
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
  }

  .viewer-body.is-image {
    padding: 0.25rem;
  }

  .viewer-image {
    max-height: calc(100dvh - 9rem);
  }
}

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  perspective: 1100px;
}

/* Columnas fijas y no auto-fill: la tarjeta destacada ocupa dos, y con una
   cantidad de columnas que el navegador elige no hay forma de saber si caben. */
@media (min-width: 40em) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-card.is-featured {
    grid-column: span 2;
  }
}

@media (min-width: 62.5em) {
  .project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--glass);
  background-image: var(--glass-shine);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  padding: 1.6rem;
  overflow: hidden;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translate3d(0, var(--lift, 0px), 0);
  transform-style: preserve-3d;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease,
    backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease,
    transform 0.3s ease-out;
}

/* Al pasar el mouse: un foco que sigue al cursor (--mx, --my los pone
   main.js) y un brillo que recorre el borde. */
.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 50%),
    rgba(var(--accent-rgb), 0.16),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--sweep, 0deg),
    transparent 0deg,
    rgba(var(--accent-rgb), 0.9) 60deg,
    transparent 140deg,
    transparent 360deg
  );
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.project-card > * {
  position: relative;
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Los efectos de hover son solo para el mouse: en una pantalla tactil el
   :hover queda pegado al tocar, con el foco de luz fijo en el medio y el
   borde girando sin parar. */
@media (hover: hover) {
  /* La tarjeta bajo el mouse es vidrio casi opaco: el texto se lee sin que la
     captura de atras se meta. */
  .project-card:hover,
  .project-grid.is-mirando .project-card.is-activa {
    --lift: -5px;
    background-color: var(--glass-solid);
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: inset 0 1px 0 var(--glass-edge), 0 20px 40px rgba(0, 0, 0, 0.4);
  }
}

/* Mientras se ve la captura de un proyecto, las tarjetas se escarchan y las
   demas quedan casi sin tinte, para que el fondo se vea. Las clases las pone
   main.js: con :hover solo, el hueco entre dos tarjetas las apagaria todas. */
.project-grid.is-mirando .project-card {
  -webkit-backdrop-filter: var(--glass-frost);
  backdrop-filter: var(--glass-frost);
}

.project-grid.is-mirando .project-card:not(.is-activa) {
  background-color: var(--glass-clear);
}

.project-grid.is-mirando .project-card:not(.is-activa) > * {
  opacity: 0.4;
}

@media (hover: hover) {
  .project-card:hover .project-shot {
    filter: none;
  }

  .project-card:hover::before {
    opacity: 1;
  }

  .project-card:hover::after {
    opacity: 1;
    animation: border-sweep 3s linear infinite;
  }
}

@property --sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes border-sweep {
  to {
    --sweep: 360deg;
  }
}

@media (max-width: 56.25em) {
  .project-card {
    box-shadow: none;
  }

  .project-card::after {
    display: none;
  }
}

/* La tarjeta destacada abre con una franja de la app de verdad, de borde a
   borde: los margenes negativos son el padding de la tarjeta. */
/* Una captura de un sitio claro encandila en el tema oscuro: ahi va un poco
   apagada y recupera el brillo cuando el mouse esta sobre la tarjeta. */
.project-shot {
  filter: brightness(var(--shot-brillo, 0.8));
  transition: filter 0.3s ease;
  display: block;
  width: calc(100% + 3.2rem);
  max-width: none;
  height: auto;
  margin: -1.6rem -1.6rem 1.4rem;
  border-bottom: 1px solid var(--line);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

/* En un telefono la franja entera mide 100 px de alto y la app no se
   distingue. Mas alta y recortada desde arriba a la izquierda quedan el logo,
   el archivo abierto y la lista de equipos, que es lo que la reconoce. */
@media (max-width: 39.99em) {
  .is-featured .project-shot {
    aspect-ratio: 2 / 1;
    object-fit: cover;
    object-position: left top;
  }
}

.project-year {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.project-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--texto-6);
  line-height: 1.3;
  margin: 0 0 0.6rem;
}

.project-desc {
  color: var(--muted);
  font-size: var(--texto-4);
  margin: 0 0 1.1rem;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
}

.project-tags li {
  font-family: var(--font-mono);
  font-size: var(--texto-1);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: translate 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

@media (hover: hover) {
  .project-card:hover .project-tags li {
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.4);
  }

  .project-card .project-tags li:hover {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 0 0 1px var(--accent);
    translate: 0 -1px;
  }
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  /* 24 px de alto es el minimo para algo que se toca con el dedo. */
  min-height: 24px;
  gap: 0.35rem;
  font-size: var(--texto-3);
  font-weight: 600;
  transition: gap 0.2s ease, color 0.2s ease;
}

.project-links a:hover {
  gap: 0.6rem;
}

/* ---------- fondo con el proyecto ---------- */

/* Detras de todo, fija a la ventana. main.js la arma solo con mouse. */
.fondo-proyectos {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.fondo-proyecto {
  position: absolute;
  inset: 0;
  background-position: center top;
  background-size: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* El velo es el fondo de la pagina al 85%. Con la parte mas clara de la
   captura debajo, el texto gris sigue por encima de 4,5:1: 4,8:1 en el tema
   oscuro sobre blanco y 5,1:1 en el claro sobre negro. */
.fondo-proyecto::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.85;
}

.fondo-proyecto.is-visible {
  opacity: 1;
}

.section-contact {
  padding-bottom: clamp(4rem, 10vh, 7rem);
}

.contact-lead {
  max-width: 55ch;
  color: var(--muted);
  margin: 0 0 1.75rem;
}

/* En pantalla ancha, el texto a la izquierda y el formulario a la derecha: en
   una sola columna el formulario dejaba vacia la mitad de la seccion. Las
   areas mantienen el orden del HTML, que en el telefono es el que se lee:
   texto, formulario, y el correo directo como alternativa al final. */
@media (min-width: 56.25em) {
  .contact-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "texto formulario"
      "directo formulario";
    column-gap: clamp(2.5rem, 6vw, 5rem);
    align-items: start;
  }

  .contact-lead {
    grid-area: texto;
  }

  .contact-grid .contact-form {
    grid-area: formulario;
    max-width: none;
    margin: 0;
  }

  .contact-direct {
    grid-area: directo;
    margin: 0;
  }
}

.contact-form {
  display: grid;
  gap: 1.1rem;
  max-width: 560px;
  margin: 0 0 1.5rem;
}

.form-row {
  display: grid;
  gap: 0.4rem;
}

.form-row label {
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-row input,
.form-row textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--texto-5);
  resize: vertical;
  transition: border-color 0.2s ease, background-color 0.3s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* La regla de arriba es mas especifica que el :focus-visible general y le
   gana, asi que el recuadro hay que devolverlo aca. El borde cambiando de
   color no alcanza como unica marca de foco: es el mismo borde que ya tienen
   los otros dos campos, solo que violeta. */
.form-row input:focus-visible,
.form-row textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.form-row textarea {
  min-height: 130px;
}

.form-row input[aria-invalid="true"],
.form-row textarea[aria-invalid="true"] {
  border-color: var(--error);
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.contact-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-status {
  min-height: 1.2em;
  font-size: var(--texto-3);
  margin: 0;
  color: var(--muted);
}

.form-status.is-success {
  color: var(--success);
}

.form-status.is-error {
  color: var(--error);
}

.contact-direct {
  color: var(--muted);
  font-size: var(--texto-4);
}

.contact-mail {
  font-family: var(--font-mono);
  font-size: var(--texto-3);
}

/* ---------- paginas sueltas: el CV, Trenza y la 404 ---------- */

.standalone {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.standalone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
  width: 100%;
}

.standalone-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---------- Trenza, contado ---------- */

/* Un renglon de unos 70 caracteres, que es lo que se lee sin perderse. */
.nota {
  flex: 1;
  width: 100%;
  max-width: 44rem;
  padding-top: 2rem;
  padding-bottom: 5rem;
}

.nota-meta {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--texto-2);
  color: var(--accent);
}

.nota h1 {
  margin: 0.5rem 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  font-weight: 800;
  line-height: 1;
}

.nota h2 {
  margin: 2.5rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: var(--texto-6);
  font-weight: 700;
}

.nota p,
.nota li {
  line-height: 1.7;
}

.nota p {
  margin: 0 0 1rem;
}

.nota-lead {
  font-size: var(--texto-6);
  color: var(--muted);
}

.nota ol,
.nota ul {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

.nota li + li {
  margin-top: 0.5rem;
}

.nota code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.nota figure {
  margin: 2rem 0;
}

.nota img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nota figcaption,
.nota-aviso {
  font-size: var(--texto-2);
  color: var(--muted);
}

.nota figcaption {
  margin-top: 0.6rem;
}

.nota-datos {
  margin: 0 0 2rem;
}

/* Las cuatro capas del .pkt, una adentro de la otra: la lista que viene
   abajo, dibujada. El lector de pantalla lee la lista y esto no se anuncia. */
.nota .capas {
  margin: 1.5rem 0 1.75rem;
  font-family: var(--font-mono);
  font-size: var(--texto-2);
}

.capa {
  padding: 0.6rem 0.75rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(var(--accent-rgb), 0.04);
  color: var(--muted);
}

.capa .capa {
  margin-top: 0.5rem;
}

.capa-xml {
  /* Sin el tinte de las capas de afuera: el violeta sobre violeta no llega
     a 4,5:1 en el tema claro. */
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
  text-align: center;
}

.nota-cierre {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 2.5rem 0 1.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 1.25rem;
  text-align: center;
  font-size: var(--texto-2);
  color: var(--muted);
  transition: border-color 0.3s ease;
}

.site-footer p {
  margin: 0;
}

.footer-link {
  color: var(--text);
  font-weight: 600;
  text-decoration-color: rgba(var(--accent-rgb), 0.45);
  text-decoration-line: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.footer-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (min-width: 87.5em) {
  .hero-role {
    font-size: clamp(1.3rem, 2vw, 1.8rem);
  }

  .term-screen {
    height: 320px;
  }

  .hero {
    padding-top: clamp(5rem, 14vh, 9rem);
  }
}

/* Cuando la barra no tiene lugar para el boton del CV, el CV pasa al menu. */
.nav-cv {
  display: none;
}

@media (max-width: 62.5em) {
  .btn-cv {
    display: none;
  }

  .nav-cv {
    display: block;
  }
}

@media (max-width: 56.25em) {
  .nav {
    gap: 0.5rem;
  }

  .nav-actions {
    gap: 0.4rem;
  }

  .menu-toggle {
    display: flex;
  }

  /* El menu es una capa de vidrio sobre toda la pantalla, con los enlaces en
     el medio. Va detras de la barra (z-index negativo dentro de ella), asi
     que la X para cerrarlo sigue a la vista. */
  .nav-links {
    position: fixed;
    inset: 0;
    z-index: -1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 5rem 1.25rem 2rem;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    backdrop-filter: blur(16px) saturate(150%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
  }

  .nav-links li {
    opacity: 0;
    translate: 0 0.75rem;
    transition: opacity 0.3s ease, translate 0.3s ease-out;
  }

  .menu-open .nav-links,
  .menu-open .nav-links li {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
  }

  .nav-links a {
    display: block;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--text);
    text-align: center;
    border-radius: var(--radius-sm);
  }

  /* El CV, como en la barra de la PC: un boton con el borde del acento. */
  .nav-cv {
    margin-top: 1rem;
  }

  .nav-cv a {
    padding: 0.6rem 2rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: var(--texto-5);
  }

  /* Con el menu abierto la pagina de atras no se mueve. */
  body.menu-open {
    overflow: hidden;
  }

  /* Al bajar, la barra se va hacia arriba; al subir, vuelve. La clase la
     pone main.js. */
  .site-header {
    transition: translate 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
  }

  .site-header.is-oculta {
    translate: 0 -100%;
  }
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .nav-links {
    background: var(--bg);
  }
}

@media (max-width: 56.25em) {
  .site-header {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (max-width: 45em) {
  .brand {
    font-size: var(--texto-2);
  }

  .lang-toggle {
    padding: 0.35rem 0.55rem;
    font-size: var(--texto-1);
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .term-screen {
    height: 220px;
    font-size: var(--texto-1);
  }

  .term-keys {
    gap: 0.35rem;
  }

  .term-key {
    flex: 1 1 auto;
    min-height: 40px;
    text-align: center;
  }

  .section-title::after {
    margin-left: 0.9rem;
  }
}

/* Para los lectores de pantalla y nadie mas. No sirve display: none ni
   visibility: hidden, que lo sacarian tambien del lector. */
.solo-lectores {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Respaldo sin JavaScript. Las secciones se arman desde data.js, asi que sin
   script quedan vacias; estas listas las sustituyen. El navegador no las
   dibuja cuando el script corre. */
.nojs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.nojs ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
}

.nojs a {
  text-decoration: underline;
}

/* El aviso de que falta JavaScript, arriba del hero. Discreto a proposito:
   no es un error, es una aclaracion. */
.nojs-aviso {
  max-width: 62ch;
  margin: 0 0 1.6rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--texto-3);
  line-height: 1.5;
}

/* La ficha que la Function de certificados sirve cuando se entra a una URL de
   certificado sin JavaScript. Ahi es la pagina entera, no un agregado, asi
   que va centrada como el visor que veria alguien con JavaScript. */
.nojs-cert {
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}

.nojs-cert h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.3rem);
  line-height: 1.15;
  margin: 0;
}

.nojs-cert p {
  margin: 0;
  color: var(--muted);
}

.nojs-cert-scan {
  width: 100%;
  max-width: 760px;
  height: auto;
  margin: 0.6rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.nojs-cert-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

/* Un grupo lista sus partes en vez de mostrar un escaneo. */
.nojs-cert .nojs {
  padding-left: 0;
  justify-items: center;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* Todo salta directo a como termina. Una animacion de 0 s igual dispara
     animationend, y la cascada de certificados lo necesita para soltar la
     tarjeta que se va. */
  *,
  *::before,
  *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }

  .project-card::after {
    animation: none;
  }

  .term-out-line,
  .term-out-line.out-dim {
    opacity: 1;
    translate: none;
    animation: none;
  }

  .term-typing.is-idle .term-cmd::after {
    animation: none;
  }
}

/* Los temas de contraste de Windows cambian la paleta, fondos incluidos, y
   lo dibujado con background sin texto desaparece. Con un color del sistema
   vuelve. Va al final para ganarle a las reglas de mas arriba. */
@media (forced-colors: active) {
  .menu-toggle span,
  .timeline-item::before,
  .term-dots i,
  .term-dots i:first-child,
  .term-typing .term-cmd::after {
    /* Sin esto Chromium pisa tambien el fondo que ya es un color del
       sistema, y siguen sin verse. */
    forced-color-adjust: none;
    background: CanvasText;
  }

  /* La pregunta hecha se marca con el acento, que tampoco existe ahi. */
  .term-key[aria-current="true"] {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  /* Las etiquetas de proyecto son texto sobre un fondo, y el fondo se va. Un
     contorno las vuelve a separar, como el borde que ya tienen las de
     habilidades, sin moverlas de lugar. */
  .project-tags li {
    outline: 1px solid CanvasText;
    outline-offset: -1px;
  }

  /* El marco de la lupa es fondo y sombra, y aca no queda ninguno. */
  .viewer-lupa {
    border: 2px solid CanvasText;
  }

  /* El idioma activo se distingue por el color del acento, que ahi no existe:
     los dos quedan en CanvasText y el selector deja de decir donde estas. */
  .lang-toggle .is-active {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}
