/* =========================================================
   César Portela · Portfolio
   HTML5 + CSS3 + JS sin dependencias
   ========================================================= */

/*@fontface*/
@font-face {
  font-family: "Chivo";
  src: url("../fonts/chivo.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chivo";
  src: url("../fonts/chivo-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
/*/@fontface*/

/* ---------- Tokens ---------- */
:root {
  --bg: #000000;
  --fg: #ffffff;
  --muted: #ababab;
  --line: rgba(255, 255, 255, 0.18);
  --grid: rgba(255, 255, 255, 0.10);
  --accent: #f4ff1a;        /* amarillo fosforito */
  --accent-ink: #f4ff1a;    /* acento para trazos y detalles sobre el fondo */
  --on-accent: #000000;     /* texto sobre el acento */
  --accent-edge: transparent;
  --hero-accent: #f4ff1a;   /* color del nombre de la portada al girar */
  --logo-filter: brightness(0) invert(1); /* logos del muro, en blanco */
  --marquee-hover: var(--accent);         /* contorno de la marquesina al pasar */
  --w-fine: 300;                          /* peso de los textos finos */

  --sans: "Chivo", "Helvetica Neue", Arial, sans-serif;

  --pad: clamp(1rem, 4vw, 4.5rem);
  --gap: clamp(1rem, 2.5vw, 2.5rem);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);

  color-scheme: dark;
}
/* Modo claro. Solo se activa con el botón de sol y luna
   (data-theme="light", guardado en cp-theme). La primera visita es siempre
   oscura, sea cual sea el modo del sistema. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #5e5e5e;
  --line: rgba(0, 0, 0, 0.18);
  --grid: rgba(0, 0, 0, 0.10);
  --accent-ink: #000000;
  --accent-edge: #000000;
  --hero-accent: #141414;
  --logo-filter: brightness(0);
  --marquee-hover: var(--fg);
  --w-fine: 400;
  color-scheme: light;
}
/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: var(--pad); top: -4rem; z-index: 200;
  background: var(--fg); color: var(--bg); padding: .6rem 1rem; text-decoration: none;
}
.skip:focus { top: 1rem; }

main, .site-footer { position: relative; z-index: 1; }
.js.is-loading body { overflow: hidden; }

/* ---------- Retícula de fondo ---------- */
.grid-lines {
  position: fixed; inset: 0; z-index: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--gap);
  padding: 0 var(--pad);
  pointer-events: none;
}
.grid-lines span { border-inline: 1px dashed var(--grid); }
@media (max-width: 900px) {
  .grid-lines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-lines span:nth-child(n + 3) { display: none; }
}

/* ---------- Cursor ---------- */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .has-cursor, .has-cursor a, .has-cursor button, .has-cursor summary { cursor: none; }
  .has-cursor .cursor {
    display: block;
    position: fixed; left: 0; top: 0; z-index: 300;
    width: 60px; height: 60px; margin: -30px 0 0 -30px;
    border: 1px solid var(--accent);
    mix-blend-mode: difference;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    will-change: transform;
  }
  .has-cursor .cursor.is-visible { opacity: 1; }
  .cursor::before, .cursor::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    background: var(--accent);
    transform: translate(-50%, -50%);
  }
  .cursor::before { width: 11px; height: 1px; }
  .cursor::after  { width: 1px; height: 11px; }
}

/* ---------- Loader ---------- */
.loader { display: none; }
.js .loader {
  display: block;
  position: fixed; inset: 0; z-index: 150;
  background: var(--bg); color: var(--fg);
  transition: opacity .8s ease, visibility .8s;
}
.loader__count {
  position: absolute; left: var(--pad); bottom: var(--pad);
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.loader.is-done { opacity: 0; visibility: hidden; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: var(--gap);
  padding: 1.25rem var(--pad);
  color: #fff;
  mix-blend-mode: difference;
}
.brand, .nav a, .menu-toggle {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}
.nav ul { display: flex; gap: clamp(1rem, 2.4vw, 2.5rem); margin: 0; padding: 0; list-style: none; }
.nav a, .brand {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .5s var(--ease);
  padding-bottom: 2px;
}
.nav a:hover, .brand:hover { background-size: 100% 1px; }
.site-header__tools { display: flex; align-items: center; gap: 1.25rem; }
.menu-toggle { display: none; background: none; border: 0; color: inherit; padding: .25rem 0; }

/* sol / luna: modo claro y oscuro */
.theme-toggle {
  display: grid; place-items: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 0; background: none; color: inherit;
  cursor: pointer;
}
.theme-toggle svg { grid-area: 1 / 1; width: 1.15rem; height: 1.15rem; transition: opacity .4s ease, transform .6s var(--ease); }
.theme-toggle__moon { opacity: 0; transform: rotate(-40deg) scale(.6); }
.theme-toggle__sun { opacity: 1; transform: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__sun { opacity: 0; transform: rotate(40deg) scale(.6); }
.theme-toggle[aria-pressed="true"] .theme-toggle__moon { opacity: 1; transform: none; }
.theme-toggle:hover svg { color: var(--accent-ink); }
.no-js .theme-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav {
    position: fixed; inset: 0; z-index: -1;
    display: flex; align-items: flex-end;
    padding: 6rem var(--pad) var(--pad);
    background: #000;
    clip-path: inset(0 0 100% 0);
    transition: clip-path .8s var(--ease);
    visibility: hidden;
  }
  .nav ul { flex-direction: column; gap: .2rem; }
  .nav a {
    font-size: clamp(2.75rem, 14vw, 4.5rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -.02em;
    background: none;
  }
  .menu-open .site-header { mix-blend-mode: normal; }
  .menu-open .nav { clip-path: inset(0 0 0 0); visibility: visible; }
  .menu-open body { overflow: hidden; }
}

/* ---------- Portada: contornos que fluyen ---------- */
.hero {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 5rem var(--pad) var(--pad);
}
.hero__title { align-self: center; margin: 0; padding: 2rem 0; }

.outline {
  display: block;
  width: min(100%, calc((100vh - 18rem) * 2.394));
  width: min(100%, calc((100svh - 18rem) * 2.394));
  height: auto;
  overflow: visible;
  fill: none;
  stroke: var(--fg);
  stroke-width: var(--stroke, .5);
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}
/* pathLength = 110 → trazo de 100 y hueco de 10: el hueco recorre cada letra */
.outline path { stroke-dasharray: 100 10; stroke-dashoffset: 0; }
.js .outline path { stroke-dasharray: 0 110; }
.no-js .outline path,
.js .hero.is-ready .outline path {
  animation:
    outline-draw 2.4s var(--ease) calc(var(--i) * 85ms) both,
    outline-flow 7s linear infinite;
}
.js .hero.is-ready.is-drawn .outline path {
  animation: outline-flow 7s linear infinite;
  stroke-dasharray: var(--dash-pattern, 100 10);
}
/* el nombre queda fijo como telón de fondo mientras se hace scroll */
.outline.is-pinned {
  position: fixed;
  margin: 0;
  transform-origin: 50% 50%;
  pointer-events: none;
}
@keyframes outline-draw {
  from { stroke-dasharray: 0 110; }
  to   { stroke-dasharray: 100 10; }
}
@keyframes outline-flow {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -110; }
}

.hero__foot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: end;
}
.hero__foot p { margin: 0; font-size: clamp(1rem, 1.3vw, 1.2rem); line-height: 1.3; }
.hero__role { grid-column: span 2; }
.hero__place { color: var(--muted); }
.hero__down {
  grid-column: 4; justify-self: end;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  line-height: 1;
  font-weight: 300;
  text-decoration: none;
}
.js .hero__foot { opacity: 0; transition: opacity 1.2s ease 1.4s; }
.js .hero.is-ready .hero__foot { opacity: 1; }
@media (max-width: 600px) {
  .hero__foot { grid-template-columns: minmax(0, 1fr) auto; row-gap: .75rem; }
  .hero__role { grid-column: 1 / -1; }
  .hero__role br { display: none; }
  .hero__down { grid-column: 2; }
}

