/* ==========================================================
   Tokens — claro: Azul notarial · oscuro: Noche
   ========================================================== */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #0F1B2D;
  --muted: #4F5B6B;
  --line: #D5DAE1;
  --accent: #1C3A5E;
  --on-accent: #FFFFFF;
  --shade: #9DB0C7;

  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;

  /* Escala de texto: un tamaño por función, igual en todas las secciones */
  --t-text: 1.0625rem;   /* texto de lectura */
  --t-lead: 1.1875rem;   /* bajada de Inicio */
  --t-h3: 1.875rem;     /* títulos internos */
  --t-h3-row: 1.4375rem; /* títulos de la lista de Servicios */
  --t-label: 0.8125rem;  /* etiquetas en mayúsculas (mono) */
  --t-tag: 0.875rem;    /* tecnologías, fechas e idioma (mono) */

  --rail-w: 360px;
  --slide-pad-x: clamp(32px, 6vw, 104px);
  --slide-pad-y: clamp(40px, 7vh, 72px);
  --ease: cubic-bezier(.65, 0, .35, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 8px 20px -10px rgba(15, 27, 45, .45);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0F141B;
  --surface: #151C25;
  --ink: #E7E9EC;
  --muted: #9AA3AE;
  --line: #263040;
  --accent: #AFC3DA;
  --on-accent: #0F141B;
  --shade: #34465F;
  --shadow: 0 8px 20px -10px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F141B;
    --surface: #151C25;
    --ink: #E7E9EC;
    --muted: #9AA3AE;
    --line: #263040;
    --accent: #AFC3DA;
    --on-accent: #0F141B;
    --shade: #34465F;
    --shadow: 0 8px 20px -10px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

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

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden; /* sin scroll vertical: las secciones pasan al costado */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:hover { opacity: .75; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }

h1, h2, h3, h4, p { margin: 0; }
p, li { text-wrap: pretty; } /* sin una palabra sola en el último renglón */

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  z-index: 20;
}
.skip-link:focus { left: 8px; }

/* Recuadro abierto: esquinas superior-izquierda e inferior-derecha */
.frame { position: relative; }
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: var(--corner, 24px);
  height: var(--corner, 24px);
  pointer-events: none;
}
.frame::before {
  top: 0; left: 0;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}
