*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #ffffff;
  --bg-card: #f6f8fa;
  --bg-card-hover: #eef1f5;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --purple: #512BD4;
  --blue: #00B4EF;
  --gradient: linear-gradient(135deg, var(--purple), var(--blue));
  --radius: 12px;
  --nav-bg: rgba(255,255,255,.85);
  --badge-bg: rgba(81,43,212,.08);
  --badge-border: rgba(81,43,212,.2);
  --badge-text: #512BD4;
  --tag-bg: rgba(81,43,212,.08);
  --tag-text: #512BD4;
  --icon-bg: rgba(81,43,212,.08);
  --icon-color: #512BD4;
}
html.dark {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --nav-bg: rgba(13,17,23,.85);
  --badge-bg: rgba(81,43,212,.15);
  --badge-border: rgba(81,43,212,.3);
  --badge-text: #b48aff;
  --tag-bg: rgba(81,43,212,.1);
  --tag-text: #b48aff;
  --icon-bg: rgba(81,43,212,.15);
  --icon-color: #b48aff;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;
}
a { color: var(--blue); }

nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  background: var(--nav-bg); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background .3s, border-color .3s;
}
nav .inner {
  width: 100%; max-width: 960px;
  display: flex; align-items: center; justify-content: space-between;
}
nav .logo {
  font-weight: 800; font-size: 1.2rem;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
nav .links { display: flex; align-items: center; gap: 20px; }
nav .links a {
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500;
  transition: color .2s;
}
nav .links a:hover { color: var(--text); }
nav .toggles { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.toggle-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 5px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 4px;
}
.toggle-btn:hover { border-color: var(--purple); color: var(--text); }
.toggle-btn.active { background: var(--purple); color: #fff; border-color: var(--purple); }

section { max-width: 960px; margin: 0 auto; padding: 96px 24px; }

#hero { min-height: 100vh; display: flex; align-items: center; padding-top: 64px; }
#hero .inner {
  display: flex; align-items: center; gap: 48px;
  width: 100%;
}
#hero .photo {
  flex-shrink: 0;
  width: 200px; height: 200px; border-radius: 50%;
  background: var(--badge-bg); border: 3px solid var(--badge-border);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#hero .photo img {
  width: 100%; height: 100%; object-fit: cover;
}
#hero .photo .ph {
  color: var(--badge-text); font-size: 0.8rem; text-align: center;
  padding: 16px; line-height: 1.4;
}
#hero .content { flex: 1; min-width: 0; }
#hero .badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--badge-bg); border: 1px solid var(--badge-border);
  color: var(--badge-text); font-size: 0.8rem; font-weight: 500;
  margin-bottom: 20px; width: fit-content;
  transition: background .3s, border-color .3s, color .3s;
}
#hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem); font-weight: 800;
  line-height: 1.1; margin-bottom: 8px;
}
#hero h1 .highlight { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
#hero .location {
  font-size: 0.95rem; color: var(--text-muted); margin-bottom: 16px;
}
#hero p {
  font-size: 1.1rem; color: var(--text-muted);
  max-width: 600px; margin-bottom: 28px;
  transition: color .3s;
}
#hero .cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 8px;
  font-weight: 600; font-size: 0.9rem;
  transition: all .25s; cursor: pointer; border: none;
  text-decoration: none;
}
.btn-primary { background: var(--gradient); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(81,43,212,.35); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); transform: translateY(-2px); }

.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 8px; }
.section-header p { color: var(--text-muted); transition: color .3s; font-size: 0.95rem; }
.section-header .line {
  width: 48px; height: 4px; border-radius: 4px;
  background: var(--gradient); margin: 14px auto 0;
}

#about p {
  color: var(--text-muted); max-width: 720px; margin: 0 auto;
  text-align: center; font-size: 1.05rem;
  transition: color .3s;
}
#about .stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-top: 40px;
}
#about .stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; text-align: center;
  transition: all .3s;
}
#about .stat:hover { background: var(--bg-card-hover); }
#about .stat .number {
  font-size: 1.8rem; font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