/* ---------- Secciones ---------- */
.section {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  padding: clamp(6rem, 13vw, 12rem) var(--pad) 0;
  scroll-margin-top: 2rem;
}
.section--tight { padding-top: clamp(4rem, 7vw, 6.5rem); }
.label {
  grid-column: 1 / span 3;
  align-self: start;
  position: sticky; top: 4.5rem;
  margin: .55rem 0 0;
  font-size: 1.0625rem;
  line-height: 1.3;
  font-weight: 400;
  color: var(--muted);
}
.section__body { grid-column: 4 / -1; min-width: 0; }

.statement {
  margin: 0 0 .8em;
  max-width: 24em;
  font-size: clamp(1.5rem, 2.8vw, 2.75rem);
  line-height: 1.16;
  font-weight: 300;
  letter-spacing: -.02em;
  text-wrap: pretty;
}
.statement strong { font-weight: 700; }
#perfil .statement { font-size: clamp(1.35rem, 2.3vw, 2.25rem); line-height: 1.2; max-width: 26em; }
.statement a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 94% / 100% 1px no-repeat; }
.statement a:hover { background-size: 0 1px; transition: background-size .5s var(--ease); }

@media (max-width: 900px) {
  .label, .section__body { grid-column: 1 / -1; }
  .label { position: static; margin: 0 0 1.5rem; }
}

/* ---------- Mapa de competencias ---------- */
.skills-map { margin: clamp(3.5rem, 7vw, 7rem) 0 clamp(3rem, 5vw, 5rem); }
.skills-map__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 2rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.skills-map__kicker { margin: 0; font-size: clamp(1.25rem, 1.6vw, 1.5rem); line-height: 1.12; font-weight: 700; letter-spacing: -.01em; }
.skills-map__hint { margin: 0; color: var(--muted); font-size: .9375rem; font-weight: 300; }
.skills-map__stage { position: relative; margin-top: clamp(1.5rem, 3vw, 2.5rem); background: var(--bg); box-shadow: 0 0 0 1.5rem var(--bg); }
.skills-map__stage svg { display: block; width: 100%; height: auto; overflow: visible; -webkit-tap-highlight-color: transparent; }

/* sin JS: lista legible */
.skills-map__list { margin: 1.5rem 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem var(--gap); }
.skills-map__list li { border-top: 1px solid var(--line); padding-top: .75rem; font-weight: 300; color: var(--muted); }
.skills-map__list strong { display: block; color: var(--fg); font-weight: 700; margin-bottom: .25rem; }
.js .skills-map:not(.is-list) .skills-map__list { display: none; }
.skills-map.is-list .skills-map__stage,
.skills-map.is-list .skills-map__panel,
.skills-map.is-list .skills-map__hint { display: none; }
.skills-map__tools { display: flex; align-items: baseline; gap: 1.25rem; }
.skills-map__toggle {
  padding: 0; border: 0; background: none;
  color: var(--fg); font: 500 .9375rem/1.2 var(--sans);
  text-decoration: none; cursor: pointer;
  background-image: linear-gradient(var(--accent-ink), var(--accent-ink));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 1px;
  padding-bottom: 2px;
}
.skills-map__toggle:hover { background-size: 0 1px; transition: background-size .5s var(--ease); }
.no-js .skills-map__toggle { display: none; }
.no-js .skills-map__stage, .no-js .skills-map__panel, .no-js .skills-map__hint { display: none; }

/* aristas */
.sm-edge {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: var(--len);
  stroke-dashoffset: var(--len);
  transition: stroke-dashoffset 1.3s var(--ease) var(--d, 0s), stroke .35s ease, opacity .35s ease;
}
.skills-map.is-in .sm-edge { stroke-dashoffset: 0; }
.skills-map.is-ready .sm-edge { transition: stroke .35s ease, opacity .35s ease; }
.skills-map .sm-edge.is-on {
  stroke: var(--accent-ink);
  stroke-dasharray: 5 7;
  animation: sm-flow 3.2s linear infinite;
}
.skills-map .sm-edge.is-on.is-rev { animation-direction: reverse; }
@keyframes sm-flow { to { stroke-dashoffset: -12; } }

