/* ===== Base ===== */
:root {
  --bg: #060907;
  --bg-alt: #090d0a;
  --panel: #0b120d;
  --border: #1e3325;
  --fg: #cde8d4;
  --bright: #eafff0;
  --dim: #8fb39b;
  --green: #3dff77;
  --green-soft: rgba(61, 255, 119, 0.12);
  --amber: #ffb454;
  --amber-soft: rgba(255, 180, 84, 0.12);
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas,
    "DejaVu Sans Mono", "Liberation Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

section[id] { scroll-margin-top: 70px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* scanlines CRT sutiles */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(140, 255, 170, 0.028) 0 1px,
    transparent 1px 3px
  );
}

::selection { background: var(--green); color: #041008; }

.accent { color: var(--green); }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

strong { color: var(--bright); font-weight: 700; }

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(6, 9, 7, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 12px 96px 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.nav-logo {
  font-weight: 700;
  color: var(--fg);
  font-size: 0.95rem;
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; color: var(--bright); }

.nav-links { display: flex; gap: 20px; }
.nav-links a {
  color: var(--dim);
  font-size: 0.85rem;
  white-space: nowrap;
  padding: 8px 0;
  display: inline-block;
}
.nav-links a:hover,
.nav-links a.active { color: var(--green); text-decoration: none; }

.lang-switch {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  white-space: nowrap;
}
.lang-switch:hover {
  border-color: var(--green);
  color: var(--green);
  text-decoration: none;
}

/* ===== Hero ===== */
.hero { padding: 90px 0 70px; border-bottom: 1px solid var(--border); }

.ps1 {
  color: var(--dim);
  font-size: 0.9rem;
  margin-bottom: 10px;
}
.ps1 .user { color: var(--green); }
.ps1 .cmd { color: var(--bright); }

.hero h1 {
  font-size: clamp(2rem, 6.5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--bright);
  text-shadow: 0 0 18px rgba(61, 255, 119, 0.25);
  margin: 4px 0 6px;
}

.hero-role {
  color: var(--green);
  font-size: 0.95rem;
  margin-bottom: 22px;
}

.hero-tagline {
  color: var(--dim);
  max-width: 640px;
  margin-bottom: 26px;
}

.hero .ps1:last-of-type { margin: 0 0 30px; }

.cursor {
  display: inline-block;
  background: var(--green);
  width: 0.55em;
  height: 1.1em;
  vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

/* ===== Botones ===== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: 1px solid var(--green);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.12s ease, color 0.12s ease;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--green); color: #041008; }
.btn-primary:hover { background: transparent; color: var(--green); }

.btn-ghost { color: var(--green); background: transparent; }
.btn-ghost:hover { background: var(--green); color: #041008; }

.btn-small {
  padding: 7px 14px;
  font-size: 0.82rem;
  border-color: var(--border);
  color: var(--fg);
}
.btn-small:hover { border-color: var(--green); color: var(--green); background: transparent; }

/* ===== Secciones ===== */
.section { padding: 64px 0; }
.section:nth-of-type(even) { background: var(--bg-alt); }

.section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--bright);
  border-bottom: 1px dashed var(--border);
  padding-bottom: 12px;
  margin-bottom: 32px;
}
.section h2 .accent { margin-right: 4px; }

.about-grid p { color: var(--dim); max-width: 720px; margin-bottom: 16px; }

/* ===== Proyectos ===== */
.project {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.project:hover { border-color: var(--green); }

.project-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.project h3 { font-size: 1.1rem; font-weight: 700; color: var(--bright); }

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.badge::before { content: "[ "; }
.badge::after { content: " ]"; }
.badge-live { color: var(--green); }
.badge-wip { color: var(--amber); }

.project-tagline { color: var(--green); font-size: 0.85rem; margin-bottom: 14px; }
.project-wip .project-tagline { color: var(--amber); }

.project > p { color: var(--dim); margin-bottom: 16px; }

.project-features { list-style: none; margin-bottom: 18px; }
.project-features li {
  color: var(--dim);
  padding-left: 22px;
  position: relative;
  margin-bottom: 7px;
  font-size: 0.9rem;
}
.project-features li::before {
  content: ">";
  color: var(--green);
  position: absolute;
  left: 2px;
  font-weight: 700;
}
.project-features code {
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 18px;
}
.project-tech span { font-size: 0.78rem; color: var(--dim); }
.project-tech span::before { content: "["; color: var(--border); }
.project-tech span::after { content: "]"; color: var(--border); }

.project-links { display: flex; flex-wrap: wrap; gap: 10px; }

.project-wip { border-style: dashed; }

/* ===== Experiencia ===== */
.job {
  border-left: 1px solid var(--border);
  padding: 2px 0 6px 26px;
  margin-bottom: 34px;
  position: relative;
}
.job::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  background: var(--green);
  box-shadow: 0 0 10px rgba(61, 255, 119, 0.5);
}
.job:last-child { margin-bottom: 0; }

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.job h3 { font-size: 1.05rem; font-weight: 700; color: var(--bright); }
.job-dates { color: var(--green); font-size: 0.8rem; }
.job-meta { color: var(--dim); font-size: 0.8rem; margin: 3px 0 14px; }

/* ===== Skills ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.skill-group {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px 20px;
}
.skill-group h3 {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.skill-group h3::before { content: "# "; color: var(--dim); }
.skill-group ul { list-style: none; }
.skill-group li { color: var(--dim); font-size: 0.88rem; padding: 3px 0; }

/* ===== Formación y certificaciones ===== */
.credentials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.credential {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px 20px;
}
.credential h3 {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}
.credential h3::before { content: "# "; color: var(--dim); }
.credential .credential-langs { margin-top: 16px; }
.credential p { color: var(--dim); font-size: 0.88rem; margin-bottom: 12px; }
.credential p:last-child { margin-bottom: 0; }

/* ===== Contacto ===== */
.section-contact { text-align: center; }
.section-contact h2 { text-align: left; }
.contact-text { color: var(--dim); max-width: 540px; margin: 0 auto 26px; }
.contact-location { display: block; margin-top: 10px; font-size: 0.82rem; }
.contact-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); padding: 24px 0; }
.footer p { color: var(--dim); font-size: 0.78rem; }

/* ===== Accesibilidad ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--green);
  color: #041008;
  font-weight: 700;
  padding: 10px 18px;
}
.skip-link:focus { left: 0; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .btn { transition: none; }
}

/* ===== Impresión ===== */
@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .nav, .skip-link, .hero-actions, .cursor, .project-links { display: none !important; }
  * { text-shadow: none !important; box-shadow: none !important; }
  h1, h2, h3, strong, a, .accent, .hero-role, .ps1 .user, .project-tagline,
  .badge-live, .badge-wip, .job-dates, .skill-group h3, .credential h3 { color: #000 !important; }
  p, li, .ps1, .job-meta, .contact-text, .footer p, .project-tech span { color: #222 !important; }
  .section, .project, .skill-group, .credential, .job {
    background: #fff !important;
    border-color: #999 !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .nav-inner {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
  }
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 14px;
  }
  .nav-links a { font-size: 0.8rem; padding: 8px 2px; display: inline-block; }
  .lang-switch {
    top: 10px;
    right: 12px;
    transform: none;
    padding: 7px 11px;
  }
  section[id] { scroll-margin-top: 112px; }
  .hero { padding: 54px 0 46px; }
  .project { padding: 22px 18px; }
  .job { padding-left: 20px; }
}
