/* ============================================================
   silicio-sudo · portfolio — dark + neón
   ============================================================ */

:root {
  --bg: #05060a;
  --bg-2: #0a0d16;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8ebf4;
  --muted: #9aa3b8;

  --cyan: #22d3ee;
  --violet: #a855f7;
  --magenta: #e879f9;
  --lime: #a3e635;
  --amber: #fbbf24;
  --rose: #fb7185;
  --blue: #60a5fa;

  --grad: linear-gradient(135deg, var(--cyan), var(--violet));
  --grad-text: linear-gradient(120deg, #67e8f9, #c084fc 55%, #f0abfc);

  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 18px;
  --nav-h: 72px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
strong { color: #fff; font-weight: 600; }
::selection { background: rgba(34, 211, 238, 0.28); color: #fff; }

/* ============ Fondo animado ============ */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: var(--bg); }

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  mix-blend-mode: screen;
  animation: float 20s ease-in-out infinite;
}
.blob-1 { width: 46vw; height: 46vw; background: #0891b2; top: -12%; left: -8%; }
.blob-2 { width: 40vw; height: 40vw; background: #7c3aed; top: 30%; right: -12%; animation-delay: -6s; }
.blob-3 { width: 34vw; height: 34vw; background: #db2777; bottom: -10%; left: 30%; animation-delay: -12s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(6vw, 4vh) scale(1.12); }
  66% { transform: translate(-4vw, -3vh) scale(0.94); }
}

.grid-overlay {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.noise {
  position: absolute; inset: 0; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ Cursor glow ============ */
.cursor-glow {
  position: fixed; z-index: -1;
  width: 480px; height: 480px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.09), rgba(168, 85, 247, 0.06) 45%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
  will-change: transform;
}

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--grad);
  z-index: 60;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.7);
}

/* ============ Navegación ============ */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 56px);
  backdrop-filter: blur(14px);
  background: rgba(5, 6, 10, 0.55);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}
.logo .accent, .accent {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 0.92rem; color: var(--muted);
  position: relative; transition: color 0.25s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 2px; background: var(--grad);
  transition: width 0.3s ease;
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after { width: 100%; }

.nav-right { display: flex; align-items: center; gap: 14px; }

.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.hamburger span {
  width: 22px; height: 2px; background: #fff; border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ Botones ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px;
  font-family: var(--font-head); font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.3s, background 0.3s, border-color 0.3s;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--grad); color: #051018;
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(168, 85, 247, 0.4); }

.btn-ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.25); background: var(--surface-2); transform: translateY(-2px); }

.nav-cta { padding: 9px 18px; font-size: 0.88rem; }

/* ============ Hero ============ */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center;
  padding: clamp(40px, 8vh, 90px) clamp(20px, 6vw, 80px);
}
.hero-inner { max-width: 820px; }

.badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted);
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
  margin-bottom: 24px;
}
.badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34d399; box-shadow: 0 0 10px #34d399;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(3rem, 11vw, 7.5rem);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 0.95;
  margin-bottom: 18px;
}

.hero-sub { font-size: clamp(1rem, 2.2vw, 1.25rem); color: var(--muted); margin-bottom: 22px; }

.typewriter {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--cyan);
  min-height: 1.8em;
  margin-bottom: 30px;
}
.typewriter .prompt { color: var(--violet); font-weight: 700; }
.caret {
  display: inline-block; width: 0.55em; height: 1.1em;
  background: var(--cyan); margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

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

.hero-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 0.9rem; flex-wrap: wrap; }
.hero-meta .sep { color: var(--violet); }

/* ============ Stats ============ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--border);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  max-width: 1100px; margin: 0 auto;
}
.stat {
  background: var(--bg-2);
  padding: 30px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-num {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-num .plus { font-size: 0.6em; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

/* ============ Marquee ============ */
.marquee {
  overflow: hidden; padding: 26px 0;
  border-bottom: 1px solid var(--border);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex; gap: 48px; width: max-content;
  animation: marquee 30s linear infinite;
}
.marquee-track span {
  font-family: var(--font-mono); font-size: 0.95rem;
  color: var(--muted); white-space: nowrap;
  position: relative;
}
.marquee-track span::before {
  content: "◆"; color: var(--cyan); font-size: 0.55rem;
  position: absolute; left: -26px; top: 50%; transform: translateY(-50%);
}
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ Secciones ============ */
.section { padding: clamp(60px, 10vh, 110px) clamp(20px, 6vw, 80px); max-width: 1220px; margin: 0 auto; }

.section-title {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  margin-bottom: 34px; letter-spacing: -0.5px;
}
.section-title .num {
  font-family: var(--font-mono); font-size: 0.45em;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-right: 12px; vertical-align: middle;
}
.section-head { margin-bottom: 34px; }
.section-sub { color: var(--muted); margin-top: -22px; margin-bottom: 34px; font-size: 0.95rem; }

