/*
 * Versión clásica del portfolio: sobria, de una columna, pensada para leerla rápido.
 * Misma paleta lila/azul que el escritorio, pero con tipografía normal y mucho aire.
 */

/* Un solo tema: el oscuro moradito, igual que el escritorio */
:root {
  color-scheme: dark;
  --ink: #eee9ff;
  --muted: #a49cc9;
  --line: #2e2952;
  --bg: #14122a;
  --bg-alt: #1a1738;
  --card: #1d1a3c;
  --accent: #a992ff;
  --accent-dk: #c4b4ff;
  --blue: #8fa3ff;
  --pink: #ff8fc7;
  --ok: #4ade80;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Plus Jakarta Sans', var(--font);
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; margin: 0 0 12px; }
h1 { font-size: clamp(34px, 5.2vw, 54px); letter-spacing: -.02em; }
h2 { font-size: clamp(24px, 3.2vw, 32px); letter-spacing: -.01em; }
h3 { font-size: 17px; }
p { margin: 0 0 14px; }
a { color: var(--accent); }
img { max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1080px, 100% - 40px); margin: 0 auto; }
.skip {
  position: absolute; left: -999px; top: 8px; z-index: 50;
  padding: 10px 16px; background: var(--accent); color: #fff; border-radius: 8px;
}
.skip:focus { left: 16px; }

/* ---------- Cabecera ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { display: flex; align-items: center; gap: 18px; height: 68px; }
.brand { font: 700 18px var(--font-head); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 6px; margin-left: auto; }
.nav a {
  padding: 7px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.nav a:hover { color: var(--ink); background: var(--bg-alt); }
.nav a.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.top-actions { display: flex; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink);
  font: 600 14.5px var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dk); border-color: var(--accent-dk); }
.btn.ghost { background: transparent; }
.btn.os { background: linear-gradient(90deg, #2c3a9e, #9a7cf0) border-box; border-color: transparent; color: #fff; }
.btn.os:hover { filter: brightness(1.08); }
.burger { display: none; }

/* ---------- Presentación ---------- */
.hero { padding: 72px 0 56px; position: relative; overflow: hidden; isolation: isolate; }

/* Dos manchas de color que se mueven muy despacio: dan vida sin distraer */
.hero::before,
.hero::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  border-radius: 50%; will-change: transform;
}
.hero::before {
  top: -200px; right: -160px; width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(169, 146, 255, .20), transparent 62%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%);
  animation: vagar1 26s ease-in-out infinite;
}
.hero::after {
  bottom: -240px; left: -180px; width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(143, 163, 255, .16), transparent 64%);
  background: radial-gradient(circle, color-mix(in srgb, var(--blue) 18%, transparent), transparent 64%);
  animation: vagar2 32s ease-in-out infinite;
}
@keyframes vagar1 {
  0%, 100% { transform: none; }
  33%      { transform: translate(-70px, 60px) scale(1.12); }
  66%      { transform: translate(40px, 110px) scale(.94); }
}
@keyframes vagar2 {
  0%, 100% { transform: none; }
  40%      { transform: translate(90px, -70px) scale(1.1); }
  75%      { transform: translate(140px, 30px) scale(.96); }
}
.hero-in { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 48px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px; padding: 6px 14px;
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); border-radius: 999px;
  color: var(--ok); font-size: 14px; font-weight: 600;
}
.pill::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok);
  animation: latido 2.4s ease-out infinite;
}
@keyframes latido {
  0%       { box-shadow: 0 0 0 0 rgba(74, 222, 128, .45); }
  70%, 100%{ box-shadow: 0 0 0 9px rgba(74, 222, 128, 0); }
}
.role { margin: 6px 0 18px; font: 600 18.5px var(--font-head); color: var(--accent); }