.frame::after {
  bottom: 0; right: 0;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

/* ==========================================================
   Botones y etiquetas
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: .3px;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
/* Sube un poco al pasar el mouse y se hunde al hacer clic */
.btn:hover { opacity: 1; }
@media (hover: hover) {
  .btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
}
.btn:active { transform: translateY(0) scale(.98); box-shadow: none; transition-duration: .08s; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn-sm { min-height: 48px; padding: 0 22px; font-size: 1rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}

.actions { display: flex; flex-wrap: wrap; gap: 16px; }

.text-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
}
.text-link:hover { opacity: 1; }
/* La flecha avanza: → hacia la derecha, ↗ en diagonal */
.text-link [aria-hidden="true"] { display: inline-block; transition: transform .25s var(--ease-out); }
@media (hover: hover) {
  .text-link:hover [aria-hidden="true"] { transform: translateX(4px); }
  .text-link[target="_blank"]:hover [aria-hidden="true"] { transform: translate(3px, -3px); }
}

/* Subrayado que crece de izquierda a derecha */
.rail-contact a,
.contact-list a {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0 1px;
  transition: background-size .3s var(--ease-out);
}
.rail-contact a:hover,
.contact-list a:hover { opacity: 1; background-size: 100% 1px; }

/* ==========================================================
   Estructura: columna fija + escenario
   ========================================================== */
.shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ---------- Columna ---------- */
.rail {
  flex: 0 0 var(--rail-w);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 56px 40px 32px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.rail-head { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* Los ⋮ van fijos a la derecha: el ancho del nombre cambia con cada tipografía y no los mueve */
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.rail-name {
  --name-size: 2rem;
  flex: none;
  font-family: var(--serif);
  font-size: calc(var(--name-size) * var(--fit, 1)); /* typeplay.js achica con --fit si no entra */
  font-weight: 600;
  line-height: 1.05;
  text-decoration: none;
  white-space: nowrap;
}
.rail-role {
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  text-wrap: balance; /* si no entra en un renglón, corta parejo y no deja ".NET" solo */
}

/* Lista de secciones: la actual en grande, con ‹ › en su fila */
.sections ol {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sections li { display: flex; align-items: center; }
.sections li a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding-left: 44px; /* alinea con el texto de la actual, que va después de la ‹ */
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease, translate .3s var(--ease-out);
}
.sections li a:hover { color: var(--ink); opacity: 1; }
/* Al pasar el mouse, la sección se corre un poco hacia la derecha */
@media (hover: hover) { .sections li:not(.is-current) a:hover { translate: 6px 0; } }

.sections li.is-current { margin: 8px 0; }
.sections li.is-current a {
  padding-left: 0;
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.05;
  color: var(--ink);
  white-space: nowrap;
  animation: settle .5s var(--ease-out);
}
/* Al elegirla, la sección entra deslizándose desde la izquierda */
@keyframes settle {
  from { opacity: 0; transform: translateX(-12px); }
}

.chev {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  transition: translate .25s var(--ease-out);
}
.chev-prev { justify-content: flex-start; }
.chev-next { margin-left: 4px; }
/* Cada flecha se asoma hacia su lado */
@media (hover: hover) {
  .chev-prev:hover { translate: -4px 0; }
  .chev-next:hover,
  .next-btn:hover { translate: 4px 0; }
}
/* main.js mueve las flechas a la fila nueva: aparecen con un fundido */
.sections li.is-current .chev { animation: chev-in .5s var(--ease-out); }
@keyframes chev-in {
  from { opacity: 0; }
}
.chev[hidden] { display: inline-flex; visibility: hidden; }
.sections > .chev { display: none; } /* hasta que main.js las mueva a la fila actual */

.rail-foot { display: flex; flex-direction: column; gap: 14px; }
.rail-contact { display: flex; flex-direction: column; gap: 2px; font-size: 1rem; }
.rail-contact a { align-self: flex-start; text-decoration: none; color: var(--accent); }
.rail-tools { display: flex; align-items: center; gap: 8px; }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: var(--t-tag);
  letter-spacing: 1px;
  color: var(--muted);
}
.lang-switch button {
  min-width: 40px;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.lang-switch button:hover,
.lang-switch button[aria-pressed="true"] { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { font-weight: 500; }

.theme-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }
.theme-toggle.is-dark .icon-moon { display: none; }

/* ---------- Escenario ---------- */
.stage {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  overflow: hidden;
  outline: none;
}

.track {
  display: flex;
  height: 100%;
  transition: transform .6s var(--ease);
  will-change: transform;
}

.slide {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto; /* solo por si la ventana es muy baja */
  overscroll-behavior: contain;
}
.slide-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--slide-pad-y) var(--slide-pad-x) calc(var(--slide-pad-y) + 48px);
}

.next-btn {
  position: absolute;
  right: var(--slide-pad-x);
  bottom: 36px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--accent);
  background: none;
  color: var(--accent);
  cursor: pointer;
  transition: translate .25s var(--ease-out);
}
.next-btn[hidden] { display: none; }

/* Entrada escalonada: main.js marca los elementos (.reveal, con su orden en
   --i) y activa la sección actual con .is-active */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(14px);
  }
  .slide.is-active .reveal {
    opacity: 1;
    transform: none;
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
    transition-delay: calc(180ms + var(--i, 0) * 80ms);
  }
}

