/* ===== Variables ===== */
:root {
  --bg: #0b1220;
  --bg-alt: #0f182a;
  --surface: #142036;
  --border: #22314d;
  --text: #e6ecf5;
  --muted: #94a3b8;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-alt: #eef3f8;
    --surface: #ffffff;
    --border: #dbe3ee;
    --text: #0f172a;
    --muted: #526077;
    --accent: #0d9488;
    --accent-2: #0284c7;
    --accent-soft: rgba(13, 148, 136, 0.1);
  }
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
strong { color: var(--text); font-weight: 600; }

.container { width: min(1100px, 100% - 32px); margin-inline: auto; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }

/* ===== Botones / links ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: #04201c;
  font-weight: 600;
  border: 2px solid var(--accent);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-soft); }
.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--small { padding: 6px 16px; font-size: .9rem; }
.btn--big { font-size: clamp(1rem, 3.5vw, 1.25rem); padding: 16px 32px; word-break: break-all; }

.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav__logo { font-weight: 800; font-size: 1.4rem; letter-spacing: -0.02em; }
.nav__logo span { color: var(--accent); }
.nav__menu { display: flex; align-items: center; gap: 28px; font-size: .95rem; }
.nav__menu a:not(.btn) { color: var(--muted); transition: color .2s; }
.nav__menu a:not(.btn):hover { color: var(--accent); }
.nav__toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav__toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: .3s; }

/* ===== Hero ===== */
.hero {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center;
  padding: 80px 0;
  background:
    radial-gradient(600px circle at 85% 20%, var(--accent-soft), transparent 60%),
    radial-gradient(500px circle at 10% 90%, rgba(56, 189, 248, 0.08), transparent 60%);
}
.hero__tag { color: var(--accent); margin-bottom: 16px; }
.hero__title { font-size: clamp(2.4rem, 7vw, 4.5rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 800; }
.hero__role { font-size: clamp(1.2rem, 3.5vw, 1.8rem); color: var(--muted); font-weight: 600; margin-top: 12px; }
.hero__role .sep { color: var(--accent); }
.hero__text { max-width: 560px; color: var(--muted); font-size: 1.1rem; margin-top: 20px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 32px; color: var(--muted); font-size: .95rem; }

/* ===== Secciones ===== */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }
.section__title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
  margin-bottom: 40px;
  display: flex; align-items: center; gap: 12px;
}
.section__title .mono { color: var(--accent); font-size: .7em; font-weight: 400; }
.section__title::after { content: ""; flex: 1; max-width: 240px; height: 1px; background: var(--border); }
.section__title--center { justify-content: center; }
.section__title--center::after { display: none; }

/* ===== Sobre mí ===== */
.about__grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: start; }
.about__text p { color: var(--muted); margin-bottom: 16px; font-size: 1.05rem; }
.about__text .link { display: inline-block; margin-top: 4px; }
.stats { display: grid; gap: 16px; }
.stats li {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
}
.stats strong { display: block; font-size: 1.8rem; color: var(--accent); line-height: 1.2; }
.stats span { color: var(--muted); font-size: .95rem; }

/* ===== Cards / chips ===== */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-4px); }
.card h3 { font-size: 1.1rem; margin-bottom: 16px; }
.chips, .tags { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li, .tags li {
  font-size: .85rem; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.tags li { font-family: var(--mono); font-size: .78rem; }

/* ===== Proyectos ===== */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.project {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.project:hover { border-color: var(--accent); transform: translateY(-4px); }
.project__img { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--border); }
.project__img img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .5s ease; }
.project:hover .project__img img { transform: scale(1.04); }
.project__info { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.project__label { color: var(--accent); font-size: .78rem; margin-bottom: 6px; }
.project h3 { font-size: 1.3rem; margin-bottom: 10px; line-height: 1.3; }
.project__info > p { color: var(--muted); margin-bottom: 14px; font-size: .97rem; }
.project__info .tags { margin-top: auto; }
.project__links { display: flex; gap: 20px; margin-top: 18px; flex-wrap: wrap; align-items: center; }

/* Proyecto destacado: ocupa todo el ancho, imagen al costado */
.project--featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr; }
.project--featured .project__img { aspect-ratio: auto; height: 100%; min-height: 340px; border-bottom: 0; border-right: 1px solid var(--border); }
.project--featured .project__img img { object-position: left top; }
.project--featured .project__info { padding: 32px; justify-content: center; }
.project--featured h3 { font-size: 1.7rem; }
.project--featured .project__info .tags { margin-top: 4px; }

/* ===== Servicios ===== */
.section__intro { color: var(--muted); font-size: 1.1rem; margin: -24px 0 32px; max-width: 600px; }
.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.services .card p { color: var(--muted); }
.card__icon {
  width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px;
  display: grid; place-items: center; font-size: 1.4rem; background: var(--accent-soft);
}
.services__cta { text-align: center; margin-top: 36px; }

/* ===== WhatsApp flotante ===== */
.wa-float {
  position: fixed; right: 20px; bottom: 20px; z-index: 20;
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: #25d366; color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.wa-float:hover { transform: scale(1.08); }

/* ===== Certificados ===== */
.certs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 48px; }
.cert {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.cert__badge {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.4rem;
  background: var(--accent-soft);
}
.cert h3 { font-size: 1.15rem; }
.cert__org { color: var(--accent); font-size: .9rem; font-weight: 500; margin-bottom: 6px; }
.cert p:not(.cert__org) { color: var(--muted); font-size: .95rem; margin-bottom: 10px; }

.timeline { border-left: 2px solid var(--border); padding-left: 24px; display: grid; gap: 28px; }
.timeline li { position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -31px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--bg-alt);
}
.timeline__date { color: var(--accent); font-size: .85rem; }
.timeline h3 { font-size: 1.1rem; }
.timeline p { color: var(--muted); }

/* ===== Experiencia ===== */
.job {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.job__head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.job__head h3 { font-size: 1.2rem; }
.job__date { color: var(--muted); font-size: .9rem; }
.job__list li { color: var(--muted); padding-left: 22px; position: relative; margin-bottom: 8px; }
.job__list li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

/* ===== Contacto ===== */
.contact__inner { text-align: center; max-width: 640px; }
.contact__text { color: var(--muted); font-size: 1.1rem; margin-bottom: 32px; }
.contact__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 24px; margin-top: 32px; }
.socials a { color: var(--muted); font-weight: 500; transition: color .2s; }
.socials a:hover { color: var(--accent); }

/* ===== Footer ===== */
.footer { padding: 28px 0; text-align: center; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); }

/* ===== Animación al hacer scroll ===== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
  .services { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .project--featured { grid-template-columns: 1fr; }
  .project--featured .project__img { aspect-ratio: 16 / 10; min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .project--featured .project__info { padding: 24px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats li { padding: 16px; }
  .stats strong { font-size: 1.4rem; }
}

@media (max-width: 720px) {
  .nav__toggle { display: block; }
  .nav__menu {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; gap: 20px; padding: 28px 16px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    transform: translateY(-120%); transition: transform .3s ease;
    z-index: -1;
  }
  .nav__menu.is-open { transform: none; }
  .nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .section { padding: 72px 0; }
  .stats { grid-template-columns: 1fr; }
  .projects { grid-template-columns: 1fr; }
  .wa-float { width: 50px; height: 50px; right: 16px; bottom: 16px; }
}
