:root {
  --bg: #0b0f0e;
  --bg-2: #111716;
  --surface: #141b1a;
  --line: #22302d;
  --text: #e8efed;
  --muted: #8a9a96;
  --accent: #34d399;
  --accent-2: #10b981;
  --accent-soft: rgba(52, 211, 153, .12);
  --fail: #f87171;
  --radius: 14px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8f7;
    --bg-2: #eef2f0;
    --surface: #ffffff;
    --line: #dbe3e0;
    --text: #0f1716;
    --muted: #5d6d69;
    --accent: #0d9b72;
    --accent-2: #0b7f5e;
    --accent-soft: rgba(13, 155, 114, .1);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
strong { color: var(--text); font-weight: 600; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.section { padding: clamp(72px, 12vw, 140px) 0 0; }
.section__lead { color: var(--muted); max-width: 620px; margin: -8px 0 40px; }

h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.1; }
h2 { font-size: clamp(32px, 5vw, 54px); font-weight: 700; margin-bottom: 40px; }
h3 { font-size: 20px; font-weight: 600; }

.kicker {
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0 0 16px;
}

/* ---------- NAV ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(16px, calc((100% - 1120px) / 2));
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav__brand { font: 700 13px var(--mono); display: flex; align-items: center; gap: 12px; letter-spacing: .12em; }
.nav__brand img { height: 30px; width: auto; border-radius: 4px; transition: transform .3s; }
.nav__brand:hover img { transform: rotate(-4deg) scale(1.06); }
.nav__links { display: flex; gap: 28px; margin-left: auto; font-size: 14px; }
.nav__links a { color: var(--muted); transition: color .2s; }
.nav__links a:hover { color: var(--text); }
.lang {
  font: 500 12px var(--mono); flex-shrink: 0;
  background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; cursor: pointer; display: flex; gap: 6px;
}
.lang span { transition: color .2s; }
html[lang="es"] .lang [data-l="es"], html[lang="en"] .lang [data-l="en"] { color: var(--accent); }
.menu-btn {
  display: none; width: 40px; height: 40px; flex-shrink: 0;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.menu-btn span { width: 16px; height: 1.5px; background: var(--text); transition: transform .3s; }
.nav.open .menu-btn span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav.open .menu-btn span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 110px 0 80px;
  overflow: hidden;
}
#probes { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 160px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.hero__inner {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto; gap: clamp(32px, 6vw, 80px);
  align-items: center;
  pointer-events: none;
}
.hero__inner a, .hero__inner button { pointer-events: auto; }
.eyebrow { font-size: 13px; letter-spacing: .14em; color: var(--muted); display: flex; align-items: center; gap: 10px; margin: 0 0 22px; }
.status-led {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block;
  box-shadow: 0 0 10px var(--accent);
  animation: blink 2.4s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
h1 {
  font-size: clamp(56px, 10vw, 128px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .92;
  margin-bottom: 28px;
}
.hero__lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); max-width: 560px; margin: 0 0 34px; }
.hl { color: var(--accent); font-size: .9em; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero__loc { color: var(--muted); font-size: 12px; letter-spacing: .1em; margin-top: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 22px; border-radius: 10px;
  font-weight: 600; font-size: 15px;
  border: 1px solid var(--line);
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: #04130d; border-color: var(--accent); }
.btn--primary:hover { box-shadow: 0 10px 30px -8px var(--accent); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero__photo { position: relative; margin: 0; padding: 12px; width: clamp(220px, 21vw, 270px); justify-self: end; }
.hero__photo img {
  border-radius: 6px;
  aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 12%;
  width: 100%; height: auto;
  filter: grayscale(.15) contrast(1.03);
}
.corner { position: absolute; width: 18px; height: 18px; border: 2px solid var(--accent); }
.c1 { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.c2 { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.c3 { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.c4 { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.hero__photo figcaption {
  position: absolute; left: 22px; bottom: 22px; right: 22px;
  font-size: 10px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(8, 12, 11, .78); color: #c8f7e4;
  padding: 6px 10px; border-radius: 4px;
  backdrop-filter: blur(4px);
}
.hero__photo::before {
  /* scan line, like an AOI camera sweeping the board */
  content: ""; position: absolute; left: 12px; right: 12px; top: 12px; height: 2px; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px var(--accent);
  animation: scan 4.5s cubic-bezier(.6, 0, .4, 1) infinite;
  opacity: .8;
}
@keyframes scan { 0% { transform: translateY(0); opacity: 0 } 10% { opacity: .8 } 50% { transform: translateY(calc(var(--photo-h, 400px) - 4px)); opacity: .8 } 60%, 100% { opacity: 0; transform: translateY(calc(var(--photo-h, 400px) - 4px)) } }

.scroll-hint {
  position: absolute; z-index: 2; left: 50%; bottom: 28px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); letter-spacing: .1em;
  animation: float 2.4s ease-in-out infinite;
}
@keyframes float { 50% { transform: translate(-50%, 6px); } }