/* nodos */
.sm-node { cursor: pointer; outline: none; opacity: 0; transition: opacity .7s ease var(--d, 0s); }
.skills-map.is-in .sm-node { opacity: 1; }
.skills-map.is-ready .sm-node { transition: opacity .35s ease; }
.skills-map.is-ready .sm-edge.is-dim,
.skills-map.is-ready .sm-node.is-dim { opacity: .2; }

.sm-node__hit { fill: transparent; }
.sm-node__dot {
  fill: var(--bg);
  stroke: var(--fg);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: transform .9s cubic-bezier(.34, 1.7, .64, 1) var(--d, 0s), fill .35s ease, stroke .35s ease;
}
.skills-map.is-in .sm-node__dot { transform: scale(1); }
.skills-map.is-ready .sm-node__dot { transition: transform .5s var(--ease), fill .35s ease, stroke .35s ease; }
.sm-node.is-on .sm-node__dot { fill: var(--accent); stroke: var(--accent-ink); transform: scale(1.25); }
.sm-node.is-linked .sm-node__dot { stroke: var(--accent-ink); }
.sm-node:focus-visible .sm-node__dot { stroke: var(--accent-ink); stroke-width: 2.5; }

.sm-node__ring {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  pointer-events: none;
}
.sm-node.is-pulse .sm-node__ring { animation: tl-ripple 1.2s cubic-bezier(.2, .6, .3, 1); }

.sm-node__label {
  fill: var(--muted);
  /* halo del color de fondo: las conexiones no atraviesan el texto */
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 6px;
  stroke-linejoin: round;
  font-family: var(--sans);
  font-weight: 400;
  pointer-events: none;
  transition: fill .35s ease;
}
.sm-node.is-on .sm-node__label { fill: var(--fg); font-weight: 700; }
.sm-node.is-linked .sm-node__label { fill: var(--fg); }

.sm-spark { fill: var(--accent); pointer-events: none; opacity: 0; }

/* panel de detalle */
.skills-map__panel {
  min-height: 9.5rem;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.skills-map__panel-inner.is-swap { animation: sm-panel .6s var(--ease); }
@keyframes sm-panel { from { opacity: 0; transform: translateY(.6rem); } to { opacity: 1; transform: none; } }
.skills-map__title { margin: 0; font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.skills-map__desc { margin: .6rem 0 0; max-width: 42em; font-size: 1.0625rem; line-height: 1.5; font-weight: 300; }
.skills-map__links { margin: .6rem 0 0; color: var(--muted); font-size: .9375rem; font-weight: 300; }
.skills-map__links b { font-weight: 500; color: var(--fg); }
.skills-map__links b::before {
  content: ""; display: inline-block; width: .45em; height: .45em; margin: 0 .35em 0 .1em; vertical-align: .08em;
  border-radius: 50%; background: var(--accent); border: 1px solid var(--accent-edge);
}

@media (max-width: 600px) {
  .skills-map__list { grid-template-columns: 1fr; }
  /* en móvil el detalle acompaña al scroll pegado abajo */
  .skills-map__panel {
    position: sticky; bottom: 0; z-index: 2;
    min-height: 0;
    margin-inline: calc(var(--pad) * -1);
    padding: .9rem var(--pad) 1.1rem;
    background: var(--bg);
  }
  .skills-map__title { font-size: 1.25rem; }
  .skills-map__desc { font-size: .9375rem; margin-top: .4rem; }
  .skills-map__links { font-size: .8125rem; margin-top: .4rem; }
}

/* ---------- Botón píldora ---------- */
.pill {
  display: inline-flex; align-items: center;
  padding: .85em 1.35em;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-size: 1.0625rem;
  line-height: 1;
  font-weight: 500;
  text-decoration: none;
  transition: background-color .3s, color .3s;
}
.pill:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Experiencia: línea temporal ---------- */
.timeline {
  --company: clamp(1.4875rem, 2.72vw, 2.635rem); /* títulos de experiencia, un 15 % más pequeños */
  --rail-x: .45rem;
  --dot: .9rem;
  --indent: clamp(2.25rem, 5vw, 4.5rem);
  --progress: 0;
  position: relative;
}
.timeline__rail {
  position: absolute;
  left: var(--rail-x);
  top: calc(var(--company) * .5);
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.timeline__fill {
  position: absolute; inset: 0;
  background: var(--fg);
  background: var(--accent-ink);
  transform-origin: top;
  transform: scaleY(var(--progress));
}
.timeline__list { list-style: none; margin: 0; padding: 0; }

.job {
  position: relative;
  padding: 0 0 clamp(4.5rem, 9vw, 8rem) var(--indent);
}
.job:last-child { padding-bottom: 0; }

.job__dot {
  position: absolute;
  left: calc(var(--rail-x) - var(--dot) / 2 + .5px);
  top: calc(var(--company) * .5 - var(--dot) / 2);
  width: var(--dot); height: var(--dot);
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
  transform: scale(.65);
  transition: background-color .5s ease, border-color .5s ease, transform .7s var(--ease);
}
.job.is-active .job__dot { background: var(--accent); border-color: var(--accent-ink); transform: scale(1); }

.job__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .35rem 2rem; }
.job__company {
  margin: 0;
  font-size: var(--company);
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.01em;
  -webkit-text-stroke: 1px transparent;
}
.job__years { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.job__role {
  margin: .75rem 0 0;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.0625rem, 1.3vw, 1.25rem);
  line-height: 1.35;
}
.job__context { margin: .35rem 0 0; max-width: 40em; color: var(--muted); font-size: .9375rem; line-height: 1.45; font-weight: 300; }
.job__desc { margin: 1rem 0 0; max-width: 40em; font-size: 1.125rem; line-height: 1.5; font-weight: 300; }

.job__list { margin: 1.5rem 0 0; padding: 0; list-style: none; max-width: 46em; }
.job__list > li {
  padding: .6rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.45;
  font-weight: 300;
}
.sub { position: relative; padding: .9rem 0 !important; }
/* punto pequeño de cada proyecto, sobre la misma línea */
.sub__dot {
  --sub-dot: .5rem;
  position: absolute;
  left: calc(var(--rail-x) - var(--indent) - var(--sub-dot) / 2 + .5px);
  top: calc(.9rem + .77rem - var(--sub-dot) / 2);
  width: var(--sub-dot); height: var(--sub-dot);
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--muted);
  transform: scale(.6);
  transition: background-color .45s ease, border-color .45s ease, transform .6s var(--ease);
}
.sub.is-active .sub__dot { background: var(--accent); border-color: var(--accent-ink); transform: scale(1); }
.sub__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem 1.5rem; }
.sub__name { color: var(--fg); font-weight: 700; font-size: 1.0625rem; letter-spacing: -.005em; }
.sub__years { font-variant-numeric: tabular-nums; font-size: .875rem; white-space: nowrap; }
.sub__role { margin: .2rem 0 0; font-style: italic; color: var(--fg); }
.sub__desc { margin: .2rem 0 0; }

