/* =========================================================
   COLORES — cambia aquí la paleta de toda la web
   (p1–p3: degradados de las tarjetas de proyectos)
   ========================================================= */
:root {
  --bg: #f4f7f4;
  --bg-2: #e8eee9;
  --surface: #ffffff;
  --text: #0b1a10;
  --muted: #536459;
  --faint: #a0aea4;
  --border: rgb(11 26 16 / .1);
  --accent: #0f9d58;
  --accent-2: #0aa39a;
  --accent-3: #67d79a;
  --on-accent: #ffffff;
  --live: #16a34a;
  --p1a: #059669;
  --p1b: #39e58c;
  --p2a: #0e7490;
  --p2b: #22d3ee;
  --p3a: #15803d;
  --p3b: #a3e635;
  --shadow: 0 30px 60px -20px rgb(11 26 16 / .16);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #070a08;
  --bg-2: #0c110d;
  --surface: #0f1611;
  --text: #e6f2ea;
  --muted: #8fa396;
  --faint: #4c5c51;
  --border: rgb(120 255 170 / .1);
  --accent: #39e58c;
  --accent-2: #00d1b2;
  --accent-3: #1a7f4b;
  --on-accent: #04140b;
  --live: #39e58c;
  --p1a: #059669;
  --p1b: #39e58c;
  --p2a: #0e7490;
  --p2b: #22d3ee;
  --p3a: #15803d;
  --p3b: #a3e635;
  --shadow: 0 30px 60px -20px rgb(0 0 0 / .7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070a08;
    --bg-2: #0c110d;
    --surface: #0f1611;
    --text: #e6f2ea;
    --muted: #8fa396;
    --faint: #4c5c51;
    --border: rgb(120 255 170 / .1);
    --accent: #39e58c;
    --accent-2: #00d1b2;
    --accent-3: #1a7f4b;
    --on-accent: #04140b;
    --live: #39e58c;
    --p1a: #059669;
    --p1b: #39e58c;
    --p2a: #0e7490;
    --p2b: #22d3ee;
    --p3a: #15803d;
    --p3b: #a3e635;
    --shadow: 0 30px 60px -20px rgb(0 0 0 / .7);
    color-scheme: dark;
  }
}

/* =========================================================
   BASE
   ========================================================= */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --radius: 22px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .4s ease, color .4s ease;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
em { font-family: var(--mono); font-style: normal; font-weight: 500; letter-spacing: -.06em; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: fixed; left: -999px; top: 12px; z-index: 200;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 14px; border-radius: 10px;
}
.skip:focus { left: 12px; }

@media (max-width: 640px) { .hide-sm { display: none; } }

/* Barra de progreso de lectura */
.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.progress span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%; transform: scaleX(0);
}

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: 600 15px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform .35s var(--ease), background-color .3s, border-color .3s, color .3s, box-shadow .3s;
  will-change: transform;
}
.btn svg { width: 18px; height: 18px; transition: transform .35s var(--ease); }
.btn:hover svg { transform: translateX(4px); }
.btn--primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 12px 30px -10px var(--accent); }
.btn--ghost:hover { border-color: var(--text); }
.btn--small { padding: 10px 18px; font-size: 14px; }
.btn--xl { padding: 20px 32px; font-size: clamp(16px, 2vw, 20px); }

.icon-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent; color: var(--text);
  cursor: pointer;
  transition: border-color .3s, transform .3s var(--ease);
}
.icon-btn:hover { border-color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* Icono sol/luna según tema */
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* =========================================================
   NAVEGACIÓN
   ========================================================= */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 100;
  transition: transform .5s var(--ease), background-color .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav--scrolled {
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--border);
}
.nav--hidden { transform: translateY(-100%); }
body.menu-open .nav { transform: none; background: transparent; border-color: transparent; backdrop-filter: none; }

.nav__inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.nav__logo { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.nav__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.nav__name { font-weight: 600; letter-spacing: -.01em; }

.nav__links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  position: relative; display: block;
  padding: 8px 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: color .25s, background-color .25s;
}
.nav__links a:hover { color: var(--text); }
.nav__links a.is-active { color: var(--text); background: var(--bg-2); }

