/* nil.sx v2 — hecho a mano. Sin frameworks, sin dependencias. */

@font-face {
  font-family: "Albert Sans";
  src: url("fonts/AlbertSans-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0d0e12;
  --ink: #f2f2f2;
  --muted: #a9b1bd;
  --faint: #7d8591;
  --line: #23262e;
  --blue: #006eff;
  --blue-ink: #006eff;
  --measure: 62ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

/* hilo de progreso de lectura: avanza con el scroll, no con el reloj */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 10;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .scroll-progress {
      animation: progress-grow linear both;
      animation-timeline: scroll();
    }
  }
}

@keyframes progress-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Albert Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--blue); color: #fff; }

h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--faint);
  transition: color 160ms var(--ease-out),
              text-decoration-color 160ms var(--ease-out),
              text-underline-offset 160ms var(--ease-out);
}
a:hover {
  color: var(--blue-ink);
  text-decoration-color: currentColor;
  text-underline-offset: 0.28em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- header ---------- */

.site-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-block: 2rem 0;
}

.logo { display: inline-flex; align-items: center; }
.logo svg { width: 2.6rem; height: auto; display: block; }
.logo path { fill: var(--ink); transition: fill 200ms var(--ease-out); }
.logo:hover path { fill: var(--blue-ink); }

.head-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
}
.head-links a { text-decoration: none; color: var(--muted); }
.head-links a:hover { color: var(--ink); }
.head-links .lang { color: var(--ink); }

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

/* +20% de aire respecto a la cabecera */
.hero {
  padding-block: clamp(6rem, 17vh, 10.8rem) clamp(4rem, 10vh, 7rem);
}

.hero h1 {
  font-size: clamp(2.9rem, 8.5vw, 5.9rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.hero .dot { color: var(--blue); }

/* el rol, como subtítulo del saludo — mismo estilo que los h3 de la trayectoria, en gris */
.hero .kicker {
  margin: 1.4rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--muted);
}

/* la frase de pasión — mismo estilo que el manifiesto de hobbies */
.hero .lede {
  margin: 2.4rem 0 0;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: -0.015em;
  max-width: 26ch;
}

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

/* reveals ligados al scroll: la posición de scroll ES el progreso,
   no dependen del reloj de animación; sin soporte, todo visible */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* ojo: el manifiesto de hobbies NO entra aquí — un transform animado
       en un ancestro rompería el position:fixed de las fotos .peek */
    .motion .role,
    .motion .aside-note {
      animation: rise both linear;
      animation-timeline: view();
      animation-range: entry 10% entry 55%;
    }
    .motion .strip figure {
      animation: rise-side both linear;
      animation-timeline: view(x);
      animation-range: entry 0% entry 60%;
    }
  }
}

