/* [Added by Claude] Rediseño 2026-10.
   Una sola idea animada: la señal. Recorre la ruta de la petición en el hero
   y luego baja por la columna de secciones conforme haces scroll.
   Sin JS todo queda visible y encendido; con reduced-motion no hay viajes. */

@font-face {
  font-family: "Plex Sans";
  src: url("fonts/plex-sans-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plex-mono-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* noche índigo + rosa mexicano de las fachadas de Mérida; el ámbar es solo
     para lo que está "vivo": el paquete en tránsito y los tiempos medidos */
  --paper: #17153a;
  --sunk: #211e4d;
  --ink: #f3eefc;
  --soft: #b9b2d9;
  --rule: #34306b;
  --signal: #ff5c8a;
  --signal-dim: rgba(255, 92, 138, 0.25);
  --amber: #ffb84d;
  --glow: rgba(255, 92, 138, 0.55);

  --sans: "Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --shelf: 66rem;
  --spine-x: 5px;
  --ease-out: cubic-bezier(0.16, 0.84, 0.24, 1);

  /* tiempos de la traza del hero */
  --t0: 1.05s;
  --hop: 0.8s;
}

@media (prefers-color-scheme: light) {
  :root {
    --paper: #f7f4fb;
    --sunk: #ece6f6;
    --ink: #1b1840;
    --soft: #554f80;
    --rule: #d9d1ea;
    --signal: #c8195a;
    --signal-dim: rgba(200, 25, 90, 0.18);
    --amber: #a35f00;
    --glow: rgba(200, 25, 90, 0.35);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

::selection {
  background: var(--signal);
  color: var(--paper);
}

/* ---------- shared shelf ---------- */

.topbar,
.hero,
.band,
.foot {
  max-width: var(--shelf);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.skip:focus {
  left: 0;
}

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem 0;
}

.topbar-id {
  margin: 0;
  font-size: 0.875rem;
  color: var(--soft);
}

.langswitch {
  display: flex;
  gap: 0.25rem;
}

.langbtn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.2rem 0.45rem;
  font: inherit;
  font-size: 0.875rem;
  color: var(--soft);
  cursor: pointer;
  background-image: linear-gradient(var(--signal), var(--signal));
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 0% 2px;
  transition: background-size 0.3s var(--ease-out), color 0.2s;
}

.langbtn:hover {
  color: var(--ink);
}

.langbtn[aria-pressed="true"] {
  color: var(--ink);
  background-size: 100% 2px;
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(3rem, 9vh, 6rem) 3rem;
}

.name {
  margin: 0;
  font-size: clamp(2.3rem, 8.6vw, 5.6rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

/* cada línea es una ventana; el texto sube desde abajo de ella */
.name-line {
  display: block;
  overflow: hidden;
  padding-block: 0.08em 0.04em;
}

.name-line > span {
  display: block;
  animation: rise 1s var(--ease-out) both;
}

.name-line + .name-line > span {
  animation-delay: 0.12s;
  color: var(--signal);
}

.hero-role {
  margin: 1.4rem 0 0;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  font-weight: 600;
  animation: fade 0.8s ease 0.45s both;
}

.hero-lede {
  margin: 1rem 0 0;
  max-width: 52ch;
  font-size: clamp(1.02rem, 2.1vw, 1.2rem);
  color: var(--soft);
  animation: fade 0.8s ease 0.55s both;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin: 1.9rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
  animation: fade 0.8s ease 0.65s both;
}

/* ---------- the trace ---------- */

.trace {
  margin: 4rem 0 0;
  padding: 2rem clamp(1.1rem, 3vw, 2rem) 1.6rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--sunk);
  animation: fade 0.8s ease 0.8s both;
}

.hops {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hop {
  --i: 0;
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 2.1rem 1.2rem 0 0;
}

.hop:last-child {
  flex: 0 0 auto;
  padding-right: 0;
}

.hop:nth-child(2) { --i: 1; }
.hop:nth-child(3) { --i: 2; }
.hop:nth-child(4) { --i: 3; }

.hop-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--signal);
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-dim), 0 0 18px var(--glow);
  animation: lit 0.45s ease both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop));
}

/* onda que sale del nodo cuando el paquete llega */
.hop-dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--signal);
  opacity: 0;
  animation: ping 0.9s ease-out both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop));
}

