/* ---------- Temas ---------- */
:root,
[data-theme="dark"] {
  --bg: #0c0f13;
  --bg-2: #12161c;
  --card: #151a21;
  --line: #232a33;
  --text: #e8ecf1;
  --muted: #8b96a5;
  --accent: #7ee787;
  --accent-2: #56d4dd;
  --accent-ink: #0c0f13;
  --glow: rgba(126, 231, 135, 0.14);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f6f5f0;
  --bg-2: #eeece5;
  --card: #ffffff;
  --line: #dedbd1;
  --text: #15181d;
  --muted: #5d6673;
  --accent: #1a7f37;
  --accent-2: #0f6f7a;
  --accent-ink: #ffffff;
  --glow: rgba(26, 127, 55, 0.1);
  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.65 "Manrope", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
body::before { /* grilla sutil de fondo */
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .35;
  mask-image: radial-gradient(ellipse at 70% 0%, #000 0%, transparent 60%);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: "Bricolage Grotesque", sans-serif; line-height: 1.1; margin: 0; }
.mono, .eyebrow, .num, .timeline__date, .tag, .project__meta { font-family: "JetBrains Mono", monospace; }
main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Navegación ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px max(24px, calc((100% - 1080px) / 2 + 24px));
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__logo { font: 800 1.35rem "Bricolage Grotesque"; text-decoration: none; letter-spacing: -.02em; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 22px; margin-left: auto; }
.nav__links a { text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .2s; }
.nav__links a:hover { color: var(--text); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer; transition: border-color .2s, transform .3s;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-15deg); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon { display: none; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center;
  padding: 96px 0 80px;
}
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 0 0 20px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--glow); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px transparent; } }
.hero h1 { font-size: clamp(3rem, 8vw, 5.6rem); font-weight: 800; letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero__role { font-weight: 600; font-size: 1.15rem; margin: 18px 0 8px; }
.hero__bio { color: var(--muted); max-width: 54ch; margin: 0 0 28px; }
.hero__links { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  text-decoration: none; font-weight: 600; font-size: .92rem;
  transition: border-color .2s, transform .2s;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; }
.btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.avatar {
  width: 240px; aspect-ratio: 1; border-radius: 32px; overflow: hidden;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 25%, var(--glow), transparent 60%),
    linear-gradient(145deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  transform: rotate(3deg);
  box-shadow: -14px 14px 0 -1px var(--bg), -14px 14px 0 0 var(--accent);
}
.avatar span { font: 800 5rem "Bricolage Grotesque"; color: var(--accent); letter-spacing: -.05em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Secciones ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section__title { display: flex; align-items: baseline; gap: 14px; font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: -.02em; margin-bottom: 40px; }
.num { font-size: .9rem; color: var(--accent); font-weight: 500; }

/* ---------- Proyectos ---------- */
.projects { display: grid; gap: 28px; }
.project {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.project:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.project:nth-child(even) .project__media { order: 2; }
.project__media { position: relative; background: var(--bg-2); min-height: 280px; }
.project__media { display: grid; place-items: center; padding: 28px 28px 64px; background: radial-gradient(circle at 30% 20%, var(--glow), transparent 65%), var(--bg-2); }
.project__media .main-img { width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px; cursor: zoom-in; box-shadow: 0 18px 40px -18px rgba(0,0,0,.55); border: 1px solid var(--line); }
.thumbs { position: absolute; left: 28px; bottom: 16px; display: flex; gap: 8px; z-index: 1; }
.thumbs button {
  width: 56px; height: 38px; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: var(--bg); opacity: .75; transition: opacity .2s, border-color .2s;
}
.thumbs button[aria-current="true"], .thumbs button:hover { opacity: 1; border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

.project__body { padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.project__meta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }
.project__meta b { color: var(--accent); font-weight: 500; }
.project h3 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.project h3 small { display: block; font: 500 1rem "Manrope"; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.project p { margin: 0; color: var(--muted); }
.project ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .93rem; }
.project li { padding-left: 20px; position: relative; }
.project li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .74rem; padding: 4px 10px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); }
.project__links { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; }
.project__links a { color: var(--accent); font-weight: 600; text-decoration: none; font-size: .95rem; }
.project__links a:hover { text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 34px; }
.timeline > li { display: grid; grid-template-columns: 170px 1fr; gap: 24px; }
.timeline__date { color: var(--accent); font-size: .85rem; padding-top: 4px; }
.timeline h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.timeline .at { font-family: "Manrope"; font-weight: 500; color: var(--muted); font-size: 1rem; }
.timeline p { margin: 0; color: var(--muted); }
.timeline ul { margin: 0; padding-left: 18px; color: var(--muted); }
.timeline ul li::marker { color: var(--accent); }

/* ---------- Habilidades ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.skill-group { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.skill-group h3 { font-size: 1rem; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.chips span { font-size: .86rem; padding: 5px 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }

/* ---------- Contacto ---------- */
.contact__lead { color: var(--muted); margin: -20px 0 12px; font-size: 1.1rem; }
.contact__mail {
  font: 800 clamp(1.6rem, 5.5vw, 3.4rem) "Bricolage Grotesque"; letter-spacing: -.03em;
  text-decoration: none; background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */
.footer {
  max-width: 1080px; margin: 0 auto; padding: 28px 24px 40px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line);
}

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 92vh; }
.lightbox::backdrop { background: rgba(5, 7, 10, .88); backdrop-filter: blur(4px); }
.lightbox img { max-width: 94vw; max-height: 84vh; border-radius: 12px; }
.lightbox__caption { color: #cfd6df; text-align: center; margin: 10px 0 0; font-size: .9rem; }
.lightbox__close {
  position: fixed; top: 16px; right: 20px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: #1b212a; color: #fff; font-size: 1.6rem; cursor: pointer;
}

/* ---------- Animación de entrada ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .nav__links { display: none; }
  .theme-toggle { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding-top: 56px; }
  .avatar { width: 150px; order: -1; }
  .avatar span { font-size: 3rem; }
  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .project__media { order: 0; }
  .project__media { min-height: 0; padding: 20px 20px 60px; }
  .project__body { padding: 24px; }
  .timeline > li { grid-template-columns: 1fr; gap: 4px; }
}
