:root {
  --bg: #05080a;
  --panel: rgba(8, 18, 13, 0.78);
  --line: rgba(57, 255, 136, 0.18);
  --neon: #39ff88;
  --neon-dim: #1d8f50;
  --cyan: #3ce7ff;
  --text: #d8f5e4;
  --muted: #7fa592;
  --ghost: rgba(216, 245, 228, 0.13);
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; overflow-x: hidden; }
::selection { background: var(--neon); color: var(--bg); }
a { color: var(--neon); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* ---------- capas de fondo ---------- */
#field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; }
.vignette { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 30%, rgba(5,8,10,.85) 100%); }

/* ---------- cursor con coordenadas ---------- */
#cursor { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; }
#cursor .ring { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border: 1px solid var(--neon); border-radius: 50%; transition: width .2s, height .2s, margin .2s, background .2s; }
#cursor.link .ring { width: 56px; height: 56px; margin: -28px 0 0 -28px; background: rgba(57,255,136,.08); }
#cursor .coords { position: absolute; left: 20px; top: 14px; font-size: 10px; color: var(--neon); opacity: .7; white-space: nowrap; }

/* ---------- progreso de scroll ---------- */
#progress { position: fixed; z-index: 30; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; }
#progress i { position: absolute; inset: 0; background: var(--neon); box-shadow: 0 0 10px var(--neon); transform-origin: left; transform: scaleX(0); }
#progress span { position: fixed; left: var(--gutter); bottom: 18px; font-size: 11px; color: var(--muted); letter-spacing: .1em; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.5rem; padding: .9rem var(--gutter); background: rgba(5,8,10,.6); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-weight: 800; text-decoration: none; letter-spacing: .08em; font-size: 1.1rem; }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav nav { display: flex; gap: 1.4rem; margin-left: auto; font-size: .82rem; }
.nav nav a { color: var(--muted); text-decoration: none; transition: color .2s; }
.nav nav a:hover { color: var(--neon); }
.nav-tools { display: flex; gap: .5rem; }
.chip { font-size: .76rem; cursor: pointer; background: transparent; color: var(--neon); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; transition: background .2s, border-color .2s; }
.chip:hover { background: rgba(57,255,136,.1); border-color: var(--neon); }
.chip b { font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- títulos de sección ---------- */
.section { padding: 7rem 0; }
.title { display: flex; align-items: baseline; gap: 1rem; margin: 0 0 .6rem; font-size: clamp(2rem, 6vw, 4rem); line-height: 1; letter-spacing: -.02em; }
.title .num { font-size: .3em; color: var(--neon); border: 1px solid var(--neon); padding: .2em .5em; border-radius: 6px; transform: translateY(-.6em); }
.hint { color: var(--muted); font-size: .8rem; margin: 0 0 2.5rem; min-height: 1.3em; }

/* ---------- HERO ---------- */
.hero { min-height: calc(100vh - 60px); display: flex; flex-direction: column; justify-content: center; padding: 3rem 0 4rem; position: relative; }
.visit { color: var(--muted); font-size: .78rem; min-height: 1.4em; margin: 0 0 1.4rem; letter-spacing: .03em; }
.name { margin: 0; font-weight: 800; font-size: clamp(3.2rem, 13vw, 9.5rem); line-height: .92; letter-spacing: -.04em; user-select: none; }
.name .row { display: block; white-space: nowrap; }
.name .outline .ch { color: transparent; -webkit-text-stroke: 2px var(--neon); }
.name .ch { display: inline-block; min-width: .5em; transition: transform .25s cubic-bezier(.2,.8,.2,1), color .2s, text-shadow .2s; }
.name .ch.hot { color: var(--neon); text-shadow: 0 0 30px rgba(57,255,136,.7); }
.name .outline .ch.hot { color: var(--neon); -webkit-text-stroke: 2px var(--neon); }
.typed { font-size: clamp(1rem, 2.6vw, 1.5rem); color: var(--neon); margin: 1.6rem 0 .6rem; min-height: 1.6em; }
.gt { color: var(--neon); }
.caret { display: inline-block; width: .6em; height: 1.1em; background: var(--neon); vertical-align: -.15em; margin-left: 3px; animation: blink 1s steps(1) infinite; }
.hero-sub { max-width: 640px; color: var(--muted); font-size: 1.15rem; min-height: 3.6em; margin: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin: 2.2rem 0; }
.btn { display: inline-block; font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer; color: var(--neon); background: rgba(5,8,10,.5); border: 1px solid var(--neon); border-radius: 10px; padding: .85rem 1.4rem; transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s, background .2s; }
.btn:hover { box-shadow: 0 0 28px rgba(57,255,136,.35); }
.btn.primary { background: var(--neon); color: var(--bg); }
.btn.big { font-size: clamp(.9rem, 3vw, 1.15rem); }
.sysline { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; color: var(--muted); font-size: .78rem; }
.sysline #sys { min-width: 30ch; white-space: pre; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 8px var(--neon); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.scroll-hint { position: absolute; bottom: 1.5rem; left: 0; font-size: .72rem; color: var(--muted); animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); opacity: .5; } }

/* ---------- 01 ABOUT: texto escrito por scroll ---------- */
.scrolltype p { font-size: clamp(1.35rem, 3.4vw, 2.5rem); line-height: 1.3; font-weight: 500; letter-spacing: -.01em; margin: 0 0 2.2rem; max-width: 30ch; }
.scrolltype p:nth-child(2) { margin-left: auto; text-align: right; }
.scrolltype .on { color: var(--text); }
.scrolltype .off { color: var(--ghost); }
.scrolltype .cur { color: var(--neon); animation: blink .6s steps(1) infinite; }

/* ---------- 02 HOBBIES: scroll horizontal ---------- */
.hscroll { --hs: 1; position: relative; height: 480vh; margin: 0 calc(-1 * var(--gutter)); }
.hs-sticky { position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.hs-head { padding: 0 var(--gutter); }
.hs-track { display: flex; gap: 2rem; padding: 0 var(--gutter); will-change: transform; }
.panel {
  --v: 0;
  flex: 0 0 min(72vw, 760px); min-height: 52vh; padding: 2rem 2.2rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  opacity: calc(.35 + var(--v) * .65); transform: scale(calc(.92 + var(--v) * .08));
}
.p-idx { position: absolute; top: 1.4rem; right: 1.6rem; font-size: .75rem; color: var(--muted); }
.giant { margin: 0; font-size: clamp(2.6rem, 8vw, 6.5rem); line-height: 1; letter-spacing: -.03em; color: transparent; -webkit-text-stroke: 1.5px var(--neon); white-space: nowrap; transition: color .5s, text-shadow .5s; }
.panel.active .giant { color: var(--neon); text-shadow: 0 0 40px rgba(57,255,136,.4); }
.ascii { position: absolute; top: 1.2rem; left: 2rem; margin: 0; color: var(--neon-dim); font-size: .8rem; line-height: 1.25; }
.panel p { color: var(--muted); max-width: 46ch; font-size: 1.05rem; margin: 1rem 0 .6rem; }
.tags { font-size: .72rem; color: var(--neon); letter-spacing: .08em; }
.hs-bar { margin: 2rem var(--gutter) 0; height: 2px; background: var(--line); position: relative; }
.hs-bar i { position: absolute; inset: 0; background: var(--neon); transform-origin: left; transform: scaleX(0); }

/* ---------- 03 STATS ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 2rem; }
.stat { background: rgba(5,8,10,.85); padding: 2rem 1.4rem; display: flex; flex-direction: column; gap: .4rem; filter: blur(8px); opacity: 0; transform: translateY(20px); transition: filter .8s, opacity .8s, transform .8s; }
.stat:nth-child(2) { transition-delay: .1s; } .stat:nth-child(3) { transition-delay: .2s; } .stat:nth-child(4) { transition-delay: .3s; }
.stat.in { filter: none; opacity: 1; transform: none; }
.stat b { font-size: clamp(2.4rem, 6vw, 4rem); color: var(--neon); line-height: 1; font-weight: 800; }
.stat span { color: var(--muted); font-size: .9rem; }
.asciibars { margin-top: 3rem; display: grid; gap: .7rem; font-size: clamp(.68rem, 1.6vw, .9rem); opacity: 0; transition: opacity .6s; }
.asciibars.in { opacity: 1; }
.ab { display: grid; grid-template-columns: minmax(150px, 260px) 1fr; gap: 1rem; align-items: center; }
.ab span { color: var(--muted); }
.ab code { color: var(--neon); white-space: pre; overflow: hidden; }

/* ---------- MARQUEE ---------- */
.marquee { margin: 2rem calc(-1 * var(--gutter)); padding: 2rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; background: rgba(5,8,10,.6); }
.mq-row { white-space: nowrap; font-size: clamp(2rem, 6vw, 4.5rem); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.mq-inner { display: inline-block; will-change: transform; }
.mq-row span { margin: 0 .4em; }
.mq-row i { font-style: normal; color: var(--neon); }
.mq-row.outline { font-size: clamp(1.4rem, 4vw, 3rem); font-weight: 300; }
.mq-row.outline span { color: transparent; -webkit-text-stroke: 1px var(--muted); }

/* ---------- 04 PROYECTOS ---------- */
.projects { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; }
.project {
  --mx: 50%; --my: 50%;
  position: relative; overflow: hidden; padding: 1.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  clip-path: inset(0 0 100% 0); transition: clip-path 1s cubic-bezier(.7,0,.2,1), border-color .3s;
}
.project.in { clip-path: inset(0 0 0 0); }
.project:nth-child(2) { transition-delay: .15s; } .project:nth-child(3) { transition-delay: .3s; }
.project::before { content: ""; position: absolute; inset: 0; background: radial-gradient(380px circle at var(--mx) var(--my), rgba(57,255,136,.14), transparent 60%); opacity: 0; transition: opacity .3s; pointer-events: none; }
.project:hover { border-color: var(--neon); }
.project:hover::before { opacity: 1; }
.project.featured { grid-row: span 2; }
.project h3 { margin: .5rem 0; font-size: clamp(1.3rem, 3vw, 1.8rem); }
.project p { color: var(--muted); }
.pmeta { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.badge { border: 1px solid var(--line); border-radius: 999px; padding: .05rem .6rem; }
.badge.live { color: var(--neon); border-color: var(--neon); }
.badge.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--neon); margin-right: .4em; vertical-align: 1px; animation: pulse 1.4s infinite; }
.checklist { list-style: none; padding: 0; margin: 1.2rem 0; font-size: .82rem; display: grid; gap: .5rem; }
.checklist li::before { content: "[ok] "; color: var(--neon); }
.stack { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.stack span { font-size: .7rem; border: 1px solid var(--line); border-radius: 6px; padding: .15rem .55rem; color: var(--neon); }

/* ---------- 05 DATO ---------- */
.fact-box { position: relative; margin-top: 2rem; padding: 2.2rem 2.2rem 1.6rem; border-left: 3px solid var(--neon); background: linear-gradient(90deg, rgba(57,255,136,.08), transparent 70%); transform-origin: left; transform: scaleX(.2); opacity: 0; transition: transform .9s cubic-bezier(.2,.8,.2,1), opacity .6s; }
.fact-box.in { transform: none; opacity: 1; }
.fact-n { position: absolute; top: .8rem; right: 1rem; color: var(--muted); font-size: .75rem; }
.fact-text { font-size: clamp(1.05rem, 2.6vw, 1.6rem); line-height: 1.45; margin: 0 0 1.4rem; min-height: 2.9em; color: var(--text); }

/* ---------- 06 TERMINAL ---------- */
.term { background: rgba(2,6,4,.94); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 50px rgba(57,255,136,.1), 0 30px 80px rgba(0,0,0,.6); transform: perspective(1200px) rotateX(18deg) translateY(40px); opacity: 0; transition: transform 1s cubic-bezier(.2,.8,.2,1), opacity .8s; }
.term.in { transform: none; opacity: 1; }
.term-bar { display: flex; justify-content: space-between; padding: .65rem 1.1rem; font-size: .72rem; color: var(--muted); background: rgba(57,255,136,.05); border-bottom: 1px solid var(--line); }
.term-body { height: 360px; overflow-y: auto; padding: 1rem 1.2rem .3rem; font-size: .86rem; white-space: pre-wrap; word-break: break-word; }
.term-body .line { margin: 0 0 .3rem; min-height: 1.2em; }
.term-body .cmd { color: var(--text); }
.term-body .cmd b { color: var(--neon); font-weight: 400; }
.term-body .out { color: var(--muted); }
.term-body .hl { color: var(--neon); }
.term-body .dim { opacity: .6; }
.term-body .err { color: #ff6b6b; }
.term-input { display: flex; gap: .6rem; align-items: center; padding: .4rem 1.2rem 1rem; font-size: .86rem; }
.term-input input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text); font: inherit; caret-color: var(--neon); }

/* ---------- 07 CONTACTO ---------- */
.bigword { font-weight: 800; font-size: clamp(3rem, 14vw, 11rem); line-height: 1; letter-spacing: -.04em; margin: 1.5rem 0 1rem; white-space: nowrap; user-select: none; }
.bigword span { --f: 0; display: inline-block; color: transparent; -webkit-text-stroke: 1.5px var(--neon); transition: transform .3s cubic-bezier(.2,.8,.2,1); text-shadow: 0 0 calc(var(--f) * 40px) rgba(57,255,136, calc(var(--f) * .8)); }
.bigword span { color: rgba(57,255,136, var(--f)); }
.contact p { color: var(--muted); font-size: 1.15rem; max-width: 50ch; }
.contact-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; opacity: 0; transform: translateY(20px); transition: opacity .6s, transform .6s; }
.contact-row.in { opacity: 1; transform: none; }

footer { text-align: center; padding: 3rem 1rem 4rem; color: var(--muted); font-size: .76rem; border-top: 1px solid var(--line); }
footer p { margin: .3rem 0; }
.secret { opacity: .3; transition: opacity .3s; }
.secret:hover { opacity: 1; color: var(--neon); }

/* ---------- juego ---------- */
.game { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.82); backdrop-filter: blur(6px); padding: 16px; }
.game[hidden] { display: none; }
.game-box { background: #08110c; border: 1px solid var(--neon); border-radius: var(--radius); padding: 1rem; box-shadow: 0 0 60px rgba(57,255,136,.3); max-width: 100%; }
.game-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .78rem; margin-bottom: .7rem; }
.game-head b { color: var(--neon); }
#snake { display: block; width: min(400px, calc(100vw - 64px)); height: auto; aspect-ratio: 1; background: #020604; border-radius: 8px; touch-action: none; }
.game-help { font-size: .7rem; text-align: center; margin: .7rem 0 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px); z-index: 60; background: var(--neon); color: var(--bg); padding: .6rem 1.1rem; border-radius: 8px; font-size: .82rem; font-weight: 600; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.toast.show { transform: translate(-50%, 0); }

body.party { animation: hue 3s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .nav nav { display: none; }
  .nav-tools { margin-left: auto; }
  .section { padding: 5rem 0; }
  .scrolltype p:nth-child(2) { margin-left: 0; text-align: left; }
  .hscroll { --hs: 0; height: auto; margin: 0; padding: 5rem 0; }
  .hs-sticky { position: static; height: auto; overflow: visible; }
  .hs-head { padding: 0; }
  .hs-track { flex-direction: column; padding: 0; gap: 1rem; }
  .panel { --v: 1; flex: none; min-height: 0; padding: 7.5rem 1.4rem 1.6rem; }
  .panel .giant { font-size: clamp(2rem, 11vw, 3rem); }
  .hs-bar { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .ab { grid-template-columns: 1fr; gap: .1rem; }
  .projects { grid-template-columns: 1fr; }
  .project.featured { grid-row: auto; }
  .term-body { height: 320px; font-size: .76rem; }
  .bigword span { color: rgba(57,255,136,.25); }
  #progress span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stat, .project, .fact-box, .term, .contact-row, .asciibars { opacity: 1 !important; filter: none !important; transform: none !important; clip-path: none !important; }
}