.hop-k {
  display: block;
  font-family: var(--mono);
  font-size: clamp(0.9rem, 1.7vw, 1.05rem);
  color: var(--ink);
  animation: fade 0.5s ease both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop));
}

.hop-v {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--soft);
  max-width: 22ch;
  animation: fade 0.5s ease both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop) + 0.1s);
}

.wire {
  position: absolute;
  top: 6.5px;
  left: calc(15px + 0.7rem);
  right: 0.7rem;
  height: 2px;
  background: var(--rule);
  border-radius: 2px;
}

.wire-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--signal), var(--signal) 70%, var(--amber));
  transform-origin: 0 50%;
  animation: fill-x 0.65s cubic-bezier(0.5, 0, 0.3, 1) both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop) + 0.12s);
}

.packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 6px;
  margin: -3px 0 0 -9px;
  border-radius: 3px;
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber), 0 0 3px var(--amber);
  opacity: 0;
  animation: travel-x 0.65s cubic-bezier(0.5, 0, 0.3, 1) both;
  animation-delay: calc(var(--t0) + var(--i) * var(--hop) + 0.12s);
}

.trace figcaption {
  margin-top: 1.9rem;
  font-size: 0.9rem;
  color: var(--soft);
}

.trace figcaption > span:first-child {
  display: block;
  max-width: 62ch;
}

.trace-read {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink);
  animation: fade 0.6s ease both;
}

.trace-read[hidden] {
  display: none;
}

.trace-read b {
  font-weight: 400;
  color: var(--amber);
}

.replay {
  appearance: none;
  margin-top: 1.1rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.replay:hover {
  border-color: var(--signal);
  background: var(--signal-dim);
}

.replay[hidden] {
  display: none;
}

/* reinicio: JS pone .rewind un frame para que las animaciones vuelvan a cero */
.trace.rewind *,
.trace.rewind *::after {
  animation: none !important;
}

/* si la traza no se ve al cargar, espera a que entre en pantalla */
.trace.waiting *,
.trace.waiting *::after {
  animation-play-state: paused !important;
}

/* ---------- bands + spine ---------- */

.bands {
  padding-top: 2rem;
}

.band {
  --p: 1;
  position: relative;
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0 3rem;
  padding-block: 2.8rem;
}

/* el cable: pista apagada + relleno que sigue al scroll */
.band::before,
.band::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--gutter) + var(--spine-x) - 1px);
  width: 2px;
}

.band::before {
  background: var(--rule);
}

.band::after {
  background: linear-gradient(to bottom, var(--signal-dim), var(--signal) 80%, var(--amber));
  transform-origin: 50% 0;
  transform: scaleY(var(--p));
}

.rail {
  position: relative;
}

.rail h2 {
  position: sticky;
  top: 28vh;
  margin: 0;
  padding-left: 1.9rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--soft);
  transition: color 0.4s;
}

.rail h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.38em;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--rule);
  background: var(--paper);
  z-index: 1;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.4s;
}

.band.on .rail h2 {
  color: var(--ink);
}

.band.on .rail h2::before {
  border-color: var(--signal);
  background: var(--signal);
  box-shadow: 0 0 0 4px var(--signal-dim), 0 0 14px var(--glow);
}

.col {
  min-width: 0;
}

/* ---------- entries ---------- */

.entry {
  max-width: 66ch;
}

.entry + .entry {
  margin-top: 2.6rem;
}

.entry h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
}

.entry-meta {
  margin: 0.3rem 0 0;
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.9rem;
}

.entry-org {
  color: var(--signal);
}

.entry-when {
  color: var(--soft);
}

.entry-note {
  margin: 0.75rem 0 0;
  font-size: 0.94rem;
  color: var(--soft);
}

.entry ul {
  margin: 0.95rem 0 0;
  padding-left: 1.05rem;
}

.entry li {
  margin-bottom: 0.55rem;
}

.entry li::marker {
  color: var(--signal);
}

.entry-stack {
  margin: 0.55rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.entry-links {
  margin: 0.9rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.94rem;
}

/* ---------- skills ---------- */

.skills {
  margin: 0;
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0.95rem 1.5rem;
  align-items: baseline;
}

.skills dt {
  font-size: 0.92rem;
  color: var(--soft);
}

.skills dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.94rem;
}