/* Toque de terminal, en pequeñas dosis: comentario en los títulos y un cursor */
h2[data-sec]::before {
  content: '// '; font: 400 .6em var(--font-mono);
  color: var(--accent); opacity: .65; vertical-align: .2em;
}
.role::after {
  content: ''; display: inline-block; width: .48em; height: 1em; margin-left: .3em;
  background: var(--accent); border-radius: 1px; vertical-align: -.14em;
  animation: parpadeo 1.1s steps(1) infinite;
}
@keyframes parpadeo { 50% { opacity: 0; } }
.pitch { max-width: 60ch; color: var(--muted); font-size: 17px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 26px 0 30px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 18px; margin: 0; padding-top: 24px; border-top: 1px solid var(--line); }
.facts dt { font: 500 11.5px var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 600; }

.hero-photo {
  position: relative; display: inline-block; margin: 0; justify-self: center;
  animation: flotar 7s ease-in-out infinite;
}
.hero-photo img {
  position: relative; z-index: 1; display: block;
  width: min(320px, 70vw); height: auto; aspect-ratio: 1; border-radius: 28px; object-fit: cover;
  background: #120f2e;
  box-shadow: var(--shadow), 0 0 0 1px var(--line), 0 0 44px rgba(169, 146, 255, .18);
  transition: transform .35s ease, box-shadow .35s ease;
}
.hero-photo:hover img {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent), 0 0 56px rgba(169, 146, 255, .3);
}
@keyframes flotar {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* Circuito vivo: pistas que salen de detrás de la foto, como si el dibujo siguiera
   fuera del marco, y de vez en cuando una señal que las recorre y enciende su extremo.
   El lienzo mide 520x520 y la foto ocupa el cuadrado 100-420, por eso estas medidas. */
.circuito {
  position: absolute; z-index: 0; pointer-events: none; overflow: visible;
  left: -31.25%; top: -31.25%; width: 162.5%; height: 162.5%;
}
.circuito .traza {
  fill: none; stroke: rgba(169, 146, 255, .24); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.circuito .pad { fill: var(--bg); stroke: rgba(169, 146, 255, .5); stroke-width: 1.5; }
.circuito .pulso {
  fill: none; stroke: var(--accent-dk); stroke-width: 2.6; stroke-linecap: round;
  stroke-dasharray: 10 110; stroke-dashoffset: 10;
  animation: senal var(--t) var(--r) ease-in infinite;
}
.circuito .con-pulso .pad { animation: llega var(--t) var(--r) linear infinite; }
@keyframes senal {
  0%        { stroke-dashoffset: 10; }
  30%, 100% { stroke-dashoffset: -100; }
}
@keyframes llega {
  0%, 29%, 50%, 100% { fill: var(--bg); stroke: rgba(169, 146, 255, .5); }
  32%                { fill: var(--accent); stroke: var(--accent-dk); }
}

/* ---------- Secciones ---------- */
.band { padding: 72px 0; border-top: 1px solid var(--line); }
.band.alt { background: var(--bg-alt); }
.lead { max-width: 62ch; color: var(--muted); margin-bottom: 26px; }
.about { max-width: 68ch; }
.about p { font-size: 17px; }

/* Experiencia */
.timeline { position: relative; margin-top: 28px; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding-bottom: 34px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -26px; top: 7px; width: 14px; height: 14px;
  background: var(--accent); border: 3px solid var(--bg-alt); border-radius: 50%;
}
.job-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.job-top h3 { margin: 0; }
.job-when { margin-left: auto; color: var(--muted); font: 13px var(--font-mono); white-space: nowrap; }
.job-org { margin: 2px 0 10px; color: var(--accent); font-weight: 600; font-size: 15px; }
.timeline ul { display: flex; flex-direction: column; gap: 6px; }
.timeline ul li { position: relative; padding: 0 0 0 18px; color: var(--muted); }
.timeline ul li::before {
  content: ''; position: absolute; left: 0; top: 11px; width: 6px; height: 6px;
  background: var(--pink); border: 0; border-radius: 50%;
}

/* Proyectos */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tag {
  align-self: flex-start; padding: 4px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent); font: 500 11.5px var(--font-mono);
}
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.stack span { padding: 3px 10px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; font: 11.5px var(--font-mono); color: var(--muted); }
.card-links { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 6px; }
.card-links a { font-size: 14.5px; font-weight: 600; text-decoration: none; }
.card-links a:hover { text-decoration: underline; }
.card-links a::after { content: ' →'; }

/* Franja que lleva al escritorio interactivo */
.os-band {
  display: flex; flex-wrap: wrap; gap: 20px;
  align-items: center; justify-content: space-between;
  margin-top: 28px; padding: 24px 26px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-alt);
  background: linear-gradient(120deg, color-mix(in srgb, var(--blue) 12%, var(--bg-alt)), color-mix(in srgb, var(--accent) 14%, var(--bg-alt)));
}
.os-band h3 { margin: 0 0 4px; }
.os-band p { margin: 0; color: var(--muted); font-size: 15px; max-width: 58ch; }