/* =========================================================
   Entrada: cada punto late, lanza una rama hacia el texto
   y el contenido se despliega desde la línea hacia la derecha,
   pasando de desenfocado a nítido. Solo con JS y sin "reducir movimiento".
   ========================================================= */

/* latido del punto */
.job__dot::after,
.sub__dot::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--accent-ink);
  opacity: 0;
  pointer-events: none;
}
.job.is-active .job__dot::after,
.sub.is-active .sub__dot::after { animation: tl-ripple 1.2s cubic-bezier(.2, .6, .3, 1); }
@keyframes tl-ripple {
  from { transform: scale(1);   opacity: .8; }
  to   { transform: scale(3.4); opacity: 0; }
}

/* rama que une el punto con el texto */
.job::before,
.sub::after {
  content: "";
  position: absolute;
  height: 1px;
  background: var(--accent-ink);
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  pointer-events: none;
}
.job::before {
  left: calc(var(--rail-x) + var(--dot) / 2 + .4rem);
  width: calc(var(--indent) - var(--rail-x) - var(--dot) / 2 - 1.2rem);
  top: calc(var(--company) * .5);
}
.sub::after {
  left: calc(var(--rail-x) - var(--indent) + .25rem + .4rem);
  width: calc(var(--indent) - var(--rail-x) - .25rem - 1.2rem);
  top: calc(.9rem + .77rem);
}
.job.is-revealed::before,
.sub.is-revealed::after { animation: tl-branch 1.2s var(--ease) forwards; }
@keyframes tl-branch {
  0%   { transform: scaleX(0); opacity: 1; }
  50%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: .3; }
}

/* separador de cada proyecto: se traza de izquierda a derecha */
.job__list--projects > li.sub { border-top: 0; }
.sub::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: 1px;
  background: var(--line);
  transform-origin: left;
}
.js .timeline .sub::before { transform: scaleX(0); transition: transform 1.3s var(--ease) .15s; }
.js .timeline .sub.is-revealed::before { transform: scaleX(1); }

/* textos: barrido desde la línea + desenfoque que se aclara */
.js .timeline .job__company,
.js .timeline .job__role,
.js .timeline .job__context,
.js .timeline .job__desc,
.js .timeline .job__list:not(.job__list--projects) > li,
.js .timeline .sub__head,
.js .timeline .sub__role,
.js .timeline .sub__desc {
  clip-path: inset(-.3em 100% -.3em -.3em);
  opacity: 0;
  transform: translateX(-1.5rem);
  filter: blur(8px);
  transition:
    clip-path 1.15s var(--ease) var(--delay, 0s),
    transform 1.4s var(--ease) var(--delay, 0s),
    opacity .7s ease var(--delay, 0s),
    filter 1s ease var(--delay, 0s);
}
.js .timeline .job__company {
  --delay: .25s;
  color: transparent;   /* llega en contorno y se rellena, como la portada */
  -webkit-text-stroke-color: var(--fg);
  transition:
    clip-path 1.15s var(--ease) var(--delay),
    transform 1.4s var(--ease) var(--delay),
    opacity .7s ease var(--delay),
    filter 1s ease var(--delay),
    color 1s ease 1.05s,
    -webkit-text-stroke-color .6s ease 1.8s;
}
.js .timeline .job__role { --delay: .5s; }
.js .timeline .job__context { --delay: .58s; }
.js .timeline .job__desc { --delay: .65s; }
.js .timeline .job__list:not(.job__list--projects) > li { --delay: calc(.85s + var(--n, 0) * 90ms); }
.js .timeline .sub__head { --delay: .3s; }
.js .timeline .sub__role { --delay: .42s; }
.js .timeline .sub__desc { --delay: .54s; }

.js .timeline .job.is-revealed .job__company,
.js .timeline .job.is-revealed .job__role,
.js .timeline .job.is-revealed .job__context,
.js .timeline .job.is-revealed .job__desc,
.js .timeline .job.is-revealed .job__list:not(.job__list--projects) > li,
.js .timeline .sub.is-revealed .sub__head,
.js .timeline .sub.is-revealed .sub__role,
.js .timeline .sub.is-revealed .sub__desc {
  clip-path: inset(-.3em -.3em -.3em -.3em);
  opacity: 1;
  transform: none;
  filter: blur(0);
}
.js .timeline .job.is-revealed .job__company { color: var(--fg); -webkit-text-stroke-color: transparent; }