@media (prefers-reduced-motion: reduce) {
  .track { transition: none; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================
   Inicio
   ========================================================== */
/* Los espacios de Inicio se achican con el alto de la ventana: en una pantalla
   baja entra todo sin scroll, en una alta queda como siempre */
#inicio .eyebrow { margin-bottom: clamp(14px, 3vh, 28px); }
#inicio .lead { margin-top: clamp(16px, 3vh, 28px); }
#inicio .status { margin-top: clamp(24px, 5.5vh, 56px); padding-top: clamp(14px, 2.6vh, 24px); }
@media (min-width: 861px) {
  /* el ‹siguiente› va abajo a la derecha y el texto de Inicio no llega hasta ahí */
  #inicio .slide-inner { padding-bottom: calc(var(--slide-pad-y) + 12px); }
}
.hero-title {
  max-width: 880px;
  font-family: var(--serif);
  font-weight: 500;
  /* Crece parejo con la ventana, sin saltos entre tamaños de pantalla. Si una
     tipografía de typeplay es más ancha y pasa a dos renglones, typeplay.js
     reserva desde el principio el alto de la más alta. */
  font-size: clamp(2.125rem, calc(2.6vw + 1.5rem), 4rem);
  text-wrap: balance;
  line-height: 1.04;
  letter-spacing: -0.5px;
}
.hero-sub {
  margin-top: 18px;
  text-wrap: balance; /* si corta, que no quede "IA a medida" sola */
  font-family: var(--mono);
  font-size: var(--t-label);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.lead {
  margin-top: 28px;
  max-width: 700px;
  font-size: var(--t-lead);
  color: var(--muted);
}
#inicio .actions { margin-top: clamp(22px, 4.5vh, 44px); }

.status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 40px;
  margin: 56px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: var(--t-text);
  color: var(--muted);
}
.status li { display: flex; align-items: center; gap: 10px; }
.status strong { color: var(--ink); font-weight: 600; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ==========================================================
   Listas de filas (Servicios y Habilidades)
   ========================================================== */
.rows {
  max-width: 1100px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 48px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.row > h3 {
  flex: 0 0 260px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--t-h3-row);
  line-height: 1.2;
}
.row-body {
  flex: 999 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--t-text);
  line-height: 1.55;
  color: var(--muted);
}
.row-example { color: var(--ink); }

/* Habilidades: título chico, solo las tecnologías */
.rows-compact .row { padding: 16px 0; align-items: center; }
.rows-compact .row > h3 {
  flex-basis: 260px;
  font-family: var(--mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.rows-compact .techs { flex: 999 1 420px; min-width: 0; }

/* Etiquetas de tecnología con ícono */
.techs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.techs li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--mono);
  font-size: var(--t-tag);
  color: var(--ink);
}
.techs img { width: 20px; height: 20px; flex: 0 0 20px; }

/* Íconos negros (Unity, Three.js): se invierten en modo oscuro */
:root[data-theme="dark"] .techs img.mono { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .techs img.mono { filter: invert(1); }
}

/* ==========================================================
   Proyectos
   ========================================================== */
.projects { display: flex; flex-wrap: wrap; gap: 40px 48px; }
.project {
  flex: 1 1 340px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.project-media {
  overflow: hidden; /* recorta el zoom de la captura */
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.project-shot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  transition: transform .6s var(--ease-out);
}
@media (hover: hover) { .project:hover .project-shot { transform: scale(1.03); } }
.project-shot.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 600;
  font-style: italic;
  color: var(--shade);
}
.project h3 { font-family: var(--serif); font-weight: 600; font-size: var(--t-h3); line-height: 1.1; }
.project p { font-size: var(--t-text); color: var(--muted); }
.project .stack { font-family: var(--mono); font-size: var(--t-tag); color: var(--ink); }

/* ==========================================================
   Experiencia
   ========================================================== */
.timeline { max-width: 940px; margin: 0; padding: 0; list-style: none; }
.tl-item { display: flex; flex-wrap: wrap; gap: 8px 40px; }
.tl-years {
  flex: 0 0 150px;
  padding-top: 6px;
  font-family: var(--mono);
  font-size: var(--t-tag);
  color: var(--muted);
}
.tl-body {
  flex: 999 1 420px;
  min-width: 0;
  position: relative;
  padding: 0 0 36px 36px;
  border-left: 1px solid var(--line);
}
.tl-item:last-child .tl-body { padding-bottom: 0; }
.tl-body::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 11px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--accent);
}
.tl-body h3 { font-family: var(--serif); font-weight: 600; font-size: var(--t-h3); line-height: 1.2; }
.tl-org { margin-top: 2px; font-size: var(--t-text); font-weight: 500; color: var(--accent); }
.tl-body ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: var(--t-text);
  color: var(--muted);
}

/* ==========================================================
   Habilidades
   ========================================================== */
.languages { margin-top: 28px; font-size: var(--t-text); color: var(--muted); }
.languages + .languages { margin-top: 8px; }
.languages strong { color: var(--ink); font-weight: 600; }

/* ==========================================================
   Contacto
   ========================================================== */
.contact { display: flex; flex-wrap: wrap; gap: 48px; max-width: 1100px; }
.contact h3 { font-family: var(--serif); font-weight: 600; font-size: var(--t-h3); }

