/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --bg-primary: #0a0a0f;
  --bg-card: #111118;
  --accent: #6c63ff;
  --accent2: #00d4ff;
  --text-primary: #f0f0f0;
  --text-secondary: #8b8b9e;
  --gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  --border-soft: rgba(255, 255, 255, 0.06);
  --nav-height: 64px;
  --container: 1200px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

input, textarea, button {
  font-family: inherit;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 5rem 0;
}

.section-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  background: var(--gradient);
  border-radius: 2px;
  margin: 0.85rem auto 0;
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding: 0.85rem 0;
  transition: background 0.3s var(--ease), padding 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
}

.nav.scrolled {
  background: rgba(10, 10, 15, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.55rem 0;
}

.nav-container {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  position: relative;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.4rem 0;
  transition: color 0.25s var(--ease);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link.active { color: var(--text-primary); }
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
}

/* Lang switch */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 1.25rem;
  padding: 0.3rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.lang-switch:hover {
  border-color: rgba(108, 99, 255, 0.4);
}
.lang-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: none;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
}
.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active {
  color: #fff;
  background: var(--gradient);
}
.lang-sep {
  color: rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  user-select: none;
}

/* Hamburger */
.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
  transform-origin: center;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: var(--nav-height) 1.25rem 2rem;
  isolation: isolate;
}

.hero-shapes {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  will-change: transform;
}
.shape-1 {
  width: 420px; height: 420px;
  background: var(--accent);
  top: -140px; left: -120px;
  animation: float1 14s ease-in-out infinite;
}
.shape-2 {
  width: 360px; height: 360px;
  background: var(--accent2);
  bottom: -120px; right: -100px;
  animation: float2 18s ease-in-out infinite;
}
.shape-3 {
  width: 300px; height: 300px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  top: 35%; left: 45%;
  opacity: 0.3;
  animation: float3 20s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(120px, 80px) scale(1.1); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-90px, -60px) scale(1.08); }
}
@keyframes float3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(60px, -50px) scale(1.15); }
}

.particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 780px;
  text-align: center;
}

.hero-greeting {
  font-size: 1rem;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: clamp(3.5rem, 12vw, 7rem);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.hero-typewriter {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.25rem, 3.5vw, 1.875rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  min-height: 2.4rem;
}
.type-caret {
  display: inline-block;
  color: var(--accent2);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 2.25rem;
}

.hero-buttons {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 24px rgba(108, 99, 255, 0.35);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(108, 99, 255, 0.55);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(108, 99, 255, 0.12);
  transform: translateY(-3px);
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-top: 2.5rem;
  align-items: center;
}

.about-avatar {
  display: flex;
  justify-content: center;
}

.avatar-circle {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 6.5rem;
  line-height: 1;
  box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.6);
  animation: avatarGlow 3s ease-in-out infinite;
}
.avatar-circle::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: var(--gradient);
  opacity: 0.35;
  filter: blur(24px);
  z-index: -1;
  animation: avatarBlur 3s ease-in-out infinite;
}
@keyframes avatarGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.55); }
  50%      { box-shadow: 0 0 0 18px rgba(0, 212, 255, 0); }
}
@keyframes avatarBlur {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.08); }
}

.about-bio {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.about-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.mini-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 1.1rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  text-align: center;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.mini-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.mini-card svg {
  width: 28px;
  height: 28px;
  color: var(--accent2);
}
.mini-card span {
  font-weight: 600;
  font-size: 0.9rem;
}

/* ============================================================
   STACK
   ============================================================ */
.stack-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.stack-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 2rem 1.75rem;
  text-align: center;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.stack-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 16px 50px rgba(108, 99, 255, 0.3);
}

.stack-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
}

.stack-card h3 {
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
}

.progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: 999px;
  transition: width 1.2s var(--ease);
}
.progress-value {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.stack-footer {
  text-align: center;
  margin-top: 2.5rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.contact-card:hover {
  transform: translateX(6px);
  border-color: var(--accent);
}

.contact-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(108, 99, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent2);
}
.contact-icon svg { width: 22px; height: 22px; }
.contact-icon--wa { background: rgba(37, 211, 102, 0.12); }

.contact-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.contact-label { font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.contact-value { font-weight: 600; word-break: break-word; }

/* Form */
.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-field label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
  resize: vertical;
}
.contact-form textarea { min-height: 120px; }
.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: rgba(139, 139, 158, 0.7);
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.18);
}
.contact-form input.error,
.contact-form textarea.error {
  border-color: #ff5b73;
  box-shadow: 0 0 0 4px rgba(255, 91, 115, 0.15);
}

.form-submit { align-self: flex-start; margin-top: 0.25rem; }

.form-success,
.form-error-msg {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  font-weight: 600;
  transition: opacity 0.4s var(--ease), max-height 0.4s var(--ease), margin 0.4s var(--ease);
}
.form-success { color: var(--accent2); }
.form-error-msg { color: #ff5b73; }

.form-success.show,
.form-error-msg.show {
  opacity: 1;
  max-height: 60px;
  margin-top: 0.25rem;
  animation: fadeInUp 0.5s var(--ease);
}

.form-submit[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  padding: 2.25rem 0;
  border-top: 1px solid var(--border-soft);
  color: var(--text-secondary);
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.footer-text { font-size: 0.9rem; }
.footer-icons {
  display: flex;
  gap: 0.75rem;
}
.footer-icons a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
  color: var(--text-primary);
}
.footer-icons a:hover {
  transform: translateY(-3px);
  background: rgba(108, 99, 255, 0.15);
  border-color: var(--accent);
}
.footer-icons svg { width: 18px; height: 18px; }

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent2);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50px, -50px, 0);
  transition: width 0.25s var(--ease), height 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
  display: none;
}
.cursor.visible { display: block; }
.cursor.hover {
  width: 46px;
  height: 46px;
  background: rgba(108, 99, 255, 0.18);
  border-color: var(--accent);
}

/* ============================================================
   MOBILE NAV (apilado en pantallas pequeñas)
   ============================================================ */
@media (max-width: 767px) {
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: calc(var(--nav-height) + 1rem) 1.5rem 2rem;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-soft);
    transform: translateY(-110%);
    transition: transform 0.35s var(--ease);
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links li { width: 100%; }
  .nav-link {
    display: block;
    padding: 1rem 0;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-primary);
  }
  .nav-link.active::after { display: none; }

  .nav-toggle { display: flex; }

  .lang-switch {
    margin-left: auto;
    margin-right: 0.5rem;
    padding: 0.25rem 0.5rem;
  }
  .lang-btn { font-size: 0.72rem; padding: 0.12rem 0.35rem; }
}

/* ============================================================
   TABLET (>= 768px)
   ============================================================ */
@media (min-width: 768px) {
  .section { padding: 6.5rem 0; }

  .about-grid {
    grid-template-columns: 280px 1fr;
    gap: 3.5rem;
  }

  .stack-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }

  .contact-grid {
    grid-template-columns: 1fr 1.1fr;
    gap: 2rem;
    align-items: start;
  }

  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ============================================================
   DESKTOP (>= 1200px)
   ============================================================ */
@media (min-width: 1200px) {
  .section { padding: 8rem 0; }
  .container { padding: 0 2rem; }
  .nav-container { padding: 0 2rem; }
  .hero { padding-left: 2rem; padding-right: 2rem; }
}

/* ============================================================
   DESKTOP CURSOR FINE
   ============================================================ */
@media (min-width: 768px) and (pointer: fine) {
  html.has-cursor, html.has-cursor body { cursor: none; }
  html.has-cursor a,
  html.has-cursor button,
  html.has-cursor input,
  html.has-cursor textarea,
  html.has-cursor [data-cursor] { cursor: none; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