#about .stat .label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative; margin-bottom: 32px; padding-left: 24px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -28px; top: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--gradient); border: 3px solid var(--bg);
}
.timeline-item .date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.timeline-item h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 2px; }
.timeline-item .company { color: var(--blue); font-weight: 500; font-size: 0.95rem; }
.timeline-item p { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }

#education .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.info-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: all .25s;
}
.info-card:hover { background: var(--bg-card-hover); }
.info-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.info-card .sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 4px; }
.info-card .date { font-size: 0.8rem; color: var(--text-muted); }
.info-card ul { list-style: none; margin-top: 8px; }
.info-card ul li {
  font-size: 0.85rem; color: var(--text-muted); padding: 3px 0;
  display: flex; align-items: center; gap: 6px;
}
.info-card ul li i { color: var(--purple); font-size: 0.7rem; }

#skills .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
#skills .skill {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 20px 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); transition: all .25s;
}
#skills .skill:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  border-color: var(--purple);
}
#skills .skill i { font-size: 2rem; }
#skills .skill .name { font-size: 0.8rem; font-weight: 600; text-align: center; }

#projects .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
#projects .card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: all .25s;
}
#projects .card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  border-color: var(--purple);
}
#projects .card .icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--icon-bg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 1.2rem; color: var(--icon-color);
  transition: background .3s, color .3s;
}
#projects .card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
#projects .card p { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 12px; }
#projects .card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
#projects .card .tags span {
  padding: 4px 10px; border-radius: 6px;
  background: var(--tag-bg); color: var(--tag-text);
  font-size: 0.75rem; font-weight: 500;
  transition: background .3s, color .3s;
}

#honors .grid {
  display: grid; gap: 16px;
}
#honors .card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  transition: all .25s;
}
#honors .card:hover { background: var(--bg-card-hover); }
#honors .card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
#honors .card .sub { color: var(--text-muted); font-size: 0.85rem; }
#honors .card .date { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

#languages .grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
#languages .lang {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  transition: all .25s;
}
#languages .lang:hover { background: var(--bg-card-hover); }
#languages .lang .name { font-weight: 600; font-size: 0.95rem; }
#languages .lang .level { color: var(--text-muted); font-size: 0.85rem; }

#contact .links {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
}
#contact .links a, #contact .links .btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-weight: 500;
  transition: all .25s; text-decoration: none;
}
#contact .links a:hover, #contact .links .btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  border-color: var(--purple);
}
#contact .links a i, #contact .links .btn i { font-size: 1.2rem; }

footer {
  text-align: center; padding: 32px 24px;
  color: var(--text-muted); font-size: 0.85rem;
  border-top: 1px solid var(--border);
  transition: color .3s, border-color .3s;
}

.fade-in {
  opacity: 0; transform: translateY(24px);
  transition: opacity .6s ease, transform .6s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

html[data-lang="en"] .lang-es { display: none; }
html[data-lang="es"] .lang-en { display: none; }

@media (max-width: 700px) {
  nav .links { gap: 10px; }
  nav .links a { font-size: 0.75rem; }
  nav .toggles { gap: 4px; }
  .toggle-btn { padding: 4px 7px; font-size: 0.7rem; }
  section { padding: 64px 20px; }
  #hero .inner { flex-direction: column; text-align: center; }
  #hero .photo { width: 140px; height: 140px; }
  #hero .cta { justify-content: center; }
  #hero .badge { margin-left: auto; margin-right: auto; }
  #hero .location { justify-content: center; }
  #education .grid { grid-template-columns: 1fr; }
  #languages .grid { grid-template-columns: 1fr; }
}
@media (max-width: 500px) {
  nav .links a { font-size: 0.7rem; }
  .toggle-btn span { display: none; }
}