/* Prose rows keep their own punctuation, so the flex gap must not
   push the commas away from the words they follow. */
.skills dd.prose {
  display: block;
}

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}

.mono:hover {
  border-color: var(--signal);
}

/* ---------- footer ---------- */

.foot {
  padding-block: 2.6rem 3.5rem;
  border-top: 1px solid var(--rule);
}

.foot-claim {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
}

/* LED del servidor: se enciende cuando la señal llega al final de la página */
.foot-led {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
}

.js .foot-led {
  background: var(--rule);
  box-shadow: none;
  transition: background-color 0.3s, box-shadow 0.3s;
}

.js .foot.reached .foot-led {
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: blink 2.4s steps(1) 0.4s infinite;
}

.foot-meta {
  margin: 0.7rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.4rem;
  font-size: 0.88rem;
  color: var(--soft);
}

/* ---------- links ---------- */

a {
  color: var(--signal);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: background-size 0.25s var(--ease-out);
  padding-bottom: 1px;
}

/* el subrayado se vacía y se vuelve a llenar, como el cable */
a:hover {
  animation: underline 0.45s var(--ease-out);
}

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

/* ---------- keyframes ---------- */

@keyframes rise {
  from { transform: translateY(108%); }
  to { transform: none; }
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes lit {
  from {
    border-color: var(--rule);
    background: var(--paper);
    box-shadow: 0 0 0 0 transparent, 0 0 0 transparent;
  }
}

@keyframes ping {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.2); }
}

@keyframes fill-x {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes travel-x {
  0% { left: 0; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@keyframes fill-y {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

@keyframes travel-y {
  0% { top: 0; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes underline {
  0% { background-size: 100% 1px; background-position: 100% 100%; }
  45% { background-size: 0% 1px; background-position: 100% 100%; }
  46% { background-size: 0% 1px; background-position: 0 100%; }
  100% { background-size: 100% 1px; background-position: 0 100%; }
}

@keyframes blink {
  0%, 92% { opacity: 1; }
  93%, 100% { opacity: 0.25; }
}

/* ---------- narrow ---------- */

@media (max-width: 46rem) {
  .band {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
  }

  .rail h2 {
    position: relative;
    top: auto;
  }

  .col {
    padding-left: 1.9rem;
  }

  .skills {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
  }

  .skills dd {
    margin-bottom: 0.85rem;
  }

  /* la traza se vuelve vertical */
  .hops {
    flex-direction: column;
  }

  .hop,
  .hop:last-child {
    flex: none;
    padding: 0 0 1.7rem 2.1rem;
  }

  .hop:last-child {
    padding-bottom: 0;
  }

  .hop-dot {
    top: 0.2rem;
  }

  .hop-v {
    max-width: none;
  }

  .wire {
    top: calc(0.2rem + 15px + 0.45rem);
    bottom: 0.45rem;
    left: 6.5px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .wire-fill {
    background: linear-gradient(180deg, var(--signal), var(--signal) 70%, var(--amber));
    transform-origin: 50% 0;
    animation-name: fill-y;
  }

  .packet {
    top: 0;
    left: 50%;
    width: 6px;
    height: 18px;
    margin: -9px 0 0 -3px;
    animation-name: travel-y;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .packet {
    display: none;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --paper: #fff;
    --sunk: #fff;
    --ink: #111;
    --soft: #3b3b3b;
    --rule: #bbb;
    --signal: #9b1247;
    --signal-dim: transparent;
    --amber: #6b3f00;
    --glow: transparent;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .topbar,
  .skip,
  .replay,
  .packet,
  .band::before,
  .band::after,
  .rail h2::before {
    display: none;
  }

  body {
    font-size: 10.5pt;
  }

  .hero {
    padding-block: 0 1.4rem;
  }

  .name {
    font-size: 26pt;
  }

  .trace {
    border-radius: 0;
  }

  .band {
    padding-block: 1.1rem;
    border-top: 1px solid var(--rule);
  }

  .rail h2 {
    position: static;
    padding-left: 0;
    color: var(--ink);
  }

  .col {
    padding-left: 0;
  }

  .entry,
  .trace {
    break-inside: avoid;
  }

  a {
    color: var(--ink);
  }
}