.nav__actions { display: flex; align-items: center; gap: 10px; }

.menu-btn { display: none; gap: 5px; align-content: center; }
.menu-btn span { display: block; width: 16px; height: 1.5px; background: currentColor; transition: transform .35s var(--ease); }
body.menu-open .menu-btn span:first-child { transform: translateY(3.25px) rotate(45deg); }
body.menu-open .menu-btn span:last-child { transform: translateY(-3.25px) rotate(-45deg); }

@media (max-width: 1000px) {
  .nav__links, .nav__cta { display: none; }
  .menu-btn { display: grid; }
}

.mobile-menu {
  position: fixed; inset: 0; z-index: 90;
  display: grid; align-content: center;
  padding: 0 var(--gutter);
  background: var(--bg);
  clip-path: circle(0 at calc(100% - 40px) 36px);
  transition: clip-path .7s var(--ease);
  visibility: hidden;
}
body.menu-open .mobile-menu { clip-path: circle(150% at calc(100% - 40px) 36px); visibility: visible; }
body.menu-open { overflow: hidden; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; }
.mobile-menu a {
  display: block; padding: 6px 0;
  font-size: clamp(36px, 10vw, 56px); font-weight: 600; letter-spacing: -.03em;
  text-decoration: none;
  opacity: 0; transform: translateY(30px);
  transition: opacity .5s, transform .6s var(--ease);
}
body.menu-open .mobile-menu a { opacity: 1; transform: none; }
body.menu-open .mobile-menu li:nth-child(2) a { transition-delay: .05s; }
body.menu-open .mobile-menu li:nth-child(3) a { transition-delay: .1s; }
body.menu-open .mobile-menu li:nth-child(4) a { transition-delay: .15s; }
body.menu-open .mobile-menu li:nth-child(5) a { transition-delay: .2s; }
body.menu-open .mobile-menu li:nth-child(6) a { transition-delay: .25s; }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-items: center;
  padding: 120px 0 100px;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg { position: absolute; inset: 0; z-index: -1; }
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .55;
  will-change: transform;
}
.blob--1 { width: 46vw; height: 46vw; top: -12%; right: -8%; background: var(--accent); animation: float 18s ease-in-out infinite; }
.blob--2 { width: 34vw; height: 34vw; bottom: -10%; right: 22%; background: var(--accent-2); opacity: .4; animation: float 22s ease-in-out infinite reverse; }
.blob--3 { width: 26vw; height: 26vw; top: 30%; left: -8%; background: var(--accent-3); opacity: .25; animation: float 26s ease-in-out infinite; }
@media (max-width: 640px) {
  .blob--1 { width: 90vw; height: 90vw; }
  .blob--2 { width: 70vw; height: 70vw; }
  .blob--3 { display: none; }
}
@keyframes float {
  0%, 100% { translate: 0 0; }
  33% { translate: 4vw 3vw; }
  66% { translate: -3vw 2vw; }
}
.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
}

.hero__content { will-change: transform, opacity; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  backdrop-filter: blur(8px);
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--live); animation: pulse 2s ease-out infinite;
}
@keyframes pulse { to { transform: scale(3); opacity: 0; } }

.hero__title {
  margin: 28px 0 28px;
  font-size: clamp(60px, 16vw, 176px);
  font-weight: 600;
  line-height: .92;
  letter-spacing: -.055em;
}
.hero__title em { letter-spacing: -.07em; }
.hero__title .accent { color: var(--accent); }
.line { display: block; overflow: hidden; padding-bottom: .06em; }
.line > span { display: inline-block; }

.hero__sub {
  max-width: 640px;
  font-size: clamp(19px, 2.2vw, 24px);
  line-height: 1.45;
  color: var(--muted);
}

.rotator {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -.03em;
  white-space: nowrap;
}