.contact-form {
  flex: 1.2 1 400px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.contact-form > .muted { margin-top: -6px; font-size: var(--t-text); }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row label { flex: 1 1 200px; }
.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.contact-form input,
.contact-form textarea {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 400;
}
.contact-form textarea { padding-block: 12px; resize: vertical; }
.contact-form input:focus,
.contact-form textarea:focus { border-color: var(--accent); }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible { outline-offset: 0; }

.form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.form-status { font-size: var(--t-text); color: var(--muted); }

.contact-card {
  --corner: 28px;
  flex: 1 1 300px;
  min-width: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
}
.contact-card h3 { margin-bottom: 6px; }
.contact-card .muted { font-size: var(--t-text); }

.contact-list { display: flex; flex-direction: column; gap: 12px; margin: 0; font-size: var(--t-text); }
.contact-list div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.contact-list dt { color: var(--muted); }
.contact-list dd { margin: 0; }
.contact-list a { text-decoration: none; }

/* ==========================================================
   Tipografías que juegan (js/typeplay.js)
   ========================================================== */
/* Tres puntitos al lado del nombre y su menú */
.tp-ctrls { flex: none; display: flex; }
.tp-btn {
  flex: none;
  width: 30px; /* dos botones angostos: así el nombre no se achica */
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
}
.tp-btn:hover,
.tp-dots[aria-expanded="true"],
.tp-pause[aria-pressed="true"] { color: var(--ink); border-color: var(--line); }
.tp-btn[hidden] { display: none; }
.tp-pause .i-play,
.tp-pause[aria-pressed="true"] .i-pause { display: none; }
.tp-pause[aria-pressed="true"] .i-play { display: block; }
/* Pausado: también se frena el estirón de la Tonada */
.tp-paused .tp-s-tonada[data-ton] .tp-g { animation-play-state: paused; }

.tp-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 30;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tp-menu[hidden] { display: none; }
.tp-label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.tp-label + .tp-chips { margin-bottom: 8px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-chip {
  min-height: 44px;
  padding: 2px 10px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.3;
  cursor: pointer;
}
.tp-chip:hover { border-color: var(--accent); }
.tp-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
/* Estilos: lista con vista previa («Sergio» en cada letra); se ven cuatro filas y el resto se scrollea */
.tp-list {
  display: flex;
  flex-direction: column;
  max-height: calc(46px * 4 + 2px); /* + el borde de la lista */
  margin-bottom: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory; /* al scrollear siempre quedan filas enteras */
  border: 1px solid var(--line);
}
.tp-item {
  flex: none;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tp-item:last-child { border-bottom: 0; }
.tp-item:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tp-item[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tp-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tp-item::after { content: ""; flex: none; width: 14px; color: var(--accent); font-size: 0.9375rem; text-align: center; }
.tp-item[aria-pressed="true"]::after { content: "✓" / ""; }
.tp-prev { flex: 1; min-width: 0; font-size: 1.375rem; line-height: 1; white-space: nowrap; }
.tp-name { font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }
/* En la lista cada letra va sin el factor que la achica en el título */
.tp-prev .tp-g { font-size: 1em; }
.tp-prev.tp-s-sm .tp-g { font-size: .86em; }
.tp-prev.tp-s-letras .tp-g { font-size: .95em; }
.tp-prev.tp-s-code .tp-g { font-size: .84em; }
.tp-prev.tp-s-flutter .tp-g { font-size: .8em; }
.tp-prev.tp-s-vb6 .tp-g { font-size: 1em; }
.tp-prev.tp-s-sql .tp-g,
.tp-prev.tp-s-grano .tp-g,
.tp-prev.tp-s-filete .tp-g,
.tp-prev.tp-s-cromo .tp-g { font-size: .95em; }
.tp-prev.tp-s-cad .tp-g::after { display: none; }
.tp-prev.tp-s-tonada .tp-g { font-size: .9em; }
/* Arriba: la aclaración del modo y, a la derecha, el botón de restablecer */
.tp-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.tp-hint { font-size: 0.875rem; line-height: 1.4; color: var(--muted); }
.tp-reset {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -12px -12px 0 0;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  color: var(--accent);
  cursor: pointer;
}
.tp-reset:hover { border-color: var(--line); }
.tp-reset:hover svg { transform: rotate(-120deg); }
.tp-reset svg { transition: transform .35s ease; }
@media (prefers-reduced-motion: reduce) { .tp-reset svg { transition: none; } }

/* Letras: el texto real queda en .sr-only y cada letra visible se dibuja con ::before */
.tp-text { perspective: 700px; }
.tp-fixed { white-space: nowrap; } /* el título corta en los <br> que pone typeplay.js */
.tp-w { display: inline-block; white-space: nowrap; }
.tp-ch { display: inline-block; }
.tp-g { display: inline-block; position: relative; transition: color .3s; }
.tp-g[data-c]::before { content: attr(data-c); }
.is-free .tp-ch { cursor: pointer; }
.is-free .tp-g { transition: color .2s, translate .2s var(--ease-out); }
.is-free .tp-ch:hover .tp-g { color: var(--accent); translate: 0 -3px; }

/* Un estilo por tecnología. --tp-k-* lo calcula typeplay.js midiendo cada fuente para que
   su mayúscula mida lo mismo que la de la Cormorant; el número de respaldo es aproximado */
.tp-s-letras .tp-g { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 900; font-size: calc(var(--tp-k-letras, .89) * 1em); }
.tp-s-code .tp-g {
  font-family: 'Major Mono Display', ui-monospace, Consolas, monospace;
  font-weight: 400; font-size: calc(var(--tp-k-code, .9) * 1em); color: var(--accent);
}
/* VB6: la Courier del editor de Visual Basic 6, con ".NET" como palabra clave */
.tp-s-vb6 .tp-g {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-weight: 700; font-size: calc(var(--tp-k-vb6, 1.08) * 1em);
}
.tp-s-vb6[data-kw] .tp-g { color: var(--accent); }
.tp-s-flutter .tp-g { font-family: 'Unbounded', system-ui, sans-serif; font-weight: 900; font-size: calc(var(--tp-k-flutter, .86) * 1em); }
.tp-s-cad .tp-g {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  font-weight: 600; font-size: calc(var(--tp-k-cad, .92) * 1em);
  color: transparent; -webkit-text-stroke: 1.1px var(--accent);
}
.tp-s-cad .tp-g::after { /* línea de cota bajo cada letra */
  content: "";
  position: absolute;
  left: 6%; right: 6%; bottom: .02em;
  height: .14em;
  border: 1px solid var(--muted);
  border-top: 0;
  opacity: .55;
}
.tp-s-sql .tp-g {
  font-family: 'Anton', Impact, sans-serif;
  font-weight: 400; font-size: calc(var(--tp-k-sql, .74) * 1em); text-transform: uppercase;
}
/* SM: la letra personal de Sergio */
.tp-s-sm .tp-g { font-family: 'Syne', system-ui, sans-serif; font-weight: 700; font-size: calc(var(--tp-k-sm, .76) * 1em); letter-spacing: -.02em; }

/* Filete porteño: Rye dorada con filete rojo y verde; los firuletes aparecen solo
   cuando toda la frase está en filete (typeplay.js pone .is-filete) */
:root {
  --fil-face: #E3A92E; --fil-edge: #3A1A0E; --fil-s1: #B3261E; --fil-s2: #1F6B45;
  --fil-stem: #B3261E; --fil-leaf: #1F6B45; --fil-line: #FFF3D1; --fil-dot: #E3A92E;
}
.tp-s-filete .tp-g {
  font-family: 'Rye', Georgia, serif; font-weight: 400; font-size: calc(var(--tp-k-filete, .72) * 1em);
  color: var(--fil-face);
  -webkit-text-stroke: .014em var(--fil-edge);
  paint-order: stroke fill;
  text-shadow: .035em .035em 0 var(--fil-s1), .07em .07em 0 var(--fil-s2);
}
.tp-firu { display: none; position: absolute; overflow: visible; pointer-events: none; }
.is-filete > .tp-text { display: inline-block; position: relative; }
.is-filete .tp-firu { display: block; animation: tp-firu-in .5s var(--ease-out) both; }
.tp-firu-a { right: 1.9em; top: -1.02em; width: 1.9em; height: .95em; transform: scaleY(-1); }
.is-filete .tp-firu-r { display: inline-block; position: static; width: 1.6em; height: .8em; margin-left: .12em; vertical-align: -.05em; }
.hero-title .tp-firu-r { margin-right: -1.72em; } /* no suma ancho: no hace saltar de renglón */
@keyframes tp-firu-in { from { opacity: 0; } }

/* Cartel (título de Inicio): cada palabra en su renglón, agrandada hasta llenar el
   ancho (typeplay.js calcula el tamaño de cada renglón). Los renglones y las letras
   se pisan a propósito; nada se sale de la ventana. */
.hero-title.is-cartel { max-width: none; line-height: .82; letter-spacing: 0; text-wrap: nowrap; }
.is-cartel > .tp-text { display: block; }
.tp-line { display: block; width: max-content; white-space: nowrap; }
.tp-line:first-child { margin-top: .16em; } /* las letras altas no tocan lo de arriba */
.is-cartel .tp-ch { margin-right: -.03em; }
/* Las letras lisas llevan un borde del color del fondo: donde se pisan, se separan */
.is-cartel .tp-ch:not(.tp-s-filete):not(.tp-s-cad):not(.tp-s-cromo):not(.tp-s-grano) .tp-g {
  -webkit-text-stroke: .035em var(--tp-gap, var(--bg)); /* --tp-gap: el color de lo que hay detrás */
  paint-order: stroke fill;
}
.is-cartel .tp-firu-r { margin-right: 0; } /* suma ancho: así entra en la cuenta del cartel */
/* Toda la frase en VB6: la ventana de código del IDE (blanca, con el borde hundido de
   Windows). Va detrás del texto y por fuera de su caja, así no cambia ninguna medida */
.is-cartel.is-vb6 > .tp-text { position: relative; isolation: isolate; }
.is-cartel.is-vb6 > .tp-text::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -.14em -.24em -.2em;
  background: #FFFFFF;
  box-shadow: inset 1px 1px 0 #808080, inset 2px 2px 0 #404040, inset -1px -1px 0 #FFFFFF, inset -2px -2px 0 #DFDFDF;
  animation: tp-firu-in .4s var(--ease-out) both;
}
.is-cartel.is-vb6 { --tp-gap: #FFFFFF; }
.is-cartel.is-vb6 .tp-s-vb6 .tp-g { color: #000000; }
.is-cartel.is-vb6 .tp-s-vb6[data-kw] .tp-g { color: #00007F; }

/* Desborde (solo escritorio; en celular queda como el cartel): todos los renglones del
   mismo tamaño gigante (typeplay.js), pisados a la mitad y cortados en el borde
   derecho. El primero tapa la línea de arriba a propósito. */
#inicio { overflow-x: hidden; } /* lo que se corta en el borde no da scroll de costado */
@media (min-width: 861px) {
  .hero-title.is-desborde { line-height: .62; }
  .is-desborde .tp-line:first-child { margin-top: 0; }
  .is-desborde .tp-line:last-child { margin-bottom: .16em; } /* las patas del último no tocan lo de abajo */
  .is-desborde .tp-ch { margin-right: -.02em; }
  /* VB6: sin la ventana del IDE, que no puede seguir a los renglones cortados */
  .is-desborde.is-vb6 > .tp-text::before { display: none; }
  .is-desborde.is-vb6 { --tp-gap: var(--bg); }
  .is-desborde.is-vb6 .tp-s-vb6 .tp-g { color: inherit; }
  .is-desborde.is-vb6 .tp-s-vb6[data-kw] .tp-g { color: var(--accent); }
}

/* Tonada cordobesa: la vocal que va antes de la sílaba acentuada (typeplay.js le pone
   data-ton) se estira y vuelve, como el cantito. Anybody tiene ancho variable (50–150%) */
.tp-s-tonada .tp-g {
  font-family: 'Anybody', system-ui, sans-serif; font-weight: 800; font-stretch: 100%;
  font-size: calc(var(--tp-k-tonada, .78) * 1em); letter-spacing: -.01em;
}
.tp-s-tonada[data-ton] .tp-g,
.tp-prev.tp-s-tonada .tp-ton { color: var(--accent); font-stretch: 140%; }
@media (prefers-reduced-motion: no-preference) {
  .tp-s-tonada[data-ton] .tp-g,
  .tp-prev.tp-s-tonada .tp-ton { animation: tp-tonada 2.6s cubic-bezier(.65, 0, .35, 1) infinite alternate; }
}
@keyframes tp-tonada { from { font-stretch: 100%; } to { font-stretch: 150%; } }
/* Al medir, estirada del todo: así el renglón y el cartel ya tienen lugar para el estirón */
.tp-measuring .tp-s-tonada[data-ton] .tp-g { animation: none; font-stretch: 150%; }

/* Cromo: la letra redonda solo da la silueta; el filtro SVG (typeplay.js lo arma
   según el tamaño real) la infla, le marca surcos y la ilumina como metal */
.tp-s-cromo .tp-g {
  font-family: 'Fredoka', 'Arial Rounded MT Bold', system-ui, sans-serif; font-weight: 700; font-size: calc(var(--tp-k-cromo, .62) * 1em);
  letter-spacing: .1em; color: #000;
  filter: url(#tp-chrome-hero);
}
.rail-name .tp-s-cromo .tp-g { letter-spacing: .06em; filter: url(#tp-chrome-name); }
.tp-menu .tp-s-cromo .tp-g { letter-spacing: .06em; filter: url(#tp-chrome-menu); }

/* Grano: bloque con extrusión honda (::after, detrás), cara en degradé (::before) y grano encima */
.tp-s-grano .tp-g {
  --tp-ext: .016em .018em 0 #4839ed, .032em .037em 0 #4535e8, .048em .055em 0 #4132e4, .064em .074em 0 #3e2edf, .08em .092em 0 #3a2bda, .096em .11em 0 #3728d2, .112em .129em 0 #3426c9, .128em .147em 0 #3023c1, .144em .166em 0 #2d21b8, .16em .184em 0 #2a1eb0, .176em .202em 0 #271ba6, .192em .221em 0 #24199d, .208em .239em 0 #201693, .224em .258em 0 #1d148a, .24em .276em 0 #1a1180, .256em .294em 0 #170f74, .272em .313em 0 #140d68, .288em .331em 0 #120b5d, .304em .35em 0 #0f0951, .32em .368em 0 #0c0745, .34em .418em .08em rgba(10,6,40,.4);
  font-family: 'Archivo Black', 'Arial Black', sans-serif; font-weight: 400; font-size: calc(var(--tp-k-grano, .55) * 1em);
  letter-spacing: .05em;
  isolation: isolate;
  filter: url(#tp-grain);
}
.rail-name .tp-s-grano .tp-g,
.tp-menu .tp-s-grano .tp-g {
  --tp-ext: .02em .023em 0 #4636ea, .04em .046em 0 #4031e2, .06em .069em 0 #3a2bda, .08em .092em 0 #3527cc, .1em .115em 0 #2f22be, .12em .138em 0 #2a1eb0, .14em .161em 0 #251aa0, .16em .184em 0 #1f1590, .18em .207em 0 #1a1180, .2em .23em 0 #150e6c, .22em .253em 0 #110a59, .24em .276em 0 #0c0745, .26em .326em .08em rgba(10,6,40,.4);
}
.tp-s-grano .tp-g::before {
  color: transparent;
  background-image: radial-gradient(130% 150% at 12% 0%, #FFE0F7 0%, #FFB3EE 25%, #D59BFF 52%, #8D7CFF 78%, #5F5BFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.tp-s-grano .tp-g::after {
  content: attr(data-c);
  position: absolute;
  left: 0; top: 0;
  z-index: -1;
  color: #2A1EB0;
  text-shadow: var(--tp-ext);
}


/* ==========================================================
   Pantallas medianas: columna más angosta
   ========================================================== */
@media (max-width: 1180px) {
  :root { --rail-w: 300px; }
  .rail { padding-inline: 32px; }
  .rail-name { --name-size: 1.8125rem; }
  .sections li.is-current a { font-size: 2.125rem; }
}

/* ==========================================================
   Celular: la columna pasa a ser una barra arriba
   ========================================================== */
@media (max-width: 860px) {
  .shell { flex-direction: column; }

  .rail {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 12px;
    padding: 12px 16px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .rail-head { grid-column: 1; }
  .rail-name { --name-size: 1.375rem; }
  .rail-name .tp-firu, .hero-title .tp-firu-r { display: none; } /* en celular no hay lugar al costado */
  .rail { position: relative; z-index: 5; } /* el menú ⋮ queda encima del escenario */
  .tp-menu { width: min(320px, calc(100vw - 32px)); }
  .rail-role { display: none; }
  .rail-foot { grid-column: 2; grid-row: 1; }
  .rail-contact { display: none; }
  .sections { grid-column: 1 / -1; }
  .sections li:not(.is-current) { display: none; }
  .sections li.is-current { margin: 0; }
  .sections li.is-current a { font-size: 1.75rem; }

  :root { --slide-pad-x: 16px; --slide-pad-y: 28px; }
  .slide-inner { justify-content: flex-start; padding-bottom: 96px; }
  .next-btn { right: 16px; bottom: 16px; background: var(--bg); }
}