/* fechas: suben desde una máscara, a destiempo del nombre */
.js .timeline .job__years {
  clip-path: inset(100% -.3em -.3em -.3em);
  opacity: 0;
  transform: translateY(.7em);
  transition: clip-path 1s var(--ease) .6s, transform 1.1s var(--ease) .6s, opacity .6s ease .6s;
}
.js .timeline .job.is-revealed .job__years {
  clip-path: inset(-.3em -.3em -.3em -.3em);
  opacity: 1;
  transform: none;
}

@media (max-width: 760px) {
  .timeline { --indent: 2rem; --dot: .75rem; --rail-x: .375rem; }
  .job__head { flex-direction: column; }
}

/* ---------- Proyectos: grid sin textos ---------- */
.works {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
  margin-top: clamp(3rem, 6vw, 6rem);
}
/* anchos en múltiplos de 3 columnas para casar con las líneas de la retícula */
.work     { grid-column: span 6; min-width: 0; display: block; color: inherit; text-decoration: none; }
.work--3  { grid-column: span 3; }
.work--9  { grid-column: span 9; }
.work--12 { grid-column: 1 / -1; }
.work:nth-child(even):not(.work--12) { margin-top: clamp(0rem, 6vw, 6rem); }

/* hueco preparado para imagen o vídeo */
.slot {
  position: relative;
  margin: 0;
  aspect-ratio: var(--ratio, 4 / 3);
  overflow: hidden;
  background: color-mix(in srgb, var(--fg) 3%, var(--bg));
  outline: 1px dashed var(--line);
  outline-offset: -1px;
  transition: outline-color .4s ease, background-color .4s ease;
}
.slot img,
.slot video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}
.slot:has(img, video) { outline: 0; background: transparent; }
.slot:has(img, video) .slot__cross { display: none; }
.slot__cross {
  position: absolute; left: 50%; top: 50%;
  width: 1.5rem; height: 1.5rem;
  margin: -.75rem 0 0 -.75rem;
  transition: transform .8s var(--ease);
}
.slot__cross::before, .slot__cross::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  background: var(--muted);
  transform: translate(-50%, -50%);
  transition: background-color .4s ease;
}
.slot__cross::before { width: 100%; height: 1px; }
.slot__cross::after  { width: 1px; height: 100%; }