@keyframes rise-side {
  from { opacity: 0.25; transform: translateX(28px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- secciones ---------- */

section { padding-block: clamp(3.5rem, 9vh, 6.5rem); }

/* la trayectoria sigue al hero sin título: el aire lo pone el hero */
.track { padding-block: 0 clamp(3rem, 8vh, 5.5rem); }

/* trayectoria: filas con regla superior, año | contenido */

.role {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) 1fr;
  gap: 1rem 2rem;
  padding-block: 2.2rem;
  border-top: 1px solid var(--line);
}
.role:last-of-type { border-bottom: 1px solid var(--line); }

.role .when {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 0.45rem;
  transition: color 250ms var(--ease-out);
}
.role:hover .when { color: var(--blue-ink); }

.role h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.role h2 a { text-decoration: none; }
.role h2 .co {
  color: var(--blue-ink);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size 320ms var(--ease-out);
}
.role:hover h2 .co { background-size: 100% 2px; }

.role p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  max-width: var(--measure);
}

.role .press {
  margin-top: 0.8rem;
  font-size: 0.92rem;
  color: var(--faint);
}
.role .press a { color: var(--muted); }
.role .press a:hover { color: var(--blue-ink); }

/* docencia — prosa corta, sin fila */
.aside-note {
  margin-top: 2.4rem;
  color: var(--muted);
  max-width: var(--measure);
}
/* enlaces invisibles en reposo (petición de nil: que no destaquen nada);
   solo al pasar por encima se revelan: azul + subrayado */
.aside-note a {
  color: inherit;
  text-decoration: none;
}
.aside-note a:hover {
  color: var(--blue-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

/* ---------- fotos ---------- */

.strip {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  padding-inline: var(--gutter);
  padding-block: 0.5rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.strip::-webkit-scrollbar { height: 6px; }
.strip::-webkit-scrollbar-track { background: transparent; }
.strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.strip::-webkit-scrollbar-thumb:hover { background: var(--faint); }

.strip figure {
  margin: 0;
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.strip img {
  display: block;
  height: clamp(240px, 38vh, 360px);
  width: auto;
  border-radius: 6px;
  transition: filter 450ms var(--ease-out),
              transform 450ms var(--ease-out),
              box-shadow 450ms var(--ease-out);
}
.strip figure:hover img {
  filter: brightness(1.1);
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

/* fundido en el borde derecho: pista de que hay más;
   se desvanece al llegar al final del carrusel (progreso = scroll) */
.photos {
  position: relative;
  timeline-scope: --strip-x;
}
.strip { scroll-timeline: --strip-x x; }

.photos::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(2rem, 6vw, 5rem);
  background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none;
}

@supports (animation-timeline: scroll()) {
  .photos::after {
    animation: strip-fade auto linear both;
    animation-timeline: --strip-x;
  }
}

@keyframes strip-fade {
  0%, 88% { opacity: 1; }
  100% { opacity: 0; }
}

.strip figcaption {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  transition: color 250ms var(--ease-out);
}
.strip figure:hover figcaption { color: var(--ink); }

/* la tira sangra a todo el ancho y cierra la trayectoria, sin título propio;
   el aire hacia el manifiesto lo pone la sección siguiente */
.photos { padding-inline: 0; padding-block: 0; }

/* ---------- hobbies ---------- */

.hobbies {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
}

.hobbies figure { margin: 0; }

.hobbies img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 6px;
  transition: filter 450ms var(--ease-out);
}
.hobbies figure:hover img { filter: brightness(1.12); }

.hobbies h3 {
  margin-top: 1.1rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hobbies figcaption p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

/* manifiesto de hobbies */

.hobby-manifesto {
  margin: 0;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: -0.015em;
  max-width: 26ch;
}

.hobby-manifesto em {
  font-style: normal;
  color: var(--blue-ink);
  position: relative;
  text-decoration: underline dotted 0.06em;
  text-decoration-color: color-mix(in srgb, var(--blue-ink) 45%, transparent);
  text-underline-offset: 0.14em;
  transition: text-decoration-color 200ms var(--ease-out);
}
.hobby-manifesto em:hover { text-decoration-color: var(--blue-ink); }

/* la foto aparece centrada en el cursor al pasar por la palabra
   (sin JS, cae al fallback: asoma sobre la palabra) */
.hobby-manifesto .peek {
  position: absolute;
  bottom: calc(100% + 0.6rem);
  left: 50%;
  width: clamp(20rem, 42vw, 32rem);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
  transform: translateX(-50%) rotate(var(--tilt, -4deg)) scale(0.94);
  transition: opacity 220ms var(--ease-out), transform 300ms var(--ease-out), visibility 0s 220ms;
}

.hobby-manifesto em:nth-of-type(2) .peek { --tilt: 3deg; }

/* la de naturaleza es vertical: formato retrato para respetar la composición */
.hobby-manifesto em:nth-of-type(3) .peek {
  --tilt: -2deg;
  width: clamp(15rem, 28vw, 22rem);
  aspect-ratio: 3 / 4;
}

/* con JS: la imagen se ancla al viewport y su centro es el cursor */
.hobby-manifesto.cursor-peek .peek {
  position: fixed;
  bottom: auto;
  left: -999px;
  top: -999px;
  transform: translate(-50%, -50%) rotate(var(--tilt, -4deg)) scale(0.94);
}

.hobby-manifesto em:hover .peek {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) rotate(var(--tilt, -4deg)) scale(1);
  transition: opacity 220ms var(--ease-out), transform 300ms var(--ease-out), visibility 0s;
}

.hobby-manifesto.cursor-peek em:hover .peek {
  transform: translate(-50%, -50%) rotate(var(--tilt, -4deg)) scale(1);
}

/* ---------- footer (con contacto) ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  padding-block: clamp(2.5rem, 6vh, 4rem);
}

.foot-mail {
  position: relative;
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: clamp(1.2rem, 2.6vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.foot-mail:hover { color: var(--blue-ink); }

.foot-mail .mail-text {
  display: inline-block;
  transition: opacity 200ms var(--ease-out), transform 250ms var(--ease-out);
}

.foot-mail .mail-copied {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  color: var(--blue-ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms var(--ease-out), transform 250ms var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
}

.foot-mail.copied .mail-text {
  opacity: 0;
  transform: translateY(-10px);
}
.foot-mail.copied .mail-copied {
  opacity: 1;
  transform: none;
}

.foot-links {
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
}
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--ink); }

.foot-copy {
  margin: 2.2rem 0 0;
  font-size: 0.85rem;
  color: var(--faint);
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .role { grid-template-columns: 1fr; gap: 0.2rem; padding-block: 1.8rem; }
  .role .when { padding-top: 0; }
  .strip img { height: 240px; }
}