/* Cursores de terminal */
.caret {
  display: inline-block;
  width: .55em; height: 1.05em;
  margin-left: 2px;
  vertical-align: -.17em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
.caret-blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

.scroll-cue { position: absolute; left: 50%; bottom: 32px; translate: -50% 0; color: var(--muted); }
.scroll-cue__mouse {
  display: block; width: 24px; height: 38px;
  border: 1.5px solid currentColor; border-radius: 14px;
  position: relative;
}
.scroll-cue__mouse span {
  position: absolute; left: 50%; top: 8px;
  width: 3px; height: 7px; margin-left: -1.5px;
  border-radius: 3px; background: currentColor;
  animation: wheel 1.8s ease-in-out infinite;
}
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(12px); } }

/* Animación de entrada del hero (solo con JS activo) */
.js .line > span { transform: translateY(105%); transition: transform 1.1s var(--ease) var(--d, 0s); }
.js .hero__in { opacity: 0; transform: translateY(20px); transition: opacity .9s ease var(--d, 0s), transform 1s var(--ease) var(--d, 0s); }
.js .scroll-cue.hero__in { transform: translateY(20px); }
.js body.is-loaded .line > span,
.js body.is-loaded .hero__in { opacity: 1; transform: none; }

/* =========================================================
   MARQUESINA
   ========================================================= */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--border);
  padding: 22px 0;
  background: var(--bg-2);
}
.marquee__track {
  display: flex; align-items: center; gap: 36px;
  width: max-content;
  animation: marquee 40s linear infinite;
  font-size: clamp(20px, 3vw, 32px); font-weight: 500; letter-spacing: -.02em;
  white-space: nowrap;
}
.marquee__track i { font-style: normal; color: var(--accent); font-size: .7em; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* =========================================================
   SECCIONES
   ========================================================= */
.section { padding: clamp(96px, 14vw, 180px) 0; }
.section__head { margin-bottom: clamp(48px, 7vw, 88px); }

.label {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
}
.label span {
  display: inline-grid; place-items: center;
  min-width: 34px; height: 24px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 999px;
  font-size: 11px; letter-spacing: .05em; color: var(--text);
}

.h2 {
  font-size: clamp(40px, 7vw, 88px);
  font-weight: 600; line-height: 1; letter-spacing: -.045em;
}
.h2 em { color: var(--accent); }

/* Aparición al hacer scroll */
.js [data-reveal] {
  opacity: 0; transform: translateY(40px);
  transition: opacity 1s ease var(--d, 0s), transform 1.1s var(--ease) var(--d, 0s);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Sobre mí ---------- */
.statement {
  max-width: 1050px;
  font-size: clamp(28px, 4.6vw, 58px);
  font-weight: 500; line-height: 1.15; letter-spacing: -.035em;
}
.statement .w { opacity: .14; transition: opacity .25s linear; }
.statement .w.is-lit { opacity: 1; }

.about {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(40px, 8vw, 120px);
  margin-top: clamp(64px, 9vw, 120px);
}
.about__text { display: grid; gap: 20px; color: var(--muted); font-size: 18px; max-width: 520px; }
.certs { margin-top: 8px; }
.certs__title { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.certs .chips { margin: 14px 0 0; }
.stats { display: grid; gap: 0; margin: 0; }
.stat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 20px;
  padding: 22px 0; border-top: 1px solid var(--border);
}
.stat:last-child { border-bottom: 1px solid var(--border); }
.stat dt { color: var(--muted); font-size: 15px; }
.stat dd { margin: 0; font-size: clamp(40px, 5vw, 64px); font-weight: 600; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }

/* ---------- Servicios ---------- */
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .services { grid-template-columns: 1fr; } }

.service {
  position: relative;
  padding: clamp(28px, 3vw, 40px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform .5s var(--ease), border-color .3s, opacity 1s ease var(--d, 0s);
}
.service:hover { transform: translateY(-6px); }
.service h3 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin: 28px 0 12px; }
.service p { color: var(--muted); }
.service ul { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--border); display: grid; gap: 8px; font-size: 15px; }
.service li::before { content: "→ "; color: var(--accent); }
.service__icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--bg-2); color: var(--accent);
}
.service__icon svg { width: 24px; height: 24px; }