/* ---------- TERMINAL ---------- */
#testplan { padding-top: 0; }
.term {
  background: #070a09;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(52, 211, 153, .35);
}
.term__bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #1a2421; }
.term__bar i { width: 11px; height: 11px; border-radius: 50%; background: #26322f; }
.term__bar span { margin-left: 10px; font-size: 12px; color: #6f817c; }
.term__body {
  margin: 0; padding: 22px 24px 26px;
  font-size: clamp(11.5px, 1.45vw, 14px); line-height: 1.85;
  color: #b8c7c3; min-height: 360px;
  white-space: pre; overflow-x: auto;
}
.term__body .p { color: #34d399; }
.term__body .c { color: #5c6e69; }
.term__body .v { color: #e8efed; }
.term__body .pass { color: #04130d; background: #34d399; padding: 0 6px; border-radius: 3px; font-weight: 700; }
.term__body .big { color: #34d399; font-weight: 700; }
.cursor { display: inline-block; width: .6em; height: 1.1em; background: #34d399; vertical-align: -.2em; animation: blink 1s steps(1) infinite; }

/* ---------- STATS ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-top: 28px; background: var(--surface);
}
.stat { padding: 28px 26px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { font-size: clamp(38px, 4.5vw, 54px); font-weight: 700; color: var(--accent); line-height: 1; }
.stat > span { font: 700 clamp(28px, 3vw, 38px) var(--mono); color: var(--accent); }
.stat p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- EXPERTISE ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px;
  transition: border-color .3s, transform .3s;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.card__head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.card__head svg { width: 36px; height: 36px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.card > p { color: var(--muted); margin: 0 0 22px; }
.feature { border-left: 2px solid var(--accent); padding: 4px 0 4px 18px; margin-bottom: 24px; }
.feature p { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.tag { display: inline-block; font-size: 13px; }
.tag--strong { color: var(--accent); font-weight: 700; font-size: 14px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.tags li {
  font: 500 12.5px var(--mono);
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.tags li:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- TIMELINE ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; top: 8px; bottom: 8px; left: 220px; width: 1px;
  background: linear-gradient(var(--accent), var(--line) 40%);
}
.job { display: grid; grid-template-columns: 220px 1fr; padding-bottom: 48px; position: relative; }
.job::before {
  content: ""; position: absolute; left: 215px; top: 7px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.job:first-child::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft), 0 0 16px var(--accent); }
.job__meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); padding-right: 32px; }
.job__date { color: var(--text); font-weight: 500; }
.job__body { padding-left: 40px; }
.job__body h3 { font-size: 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job__role { color: var(--accent); font-weight: 500; margin: 4px 0 12px; }
.job__body ul { margin: 0; padding-left: 18px; color: var(--muted); }
.job__body li { margin-bottom: 6px; }
.job__body li::marker { color: var(--accent); }
.pill { font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }

/* ---------- PROJECTS ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.proj {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; display: flex; flex-direction: column;
  transition: transform .3s, border-color .3s;
}
.proj::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%);
  opacity: 0; transition: opacity .3s;
}
.proj:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.proj:hover::after { opacity: 1; }
.proj__id { font-size: 12px; color: var(--accent); letter-spacing: .1em; margin-bottom: 18px; }
.proj h3 { margin-bottom: 10px; }
.proj p { color: var(--muted); margin: 0 0 22px; font-size: 15.5px; }
.proj__stack { margin-top: auto; font-size: 12px; color: var(--muted); padding-top: 16px; border-top: 1px dashed var(--line); }

/* ---------- EDUCATION ---------- */
.edu { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edu__item {
  display: flex; align-items: center; gap: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.edu__item img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 12px; padding: 8px; flex-shrink: 0; }
.edu__item h3 { font-size: 18px; margin-bottom: 4px; }
.edu__item p { margin: 0; color: var(--muted); font-size: 14.5px; }
.certs { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.certs li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.certs li .mono { font-size: 10.5px; color: var(--accent); letter-spacing: .1em; }

/* ---------- CONTACT ---------- */
.contact {
  margin-top: clamp(80px, 12vw, 140px);
  padding: clamp(72px, 10vw, 120px) 0;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 26px 26px,
    var(--bg-2);
}
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; }

.footer { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 28px 0; font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__brand img { height: 22px; width: auto; border-radius: 3px; }
.footer__status { display: flex; align-items: center; gap: 8px; color: var(--accent); }

/* ---------- WHATSAPP ---------- */
.wa {
  position: fixed; z-index: 60;
  right: 20px; bottom: 20px;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: #25d366; color: #fff;
  box-shadow: 0 8px 24px -6px rgba(37, 211, 102, .6), 0 0 0 0 rgba(37, 211, 102, .5);
  animation: wa-in .5s cubic-bezier(.2, .9, .3, 1.3) 1.2s both, wa-glow 2.8s ease-out 2s infinite;
  transition: transform .25s;
}
.wa svg { width: 28px; height: 28px; fill: currentColor; }
.wa:hover { transform: scale(1.08); }
.wa::before {
  /* soft halo that breathes, like a status LED */
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid rgba(37, 211, 102, .45);
  animation: wa-ring 2.8s ease-out 2s infinite;
  opacity: 0;
}
.wa__tip {
  position: absolute; right: calc(100% + 12px); top: 50%;
  transform: translate(6px, -50%);
  white-space: nowrap; font-size: 13px; font-weight: 500;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.wa:hover .wa__tip, .wa:focus-visible .wa__tip { opacity: 1; transform: translate(0, -50%); }
@keyframes wa-in { from { opacity: 0; transform: scale(.4) translateY(20px); } }
@keyframes wa-glow {
  0% { box-shadow: 0 8px 24px -6px rgba(37, 211, 102, .6), 0 0 0 0 rgba(37, 211, 102, .45); }
  70%, 100% { box-shadow: 0 8px 24px -6px rgba(37, 211, 102, .6), 0 0 0 16px rgba(37, 211, 102, 0); }
}
@keyframes wa-ring { 0% { opacity: .9; transform: scale(.9); } 80%, 100% { opacity: 0; transform: scale(1.35); } }

/* ---------- REVEAL ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s cubic-bezier(.2, .7, .2, 1), transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1000px) {
  .nav__brand span { display: none; }
}
@media (max-width: 900px) {
  .hero { min-height: auto; padding: 120px 0 90px; }
  .hero__inner { grid-template-columns: 1fr; gap: 28px; }
  .hero__photo { order: -1; justify-self: start; width: 148px; padding: 8px; }
  .hero__photo img { aspect-ratio: 1; object-position: 50% 14%; }
  .hero__photo figcaption { display: none; }
  .hero__photo::before { left: 8px; right: 8px; top: 8px; }
  .corner { width: 14px; height: 14px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split, .grid, .edu { grid-template-columns: 1fr; }
  .timeline::before { left: 5px; }
  .job { grid-template-columns: 1fr; padding-left: 32px; }
  .job::before { left: 0; }
  .job__meta { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; padding: 0 0 8px; }
  .job__body { padding-left: 0; }
}
@media (max-width: 720px) {
  body { font-size: 16px; line-height: 1.6; }
  .nav { gap: 10px; padding-block: 10px; }
  .menu-btn { display: flex; }
  .lang { margin-left: auto; padding: 0 12px; height: 40px; align-items: center; border-radius: 10px; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; margin: 0;
    padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--line);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .25s, transform .25s, visibility .25s;
  }
  .nav.open { border-bottom-color: var(--line); background: var(--bg); }
  .nav.open .nav__links { opacity: 1; visibility: visible; transform: none; }
  .nav__links a { font-size: 18px; color: var(--text); padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav__links a:last-child { border-bottom: 0; }

  .section { padding-top: 80px; }
  h2 { margin-bottom: 28px; }
  .section__lead { margin-bottom: 28px; }
  .hero { padding: 96px 0 64px; }
  .hero__photo { width: 120px; }
  .eyebrow { font-size: 11px; letter-spacing: .1em; margin-bottom: 16px; }
  h1 { font-size: clamp(52px, 17vw, 80px); margin-bottom: 20px; }
  .hero__lead { margin-bottom: 26px; }
  .hero__cta .btn, .contact__links .btn { flex: 1 1 100%; padding: 15px 20px; }
  .hero__loc { margin-top: 24px; }
  .scroll-hint { display: none; }

  .term__bar span { font-size: 10.5px; margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .term__body { padding: 16px 14px 20px; min-height: 300px; font-size: 10.5px; line-height: 1.8; }
  .stats { margin-top: 16px; }
  .stat { padding: 20px 16px; }
  .stat p { font-size: 13px; }
  .card, .proj { padding: 22px; }
  .card__head svg { width: 30px; height: 30px; }
  .feature { padding-left: 14px; }
  .tags li { font-size: 11.5px; padding: 5px 10px; }
  .job { padding-left: 26px; padding-bottom: 36px; }
  .job__body h3 { font-size: 19px; }
  .job__body ul { font-size: 15px; }
  .edu__item { padding: 18px; gap: 16px; }
  .edu__item img { width: 56px; height: 56px; }
  .edu__item h3 { font-size: 16px; }
  .certs li { flex: 1 1 100%; font-size: 14px; }
  .contact { margin-top: 80px; padding: 64px 0; }
  .contact__links .btn--primary { font-size: 14px; word-break: break-all; }
  .footer { flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-bottom: 88px; }
  .wa { width: 50px; height: 50px; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); }
  .wa svg { width: 26px; height: 26px; }
  .wa__tip { display: none; }
}
@media (hover: none) {
  .proj:hover, .btn:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