.work:hover .slot,
.work:focus-visible .slot { outline-color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.work:hover .slot__cross { transform: rotate(90deg); }
.work:hover .slot__cross::before, .work:hover .slot__cross::after { background: var(--accent-ink); }
.work:hover .slot img, .work:hover .slot video { transform: scale(1.03); }

/* entrada del grid: cada hueco se descubre de abajo arriba */
.js .works .work .slot { clip-path: inset(100% 0 0 0); transition: clip-path 1.2s var(--ease) var(--d, 0s), outline-color .4s ease, background-color .4s ease; }
.js .works .work.is-in .slot { clip-path: inset(0 0 0 0); }

@media (max-width: 900px) {
  .work, .work--3 { grid-column: span 6; }
  .work--9, .work--12 { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .works { row-gap: 1rem; }
  .work, .work--3, .work--9, .work--12 { grid-column: 1 / -1; margin-top: 0 !important; }
  .work--12 .slot { aspect-ratio: 4 / 3; }
}

/* etiqueta del cursor con el nombre del proyecto */
.cursor-label { display: none; }
@media (hover: hover) and (pointer: fine) {
  .has-cursor .cursor-label {
    display: block;
    position: fixed; left: 0; top: 0; z-index: 301;
    padding: .45em .8em;
    border-radius: 999px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: .875rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(-100px, -100px, 0);
    transition: opacity .25s ease;
  }
  .has-cursor .cursor-label.is-visible { opacity: 1; }
}

/* ---------- Página de proyecto ---------- */
.project { padding-bottom: 0; }
.project__head {
  padding-top: clamp(7rem, 14vw, 11rem);
  row-gap: 0;
}
.project__head > * { grid-column: 1 / -1; }
.project__back {
  justify-self: start;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
  color: var(--muted);
  text-decoration: none;
  transition: color .3s ease;
}
.project__back:hover { color: var(--accent-ink); }
.project__title {
  margin: 0;
  max-width: 14em;
  font-size: clamp(2.75rem, 8.5vw, 8.5rem);
  line-height: .92;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.02em;
  text-wrap: balance;
}
.project__meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: var(--gap);
  margin: clamp(2.5rem, 5vw, 4.5rem) 0 0;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.project__meta div:last-child { grid-column: span 2; }
.project__meta dt { color: var(--muted); font-size: .9375rem; margin-bottom: .3rem; }
.project__meta dd { margin: 0; font-weight: 500; }
.project__intro {
  grid-column: 4 / -1 !important;
  margin: clamp(2.5rem, 5vw, 4rem) 0 0;
  max-width: 24em;
  font-size: clamp(1.5rem, 2.8vw, 2.75rem);
  line-height: 1.16;
  font-weight: 300;
  letter-spacing: -.02em;
}
.project__media {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
  padding: clamp(4rem, 8vw, 7rem) var(--pad) 0;
}
.slot--12 { grid-column: 1 / -1; }
.slot--9  { grid-column: span 9; }
.slot--6  { grid-column: span 6; }
.slot--3  { grid-column: span 3; }
.project__next {
  display: block;
  margin: clamp(6rem, 12vw, 10rem) var(--pad) 0;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  text-decoration: none;
}
.project__next-label { display: block; color: var(--muted); }
.project__next-name {
  display: block;
  margin-top: .5rem;
  font-size: clamp(2rem, 6vw, 5.5rem);
  line-height: .95;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.02em;
  transition: color .4s ease;
}
.project__next-name b { display: inline-block; color: var(--accent-ink); font-weight: 200; transition: transform .6s var(--ease); }
.project__next:hover .project__next-name b { transform: translateX(.2em); }

/* entrada de la página de proyecto */
.js .project__title { animation: pj-wipe 1.3s var(--ease) .1s both; }
.js .project__meta, .js .project__intro { animation: pj-rise 1.1s var(--ease) both; }
.js .project__meta  { animation-delay: .45s; }
.js .project__intro { animation-delay: .6s; }
.js .project__media .slot { animation: pj-reveal 1.2s var(--ease) both; }
.js .project__media .slot:nth-child(1) { animation-delay: .75s; }
.js .project__media .slot:nth-child(2) { animation-delay: .9s; }
.js .project__media .slot:nth-child(3) { animation-delay: 1s; }
.js .project__media .slot:nth-child(n + 4) { animation-delay: 1.1s; }
@keyframes pj-wipe {
  from { clip-path: inset(-.2em 100% -.2em -.2em); transform: translateX(-2rem); filter: blur(10px); }
  to   { clip-path: inset(-.2em -.2em -.2em -.2em); transform: none; filter: blur(0); }
}
@keyframes pj-rise   { from { opacity: 0; transform: translateY(1.5rem); } to { opacity: 1; transform: none; } }
@keyframes pj-reveal { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Página 404: reutiliza la cabecera de proyecto y añade los enlaces de salida */
[data-page="404"] .project__title { font-size: clamp(7rem, 30vw, 28rem); line-height: .8; letter-spacing: -.05em; }
.notfound__links {
  grid-column: 4 / -1 !important;
  display: flex; flex-wrap: wrap; gap: .75rem;
  margin: clamp(2rem, 4vw, 3rem) 0 clamp(5rem, 10vw, 9rem);
}
.js .notfound__links { animation: pj-rise 1.1s var(--ease) .75s both; }

@media (max-width: 760px) {
  .project__meta { grid-template-columns: 1fr; row-gap: 1rem; }
  .project__meta div:last-child { grid-column: auto; }
  .project__intro, .notfound__links { grid-column: 1 / -1 !important; }
  .slot--9, .slot--6, .slot--3 { grid-column: 1 / -1; }
}

/* ---------- Herramientas ---------- */
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem var(--gap); margin: 0; }
.tools > div { border-top: 1px solid var(--line); padding-top: 1rem; }
.tools dt { color: var(--muted); margin-bottom: .35rem; }
.tools dd { margin: 0; max-width: 30em; font-size: clamp(1.0625rem, 1.3vw, 1.25rem); line-height: 1.4; font-weight: 300; }
@media (max-width: 600px) { .tools { grid-template-columns: 1fr; } }

/* ---------- Contacto ---------- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 5vw, 5rem) var(--gap);
  align-items: start;
}
/* mismo estilo que el título de Formación */
.contact__title {
  margin: 0;
  max-width: 16em;
  font-size: clamp(1.75rem, 3.2vw, 3.1rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.contact__dot {
  display: inline-block;
  width: .2em; height: .2em;
  margin-left: .08em;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid var(--accent-edge);
  vertical-align: baseline;
}
.contact__sub { margin: 1.5rem 0 0; max-width: 26em; font-size: 1.125rem; line-height: 1.5; font-weight: 300; }
.contact__alt { margin: 1rem 0 0; color: var(--muted); font-weight: 300; }
.contact__alt a {
  color: var(--fg);
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(var(--accent-ink), var(--accent-ink)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 2px;
  transition: background-size .5s var(--ease);
}
.contact__alt a:hover { background-size: 0 1px; }
.contact__links { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* formulario */
.form { display: grid; gap: 1.75rem; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem var(--gap); }
.field { position: relative; display: grid; gap: .35rem; }
.field label { color: var(--muted); font-size: .9375rem; }
.field__opt { color: var(--muted); opacity: .7; }
.field input,
.field select,
.field textarea {
  width: 100%;
  margin: 0;
  padding: .55rem 0 .7rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: 300 1.1875rem/1.4 var(--sans);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .35s ease;
}
.field textarea { resize: vertical; min-height: 7.5rem; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .55; }
.field select { cursor: pointer; padding-right: 2rem; }
.field select option { background: var(--bg); color: var(--fg); }
.field--select::after {
  content: "";
  position: absolute; right: .25rem; bottom: 1.25rem;
  width: .55rem; height: .55rem;
  border-right: 1px solid var(--fg); border-bottom: 1px solid var(--fg);
  transform: rotate(45deg);
  pointer-events: none;
}
/* línea de foco que se traza en fosforito */
.field::before {
  content: "";
  position: absolute; left: 0; right: 0;
  bottom: var(--line-bottom, 0);
  height: 2px;
  background: var(--accent-ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease);
  pointer-events: none;
}
.field:has(.field__error:not(:empty))::before { --line-bottom: 1.5rem; }
.field:focus-within::before { transform: scaleX(1); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; }
.field [aria-invalid="true"] { border-bottom-color: #ff5a4f; }
.field__error { min-height: 0; color: #ff8a80; font-size: .875rem; }
.field__error:empty { display: none; }
.field--trap { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.check { position: relative; display: flex; align-items: flex-start; gap: .75rem; color: var(--muted); font-size: .9375rem; font-weight: 300; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1.1rem; height: 1.1rem; margin: 0; }
.check__box {
  flex: none;
  width: 1.1rem; height: 1.1rem; margin-top: .1rem;
  border: 1px solid var(--muted);
  border-radius: 50%;
  transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent-ink); box-shadow: inset 0 0 0 3px var(--bg); }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
.field__error--check { margin-top: -1.25rem; }

.form__submit {
  justify-self: start;
  display: inline-flex; align-items: center; gap: .6em;
  padding: .95em 1.5em;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 500 1.0625rem/1 var(--sans);
  cursor: pointer;
  transition: background-color .3s, color .3s, border-color .3s;
}
.form__submit b { font-weight: 300; transition: transform .5s var(--ease); }
.form__submit:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.form__submit:hover b { transform: translateX(.25em); }
.form__submit:disabled { opacity: .6; cursor: progress; }

/* estados */
.form__state { border-top: 1px solid var(--line); padding-top: 1.25rem; animation: sm-panel .7s var(--ease); }
.form__state-title { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.25rem); line-height: 1.02; font-weight: 800; letter-spacing: -.025em; }
.form__state p { margin: .75rem 0 0; font-weight: 300; font-size: 1.125rem; }
.form__state a { color: var(--fg); font-weight: 500; }

@media (max-width: 1100px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .form__row { grid-template-columns: 1fr; } }

/* ---------- Footer + marquesina ---------- */
.site-footer { padding-top: clamp(7rem, 15vw, 14rem); }
.footer__row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem;
  padding: 0 var(--pad) 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.footer__row p { margin: 0; }

.marquee {
  display: block;
  overflow: hidden;
  padding: clamp(1rem, 2vw, 2rem) 0 clamp(1.5rem, 3vw, 3rem);
  text-decoration: none;
}
.marquee__track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: flex; align-items: center; gap: .18em;
  padding-right: .45em;
  white-space: nowrap;
  font-size: clamp(4.5rem, 12vw, 11rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -.035em;
  -webkit-text-stroke: 1px var(--fg);
  transition: color .4s ease;
}
.marquee:hover .marquee__item { color: transparent; }
.marquee__item em {
  font-style: italic;
  font-weight: 300;
  font-size: .24em;
  line-height: 1.08;
  letter-spacing: -.01em;
  margin-left: .15em;
  color: var(--fg);
  -webkit-text-stroke: 0;
}
.marquee__item b { display: inline-block; font-weight: 200; -webkit-text-stroke: 0; color: var(--accent-ink); transition: transform .6s var(--ease); }
.marquee:hover .marquee__item b { transform: translateX(.12em); }
@keyframes marquee { to { transform: translateX(-50%); } }


/* =========================================================
   Acento fosforito: detalles
   ========================================================= */

/* barra de carga */
.loader__bar {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 3px;
  background: var(--accent-ink);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
}

/* portada: punto final fosforito */
.outline__dot {
  shape-rendering: geometricPrecision;
  fill: var(--accent);
  stroke: var(--accent-edge);
  stroke-width: var(--stroke, .5);
  transform-box: fill-box;
  transform-origin: center;
}
.js .outline__dot { transform: scale(0); }
.js .hero.is-ready .outline__dot { animation: dot-pop 1s cubic-bezier(.34, 1.7, .64, 1) 2.2s both; }
@keyframes dot-pop { from { transform: scale(0); } to { transform: scale(1); } }

.hero__down { display: inline-block; color: var(--accent-ink); transition: transform .5s var(--ease); }
.hero__down:hover { transform: translateY(.25em); }

/* menú: punto en la sección visible */
.nav a { position: relative; }
.nav a::before {
  content: "";
  position: absolute; left: -.85rem; top: 50%;
  width: .4rem; height: .4rem; margin-top: -.2rem;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform .5s var(--ease);
}
.nav a[aria-current]::before { transform: scale(1); }
/* en claro, blanco: la cabecera va en mix-blend-mode: difference y el blanco
   sobre fondo blanco sale negro (el amarillo salía azul). Con el menú de móvil
   abierto la mezcla se anula y el fondo es negro, así que vuelve el amarillo. */
:root[data-theme="light"]:not(.menu-open) .nav a::before { background: #fff; }
@media (max-width: 760px) { .nav a::before { left: -1.1rem; width: .55rem; height: .55rem; margin-top: -.275rem; } }

/* rotulador: frases clave que se marcan al entrar en pantalla */
.mark {
  padding: 0 .1em;
  margin: 0 -.1em;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 55%;
  background-size: 0% 92%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 1.3s var(--ease) .15s, color .5s ease .45s;
}
.mark.is-marked,
.no-js .mark { background-size: 100% 92%; color: var(--on-accent); }

/* enlaces del contacto subrayados en acento */
.statement a { background-image: linear-gradient(var(--accent-ink), var(--accent-ink)); background-size: 100% 2px; }

/* "Actualidad" late: el trabajo sigue en marcha */
.now { color: var(--fg); white-space: nowrap; }
.now::before {
  content: "";
  display: inline-block;
  width: .5em; height: .5em;
  margin-right: .45em;
  vertical-align: .05em;
  border-radius: 50%;
  border: 1px solid var(--accent-edge);
  background: var(--accent);
  animation: now-pulse 2.4s ease-out infinite;
}
@keyframes now-pulse {
  0%        { box-shadow: 0 0 0 0 rgba(244, 255, 26, .6); }
  75%, 100% { box-shadow: 0 0 0 .55em rgba(244, 255, 26, 0); }
}

/* marquesina: el nombre en contorno se enciende al pasar */
.marquee:hover .marquee__item { -webkit-text-stroke-color: var(--marquee-hover); }


/* =========================================================
   Estructura portfolio + CV
   ========================================================= */

/* columna lateral con etiqueta y foto (perfil del CV, sobre mí) */
.section__aside { grid-column: 1 / span 3; align-self: start; position: sticky; top: 4.5rem; }
.section__aside .label { position: static; margin-top: .55rem; }
.portrait { width: min(100%, 15rem); margin-top: 1.5rem; }
@media (max-width: 900px) {
  .section__aside { grid-column: 1 / -1; position: static; margin-bottom: 1.5rem; }
  .section__aside .label { margin: 0; }
  .portrait { width: 9rem; margin-top: 1rem; }
}

/* páginas interiores sin portada */
.section--first { padding-top: clamp(7rem, 14vw, 11rem); }

/* menú: enlace secundario (Portfolio / CV) */
.nav a.nav__alt { opacity: .7; }
.nav a.nav__alt:hover { opacity: 1; }

/* servicios en la portada del portfolio */
.services { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.service {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto;
  gap: var(--gap);
  align-items: baseline;
  padding: clamp(1.25rem, 2.4vw, 2rem) 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.service__name {
  font-size: var(--company, clamp(1.4875rem, 2.72vw, 2.635rem));
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -.01em;
  -webkit-text-stroke: 1px var(--fg);
  transition: color .35s ease;
}
.service__desc { color: var(--muted); font-weight: 300; line-height: 1.45; }
.service b { color: var(--accent-ink); font-weight: 200; font-size: 1.75rem; line-height: 1; transition: transform .5s var(--ease); }
.service:hover .service__name { color: transparent; }
.service:hover b { transform: translateX(.3em); }
.services { --company: clamp(1.4875rem, 2.72vw, 2.635rem); }
@media (max-width: 760px) {
  .service { grid-template-columns: minmax(0, 1fr) auto; row-gap: .5rem; }
  .service__desc { grid-column: 1; grid-row: 2; }
  .service b { grid-row: 1 / span 2; align-self: center; }
}

.section__more { margin-top: clamp(2rem, 4vw, 3rem); }

/* marcas: muro de logos en dos filas de 4 que cambian en oleada */
.logo-wall { position: relative; }
.logos {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}
.logo {
  position: relative;
  aspect-ratio: 220 / 125;
  outline: 1px dashed var(--line);
  outline-offset: -1px;
  overflow: hidden;
  transition: outline-color .4s ease;
}
.logo__face {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 4%;
  --d: calc((var(--r) + var(--c)) * 90ms);
}
.logo__face img {
  width: 100%; height: 100%;
  min-height: 0; /* sin esto, la proporción original del SVG haría la imagen más alta que su hueco */
  object-fit: contain;
  filter: var(--logo-filter);
  opacity: .78;
  transition: opacity .4s ease;
}
.logo:hover { outline-color: var(--accent-ink); }
.logo:hover .logo__face img { opacity: 1; }

/* cambio: la cara que entra sube desde una máscara y se enfoca; la que sale se va hacia arriba */
.js .logo__face {
  clip-path: inset(100% 0 0 0);
  transform: translateY(35%);
  filter: blur(8px);
  opacity: 0;
  transition:
    clip-path .9s var(--ease) var(--d),
    transform 1.1s var(--ease) var(--d),
    filter .8s ease var(--d),
    opacity .5s ease var(--d);
}
.js .logo__face.is-active { clip-path: inset(0 0 0 0); transform: none; filter: blur(0); opacity: 1; }
.js .logo__face.is-leaving { clip-path: inset(0 0 100% 0); transform: translateY(-35%); filter: blur(8px); opacity: 0; }
.js .logo-wall.is-reverse .logo__face { --d: calc((6 - var(--r) - var(--c)) * 90ms); }
.no-js .logo__face:not(.is-active) { display: none; }

/* contador y barra de tiempo */
.logo-wall__bar { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.logo-wall__count b { color: var(--fg); font-weight: 700; }
.logo-wall__track { position: relative; flex: 1; height: 1px; background: var(--line); overflow: hidden; }
.logo-wall__fill { position: absolute; inset: 0; background: var(--accent-ink); transform-origin: left; transform: scaleX(var(--t, 0)); }
.no-js .logo-wall__bar { display: none; }

@media (max-width: 760px) {
  .logos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .logo__face { --d: calc((var(--r) * 2 + var(--c)) * 70ms); }
}

/* llamada a contacto */
.cta__title { margin: 0 0 2rem; max-width: 16em; font-size: clamp(1.75rem, 3.2vw, 3.1rem); line-height: 1.02; font-weight: 800; letter-spacing: -.025em; }

/* páginas de servicio */
.includes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); max-width: 52em; }
.includes li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: .35rem var(--gap); padding: 1rem 0; border-bottom: 1px solid var(--line); }
.includes strong { font-weight: 700; }
.includes span { color: var(--muted); font-weight: 300; line-height: 1.45; }
@media (max-width: 760px) { .includes li { grid-template-columns: 1fr; } }
.related { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.related a {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.1em;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: inherit; text-decoration: none;
  transition: border-color .3s, background-color .3s, color .3s;
}
.related a::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: var(--accent); border: 1px solid var(--accent-edge); }
.related a:hover { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* textos finos: 300 en oscuro, 400 en claro (token --w-fine) */
.statement,
.job__desc,
.job__context,
.job__list > li,
.tools dd,
.contact__sub,
.contact__alt,
.service__desc,
.includes span,
.skills-map__desc,
.field input,
.field select,
.field textarea,
.check,
.form__state p { font-weight: var(--w-fine); }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .loader { display: none; }
  .marquee__track { animation: none; }
  .outline path,
  .js .outline path,
  .js .hero.is-ready .outline path { animation: none; stroke-dasharray: none; }
  .js .hero__foot { opacity: 1; transition: none; }
  .js .timeline .job__company, .js .timeline .job__years, .js .timeline .job__role, .js .timeline .job__context,
  .js .timeline .job__desc, .js .timeline .job__list > li,
  .js .timeline .sub__head, .js .timeline .sub__role, .js .timeline .sub__desc {
    clip-path: none; opacity: 1; transform: none; filter: none; color: inherit;
  }
  .js .timeline .job__company { color: var(--fg); }
  .js .timeline .sub::before { transform: none; }
  .job::before, .sub::after { transform: none; opacity: .3; animation: none !important; }
  .job__dot::after, .sub__dot::after { animation: none !important; }
  .js .outline__dot { transform: none; animation: none !important; }
  .mark { background-size: 100% 92%; color: var(--on-accent); }
  .now::before { animation: none; }
  .js .logo__face, .js .logo__face.is-leaving { transition: none; transform: none; filter: none; clip-path: none; }
  .js .works .work .slot { clip-path: none; }
  .js .project__title, .js .project__meta, .js .project__intro, .js .project__media .slot, .js .notfound__links { animation: none; }
  .sm-edge { stroke-dashoffset: 0; transition: none; }
  .sm-node { opacity: 1; }
  .sm-node__dot { transform: none; }
  .skills-map .sm-edge.is-on { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