/* Brillo que sigue al ratón */
.spotlight::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
  opacity: 0; transition: opacity .4s;
}
.spotlight:hover::before { opacity: 1; }
.spotlight > * { position: relative; }

/* ---------- Proyectos (tarjetas apiladas) ---------- */
.projects { display: grid; gap: 28px; }
.project {
  position: sticky;
  top: calc(100px + var(--i, 0) * 24px);
  display: grid; grid-template-columns: 1fr 1.25fr; gap: clamp(24px, 4vw, 56px); align-items: center;
  min-height: min(560px, 76vh);
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform-origin: 50% 0;
  transform: scale(calc(1 - var(--p, 0) * .06));
  filter: brightness(calc(1 - var(--p, 0) * .25));
  will-change: transform;
}
.project__meta { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; font-weight: 500; }
.project__meta span { color: var(--text); font-weight: 600; }
.project__title { margin: 16px 0 16px; font-size: clamp(30px, 4vw, 52px); font-weight: 600; letter-spacing: -.04em; line-height: 1.02; }
.project__info > p:not(.project__meta) { color: var(--muted); max-width: 440px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 24px 0 32px; }
.chips li { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-weight: 500; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  padding-bottom: 4px;
  transition: background-size .45s var(--ease);
}
.link-arrow:hover { background-size: 100% 1.5px; }
.link-arrow svg { width: 18px; height: 18px; transition: transform .35s var(--ease); }
.link-arrow:hover svg { transform: translate(3px, -3px); }