/* Habilidades */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin-bottom: 44px; }
.skills h3 { margin-bottom: 10px; color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span { padding: 5px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 30px; padding-top: 34px; border-top: 1px solid var(--line); }
.cols h3 { margin-bottom: 12px; }
.cols .mt { margin-top: 24px; }
.plain li { margin-bottom: 14px; }
.plain b { display: block; font-weight: 600; }
.plain small { color: var(--muted); font-size: 14px; }
.dots li { position: relative; padding-left: 18px; margin-bottom: 7px; color: var(--muted); }
.dots li::before { content: ''; position: absolute; left: 0; top: 11px; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

/* Contacto */
.contact { background: var(--bg-alt); }
.contact-in { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: center; }
.contact h2 { margin-bottom: 6px; }
.contact .lead { margin-bottom: 0; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* Pie */
.foot { padding: 30px 0 40px; border-top: 1px solid var(--line); }
.foot-in { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; }
.foot p { margin: 0; }
.os-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  background: linear-gradient(90deg, #2c3a9e, #9a7cf0);
  color: #fff; text-decoration: none; font-weight: 600; font-size: 14.5px;
}
.os-link:hover { filter: brightness(1.08); }

/* Aparición suave al hacer scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.seen { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .hero-in { grid-template-columns: 1fr; gap: 32px; }
  .hero-photo { order: -1; justify-self: start; }
  .hero-photo img { width: 168px; border-radius: 22px; }
  .circuito .abajo, .circuito .izq { display: none; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 10px 20px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .nav:not(.open) { display: none; }
  .burger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 38px; padding: 0 9px; margin-left: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  }
  .burger span { height: 2px; background: var(--ink); border-radius: 2px; }
  .top-actions { order: 3; }
  .facts { grid-template-columns: 1fr 1fr; }
  .job-when { order: 3; width: 100%; margin-left: 0; white-space: normal; font-size: 12px; }
  .band { padding: 56px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover, .btn:hover { transform: none; }
  .hero::before, .hero::after, .hero-photo, .pill::before, .role::after, .circuito .pad { animation: none; }
  .circuito .pulso { display: none; }
  .hero-photo:hover img { transform: none; }
}

@media print {
  /* En papel no se imprime el tema oscuro: fondo blanco y tinta negra */
  :root {
    color-scheme: light;
    --ink: #111; --muted: #444; --line: #ccc;
    --bg: #fff; --bg-alt: #fff; --card: #fff;
    --accent: #4b34ab; --blue: #3552d1; --ok: #1f9d63;
    --shadow: none;
  }
  .hero::before, .hero::after, .circuito, .role::after { display: none; }
  .top, .cta, .os-band, .os-link, .burger, .contact-links, .skip { display: none; }
  .band, .hero { padding: 12px 0; border: 0; }
  body { font-size: 11pt; }
  .reveal { opacity: 1; transform: none; }
}