/* ============ Sobre ============ */
.about-grid {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center;
}
.about-text p { color: var(--muted); margin-bottom: 16px; font-size: 1.02rem; }
.about-text .link { color: var(--cyan); border-bottom: 1px solid rgba(34,211,238,0.4); }
.about-text .link:hover { color: #67e8f9; }

.about-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.tag {
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text);
}

/* Terminal */
.terminal {
  background: #0b0e15;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(34,211,238,0.06);
}
.terminal-head {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px; background: rgba(255,255,255,0.04);
  border-bottom: 1px solid var(--border);
}
.t-dot { width: 12px; height: 12px; border-radius: 50%; }
.t-dot.red { background: #ff5f57; }
.t-dot.yellow { background: #febc2e; }
.t-dot.green { background: #28c840; }
.t-title { margin-left: 10px; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }

.terminal-body { padding: 20px 22px; font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.9; }
.terminal-body p { white-space: pre-wrap; }
.t-green { color: #4ade80; }
.t-out { color: #cbd5e1; }
.t-dir { color: #7dd3fc; }

/* ============ Proyectos ============ */
.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}
.loading { color: var(--muted); font-family: var(--font-mono); }

.noscript-list { grid-column: 1 / -1; list-style: none; display: grid; gap: 14px; }
.noscript-list li { color: var(--text); }
.noscript-list a { color: var(--cyan); font-weight: 600; }

.card {
  --a: var(--cyan);
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.08);
  border-color: color-mix(in srgb, var(--a) 22%, rgba(255,255,255,0.08));
  border-radius: var(--radius);
  padding: 26px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.35s cubic-bezier(.2,.7,.3,1.2), box-shadow 0.35s, border-color 0.35s;
  transform-style: preserve-3d;
  will-change: transform;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--a) 14%, transparent), transparent 45%);
  opacity: 0; transition: opacity 0.35s;
  pointer-events: none;
}
.card:hover {
  border-color: color-mix(in srgb, var(--a) 60%, transparent);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 32px color-mix(in srgb, var(--a) 28%, transparent);
}
.card:hover::before { opacity: 1; }

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-emoji {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.6rem;
  background: color-mix(in srgb, var(--a) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--a) 30%, transparent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--a) 18%, transparent);
}
.card-lang {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  display: flex; align-items: center; gap: 6px;
}
.card-lang::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--a); box-shadow: 0 0 8px var(--a);
}

.card-title {
  font-family: var(--font-head); font-size: 1.35rem; font-weight: 700;
  margin-bottom: 8px; letter-spacing: -0.3px;
}
.card-desc { color: var(--muted); font-size: 0.93rem; margin-bottom: 16px; }

.card-features { list-style: none; margin-bottom: 16px; display: grid; gap: 6px; }
.card-features li {
  font-size: 0.86rem; color: var(--text);
  display: flex; gap: 8px; align-items: flex-start;
}
.card-features li::before { content: "›"; color: var(--a); font-weight: 700; line-height: 1.4; }

.card-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.card-tags span {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted);
  padding: 4px 9px; border-radius: 6px; background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.card-foot {
  margin-top: auto; padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-link {
  font-family: var(--font-head); font-weight: 600; font-size: 0.9rem;
  color: var(--a); display: inline-flex; align-items: center; gap: 6px;
  transition: gap 0.2s;
}
.card-link:hover { gap: 10px; }
.card-stars { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.card-stars .star { color: #fbbf24; }

.projects-status { margin-top: 26px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); min-height: 1.4em; }

/* ============ Contacto ============ */
.contact-card {
  position: relative; overflow: hidden;
  text-align: center; padding: clamp(40px, 8vw, 70px) 30px;
  border: 1px solid var(--border); border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}
.contact-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(500px circle at 50% 0%, rgba(168,85,247,0.16), transparent 60%);
  pointer-events: none;
}
.contact-card h3 { font-family: var(--font-head); font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin-bottom: 12px; }
.contact-card p { color: var(--muted); margin-bottom: 28px; max-width: 520px; margin-left: auto; margin-right: auto; }
.contact-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px clamp(20px, 6vw, 80px);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  color: var(--muted); font-size: 0.9rem;
}
.footer a { color: var(--text); border-bottom: 1px solid var(--border); }
.footer a:hover { color: var(--cyan); }
.footer-mono { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }

/* ============ Reveal ============ */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2,.7,.3,1); }
.reveal.visible { opacity: 1; transform: none; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .nav-links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: rgba(5,6,10,0.96); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height 0.35s ease;
    padding: 0 20px;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links a { padding: 16px 0; border-bottom: 1px solid var(--border); }
  .hamburger { display: flex; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2.6rem, 16vw, 4rem); }
  .nav-cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