.project__media {
  position: relative;
  height: 100%; min-height: 300px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--g1), var(--g2));
  overflow: hidden;
  display: grid; place-items: center;
  padding: 8% 8% 0;
  align-items: end;
}
.project__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.term {
  width: 100%; min-height: 86%;
  border-radius: 12px 12px 0 0;
  background: #0b0f0c;
  box-shadow: 0 -10px 40px rgb(0 0 0 / .28);
  overflow: hidden;
  font: 500 clamp(11.5px, 1.1vw, 14px)/1.8 var(--mono);
  color: #cfe0d4;
  transition: transform .8s var(--ease);
}
.project:hover .term { transform: translateY(-8px); }
.term__bar { display: flex; align-items: center; gap: 6px; padding: 11px 14px; background: #121813; border-bottom: 1px solid rgb(255 255 255 / .06); }
.term__bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.term__bar i:nth-child(2) { background: #febc2e; }
.term__bar i:nth-child(3) { background: #28c840; }
.term__bar span { margin-left: 10px; color: #6b7d71; font-size: .85em; }
.term__body { padding: 18px 20px 24px; }
.term__line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term .caret { background: #39e58c; }
.t-p { color: #39e58c; font-weight: 700; }
.t-c { color: #6b7d71; }
.t-k { color: #22d3ee; }
.t-ok { color: #a3e635; }
/* Las líneas aparecen una a una al llegar a la tarjeta */
.js .term .term__line { opacity: 0; transform: translateY(4px); }
.js .term.is-in .term__line {
  opacity: 1; transform: none;
  transition: opacity .25s ease calc(.3s + var(--i) * .32s), transform .25s ease calc(.3s + var(--i) * .32s);
}

@media (max-width: 860px) {
  .project { position: relative; top: auto; grid-template-columns: 1fr; transform: none; filter: none; min-height: 0; }
  .project__media { order: -1; min-height: 240px; }
}

/* ---------- Laboratorio (proyectos personales) ---------- */
.section__intro { max-width: 560px; margin-top: 24px; color: var(--muted); font-size: 18px; }
.repos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .repos { grid-template-columns: 1fr; } }
.repo {
  --pad: clamp(24px, 3vw, 36px);
  position: relative;
  display: flex; flex-direction: column;
  padding: var(--pad);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.repo__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font: 500 13px/1.5 var(--mono); letter-spacing: -.02em; color: var(--muted); }
.repo__path { display: flex; align-items: flex-start; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.repo__path svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }
.repo__path b { color: var(--text); font-weight: 700; }
.repo__meta { color: var(--faint); white-space: nowrap; }
.repo h3 { margin: 24px 0 10px; font-size: clamp(22px, 2.4vw, 28px); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.repo > p { color: var(--muted); }
.repo .chips { margin: 20px 0 28px; }
.repo .link-arrow { margin-top: auto; align-self: flex-start; }
.repos__all { margin-top: 40px; }

/* Tarjetas que aparecen al hacer scroll y luego se elevan al pasar el ratón */
.js .service.is-in, .js .repo.is-in { transition: opacity 1s ease var(--d, 0s), transform .5s var(--ease), border-color .3s; }
.js .service.is-in:hover, .js .repo.is-in:hover { transform: translateY(-6px); }
.repo:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

/* ---------- Laboratorio: gráficos animados (siempre oscuros, como las terminales) ---------- */
.repo__media {
  position: relative;
  aspect-ratio: 16 / 10;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 26px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0b0f0c;
  container-type: inline-size;
  font-family: var(--mono);
}
.repo__media svg { fill: none; stroke: none; }

/* Mapa de la ruta */
.viz-map__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.viz-grid { stroke: rgb(57 229 140 / .07); stroke-width: 1; }
.viz-sea { fill: rgb(34 211 238 / .07); }
.viz-sea__label { fill: rgb(34 211 238 / .35); font-size: 7px; letter-spacing: .3em; }
.viz-road { stroke: rgb(255 255 255 / .06); stroke-width: 1.2; }
.viz-route-bg { stroke: rgb(57 229 140 / .18); stroke-width: 2; stroke-dasharray: 3 4; stroke-linecap: round; }
.viz-route { stroke: #39e58c; stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 0 4px rgb(57 229 140 / .6)); }
.viz-town circle { fill: #4c5c51; }
.viz-town text { fill: #6b7d71; font-size: 8px; }
.viz-city circle { fill: #0b0f0c; stroke: #39e58c; stroke-width: 2; }
.viz-city text { fill: #cfe0d4; font-size: 10px; font-weight: 700; }
.viz-car__dot { fill: #e6f2ea; stroke: #39e58c; stroke-width: 2; }

.viz-hud {
  position: absolute; top: 4cqw; left: 4cqw; right: 4cqw;
  display: flex; flex-wrap: wrap; gap: 1.6cqw;
  font-size: clamp(10px, 2.3cqw, 13px); color: #8fa396;
}
.viz-hud span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .45em .8em; border-radius: 999px;
  background: rgb(11 15 12 / .75); border: 1px solid rgb(255 255 255 / .08);
  backdrop-filter: blur(4px);
}
.viz-hud b { color: #e6f2ea; font-weight: 700; font-variant-numeric: tabular-nums; }
.viz-hud--bottom { top: auto; bottom: 4cqw; color: #6b7d71; }
.viz-hud--bottom b { color: #22d3ee; }
.viz-live { width: 7px; height: 7px; border-radius: 50%; background: #39e58c; box-shadow: 0 0 0 3px rgb(57 229 140 / .2); animation: blink 1.4s steps(1) infinite; }

/* Ordenador de buceo */
.viz-dive {
  display: grid; grid-template-columns: 40% 1fr; align-items: center; gap: 4cqw;
  padding: 0 5cqw;
  background:
    radial-gradient(90% 60% at 30% -10%, rgb(34 211 238 / .22), transparent 60%),
    linear-gradient(180deg, #06323a 0%, #041a1f 55%, #030d10 100%);
}
.viz-bubbles { position: absolute; inset: 0; pointer-events: none; }
.viz-bubbles i {
  position: absolute; bottom: -12px; left: var(--x);
  width: var(--s); height: var(--s); border-radius: 50%;
  border: 1px solid rgb(165 243 252 / .45); background: rgb(165 243 252 / .08);
  animation: bubble var(--t) linear var(--dl) infinite;
}
.viz-bubbles i:nth-child(1) { --x: 8%;  --s: 6px;  --t: 7s;   --dl: 0s; }
.viz-bubbles i:nth-child(2) { --x: 14%; --s: 4px;  --t: 5.5s; --dl: 1.2s; }
.viz-bubbles i:nth-child(3) { --x: 46%; --s: 8px;  --t: 8s;   --dl: 2.5s; }
.viz-bubbles i:nth-child(4) { --x: 52%; --s: 5px;  --t: 6s;   --dl: .6s; }
.viz-bubbles i:nth-child(5) { --x: 78%; --s: 7px;  --t: 7.5s; --dl: 3.4s; }
.viz-bubbles i:nth-child(6) { --x: 88%; --s: 4px;  --t: 5s;   --dl: 1.9s; }
.viz-bubbles i:nth-child(7) { --x: 66%; --s: 5px;  --t: 6.5s; --dl: 4.2s; }
@keyframes bubble {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  50% { transform: translate(6px, -45cqw); }
  100% { transform: translate(-4px, -90cqw); opacity: 0; }
}

.viz-device {
  position: relative; z-index: 1;
  padding: 2.2cqw; border-radius: 3cqw;
  background: linear-gradient(160deg, #1d2621, #0c110e);
  border: 1px solid rgb(255 255 255 / .1);
  box-shadow: 0 20px 40px -12px rgb(0 0 0 / .7), inset 0 1px 0 rgb(255 255 255 / .08);
}
.viz-screen {
  aspect-ratio: 128 / 160;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1.15fr 1.5fr .9fr;
  gap: 1px; overflow: hidden; border-radius: 1cqw;
  background: #1c2a22; color: #e6f2ea;
}
.dz { display: flex; flex-direction: column; justify-content: center; padding: 1cqw 1.6cqw; background: #000; min-width: 0; }
.dz small { display: block; font-size: 1.8cqw; color: #6b7d71; letter-spacing: .08em; }
.dz b { font-size: 3.4cqw; font-weight: 700; color: #e6f2ea; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dz--depth small { display: inline; }
.dz--depth { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 1cqw; }
.dz--depth b { font-size: 7.4cqw; color: #22d3ee; text-align: right; }
.dz--depth span { font-size: 2.4cqw; color: #8fa396; }
.dz--compass { align-items: center; gap: .4cqw; }
.dz--compass b { font-size: 2.6cqw; color: #39e58c; }
.dz--stack { gap: 1.4cqw; }
.dz--ndl { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; }
.dz--ndl b { color: #a3e635; }
.dz--ndl.is-stop small, .dz--ndl.is-stop b { color: #fbbf24; }
.viz-rose { width: 82%; }
.viz-rose__ring { stroke: #2c3a31; stroke-width: 1.5; }
.viz-rose__ticks { stroke: #4c5c51; stroke-width: 3; stroke-dasharray: .8 3.39; }
.viz-rose__n { fill: #ef4444; }
.viz-rose__mark { fill: #39e58c; }
.viz-rose text { fill: #cfe0d4; font: 700 7px var(--mono); text-anchor: middle; }

.viz-profile { position: relative; z-index: 1; width: 100%; }
.viz-profile__grid path { stroke: rgb(255 255 255 / .08); stroke-width: 1; stroke-dasharray: 2 3; }
.viz-profile__grid text { fill: rgb(207 224 212 / .45); font-size: 7px; text-anchor: end; }
.viz-profile__stop { fill: rgb(251 191 36 / .1); }
.viz-profile__stop-label { fill: rgb(251 191 36 / .7); font-size: 6.5px; }
.viz-profile__plan { stroke: rgb(165 243 252 / .2); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 2 3; }
.viz-profile__done { stroke: #22d3ee; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 4px rgb(34 211 238 / .6)); }
.viz-profile__diver { fill: #e6f2ea; stroke: #22d3ee; stroke-width: 2; }

/* ---------- Trayectoria ---------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before, .timeline::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px;
  background: var(--border);
}
.timeline::after {
  background: linear-gradient(var(--accent), var(--accent-2));
  transform-origin: 0 0; transform: scaleY(var(--fill, 0));
  width: 2px; left: -.5px;
}
.timeline__item {
  position: relative;
  display: grid; grid-template-columns: 240px 1fr; gap: 24px;
  padding: 0 0 56px 48px;
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: ""; position: absolute; left: -6px; top: 8px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--faint);
  transition: border-color .4s, background-color .4s, transform .4s var(--ease);
}
.timeline__item.is-active::before { border-color: var(--accent); background: var(--accent); transform: scale(1.2); }
.timeline__date { color: var(--muted); font-size: 15px; font-weight: 500; padding-top: 2px; font-variant-numeric: tabular-nums; }
.timeline__item h3 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 600; letter-spacing: -.03em; line-height: 1.2; margin-bottom: 8px; }
.timeline__item h3 span { color: var(--muted); font-weight: 400; }
.timeline__item p:not(.timeline__date) { color: var(--muted); max-width: 560px; }
.js .timeline__item > * { opacity: .35; transition: opacity .6s ease; }
.js .timeline__item.is-active > * { opacity: 1; }
@media (max-width: 760px) {
  .timeline__item { grid-template-columns: 1fr; gap: 6px; padding-left: 32px; }
}

/* ---------- Contacto ---------- */
.contact {
  position: relative;
  padding: clamp(110px, 16vw, 200px) 0;
  border-top: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
}
.contact__glow {
  position: absolute; z-index: -1;
  width: 70vw; height: 70vw; left: 50%; bottom: -55vw; translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), transparent 65%);
  opacity: .35; filter: blur(40px);
}
.contact__title {
  font-size: clamp(44px, 9vw, 128px);
  font-weight: 600; line-height: .98; letter-spacing: -.05em;
}
.contact__title em { color: var(--accent); }
.contact__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 56px; }
.contact__actions .btn--primary { overflow-wrap: anywhere; }
.social { display: flex; flex-wrap: wrap; gap: 12px 32px; list-style: none; padding: 0; margin: 56px 0 0; }
.social a { color: var(--muted); text-decoration: none; font-weight: 500; transition: color .25s; }
.social a:hover { color: var(--text); }

/* ---------- Pie ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: 14px; color: var(--muted); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.footer__clock { font-variant-numeric: tabular-nums; }
.footer__top { text-decoration: none; }
.footer__top:hover { color: var(--text); }

/* ---------- Aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 150;
  translate: -50% 0;
  padding: 12px 20px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(20px);
  transition: opacity .3s, transform .4s var(--ease);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: none; }

/* ---------- Página 404 ---------- */
.notfound { min-height: 100svh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 20px; padding: 20px; }
.notfound h1 { font-size: clamp(96px, 20vw, 200px); font-weight: 600; letter-spacing: -.06em; line-height: 1; }
.notfound p { color: var(--muted); font-size: 19px; }

/* =========================================================
   MOVIMIENTO REDUCIDO — respeta la preferencia del sistema
   ========================================================= */
/* =========================================================
   TOQUE TERMINAL — monoespaciada en etiquetas y metadatos
   ========================================================= */
.eyebrow, .label, .nav__mark, .timeline__date, .project__meta, .chips li,
.certs__title, .stat dt, .service li, .marquee__track, .footer { font-family: var(--mono); }
.eyebrow { font-size: 13px; letter-spacing: -.01em; }
.label { letter-spacing: .02em; text-transform: lowercase; }
.label::before { content: "//"; color: var(--accent); margin-right: -4px; }
.label span { min-width: 0; height: auto; padding: 0; border: 0; border-radius: 0; font-size: inherit; color: var(--accent); }
.certs__title { letter-spacing: .04em; }
.chips li, .stat dt, .service li, .footer { letter-spacing: -.02em; }
.marquee__track { letter-spacing: -.04em; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js [data-reveal], .js .hero__in, .js .line > span { opacity: 1; transform: none; }
  .project { transform: none; filter: none; }
  .js .term .term__line { opacity: 1; transform: none; }
}
