:root {
  --bg: #0c0d10;
  --surface: #15171c;
  --surface-2: #1b1e24;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f4f6;
  --text-muted: #9aa0aa;
  --text-dim: #6b7280;
  --accent: #1d9e75;
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 920px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #eef0f2;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text: #16181d;
  --text-muted: #565d68;
  --text-dim: #8a9099;
}

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

body, .card, .tech-item, .contact-card, .toggle-btn {
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

html { scroll-behavior: smooth; }

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

/* ---------- Fondo animado ---------- */
.bg-anim {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-anim .blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  will-change: transform;
}
.blob-1 {
  background: #2bb673;
  top: -10%;
  left: -8%;
  animation: drift1 22s ease-in-out infinite, glow1 9s ease-in-out infinite;
}
.blob-2 {
  background: #2f80ed;
  top: 30%;
  right: -12%;
  animation: drift2 28s ease-in-out infinite, glow2 9s ease-in-out infinite;
  animation-delay: 0s, 3s;
}
.blob-3 {
  background: #c1387a;
  bottom: -15%;
  left: 25%;
  animation: drift3 25s ease-in-out infinite, glow3 9s ease-in-out infinite;
  animation-delay: 0s, 6s;
}
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(8vw, 6vh) scale(1.12); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-7vw, 10vh) scale(1.08); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(5vw, -8vh) scale(1.15); }
}
@keyframes glow1 {
  0%, 66%, 100% { opacity: 0.08; }
  16%           { opacity: 0.32; }
}
@keyframes glow2 {
  0%, 66%, 100% { opacity: 0.08; }
  16%           { opacity: 0.32; }
}
@keyframes glow3 {
  0%, 66%, 100% { opacity: 0.08; }
  16%           { opacity: 0.32; }
}
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 0%, transparent 80%);
  opacity: 0.5;
}
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none !important; opacity: 0.2 !important; }
}
:root[data-theme="light"] .blob-1 { animation-name: drift1, glow1-light; }
:root[data-theme="light"] .blob-2 { animation-name: drift2, glow2-light; }
:root[data-theme="light"] .blob-3 { animation-name: drift3, glow3-light; }
@keyframes glow1-light {
  0%, 66%, 100% { opacity: 0.04; }
  16%           { opacity: 0.18; }
}
@keyframes glow2-light {
  0%, 66%, 100% { opacity: 0.04; }
  16%           { opacity: 0.18; }
}
@keyframes glow3-light {
  0%, 66%, 100% { opacity: 0.04; }
  16%           { opacity: 0.18; }
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.nav-logo img { width: 32px; height: 32px; border-radius: var(--radius-sm); object-fit: cover; }
.nav-name { font-size: 16px; font-weight: 600; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-size: 14px; color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-toggles { display: flex; align-items: center; gap: 8px; }
.toggle-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}
.toggle-btn:hover { color: var(--text); border-color: var(--border-strong); }
.lang-btn { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; width: auto; padding: 0 10px; }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3.5rem;
  text-align: center;
}
.avatar-frame {
  width: 132px; height: 132px;
  border-radius: 50%;
  margin: 0 auto 1.75rem;
  padding: 4px;
  background: conic-gradient(from 180deg, #2bb673, #f4c20d, #f2994a, #eb5757, #c1387a, #2f80ed, #56ccf2, #2bb673);
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.hero-logo {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(29,158,117,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(29,158,117,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(29,158,117,0); }
  100% { box-shadow: 0 0 0 0 rgba(29,158,117,0); }
}
.hero h1 {
  font-size: clamp(36px, 7vw, 52px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2rem;
}
.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--text); color: var(--bg); border: 1px solid var(--text); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface); }

/* ---------- Secciones ---------- */
.divider { border: none; border-top: 1px solid var(--border); max-width: var(--maxw); margin: 0 auto; }
.section { max-width: var(--maxw); margin: 0 auto; padding: 3rem 1.5rem; }
.section-label {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
}
.section h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 0.5rem; }
.section-sub { font-size: 15px; color: var(--text-muted); max-width: 560px; margin-bottom: 2rem; }

/* ---------- Proyectos ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 12px;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-3px); background: var(--surface-2); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.card-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.icon-purple { background: rgba(127,119,221,0.16); color: #a99cf5; }
.icon-teal   { background: rgba(29,158,117,0.16); color: #5fd3aa; }
.icon-coral  { background: rgba(216,90,48,0.16); color: #f0997b; }
.icon-amber  { background: rgba(239,159,39,0.16); color: #f5c06b; }
.card-tag {
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 10px;
  color: var(--text-dim);
}
.card h3 { font-size: 16px; font-weight: 600; }
.card p { font-size: 13px; color: var(--text-muted); flex: 1; line-height: 1.6; }
.card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.card-link {
  font-size: 13px; color: var(--text-muted);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  transition: color 0.15s;
}
.card-link:hover { color: var(--text); }

/* ---------- Stack ---------- */
.tech-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tech-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.tech-item:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.tech-item i { font-size: 19px; color: var(--text-muted); }
.tech-item span { font-size: 13px; font-weight: 600; }

/* ---------- Contacto ---------- */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1.25rem;
}
.contact-links { display: flex; flex-direction: column; gap: 11px; }
.contact-links a {
  font-size: 14px; color: var(--text-muted);
  text-decoration: none;
  display: flex; align-items: center; gap: 10px;
  transition: color 0.15s;
}
.contact-links a i { font-size: 17px; }
.contact-links a:hover { color: var(--text); }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.footer-left { display: flex; align-items: center; gap: 8px; }
.footer-left img { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.footer span { font-size: 13px; color: var(--text-dim); }

@media (max-width: 560px) {
  .nav-links { gap: 1rem; }
  .contact-card { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 420px) {
  .nav-links { display: none; }
}
