/* ======= VARIABLES / TEMAS ======= */
:root {
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --radius: 12px;
  --header-height: 64px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #111a2e;
  --surface: #16203a;
  --surface-hover: #1d2b4a;
  --text: #e5eaf3;
  --text-muted: #9aa7bd;
  --border: #24304d;
  --shadow: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] {
  --bg: #f6f8fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-hover: #eef2f7;
  --text: #1a2436;
  --text-muted: #5b6b84;
  --border: #dde4ee;
  --shadow: rgba(15, 35, 70, 0.1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
ul { list-style: none; }

.container {
  width: min(1100px, 90%);
  margin-inline: auto;
}

.section {
  padding: 5rem 0;
  scroll-margin-top: var(--header-height);
}

.section--alt { background: var(--bg-alt); }

.section__title {
  font-size: 2rem;
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
}

.section__title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 48px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid var(--accent);
  transition: all var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--outline {
  background: transparent;
  color: var(--accent);
}
.btn--outline:hover { background: var(--accent); color: #fff; }

/* ======= HEADER / NAV ======= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background var(--transition), box-shadow var(--transition);
}

.header.scrolled { box-shadow: 0 4px 20px var(--shadow); }

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav__logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text);
}
.nav__logo:hover { color: var(--accent); }

.nav__list {
  display: flex;
  gap: 1.5rem;
}

.nav__link {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition);
}

.nav__link:hover, .nav__link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--surface-hover); }

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav__toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: all var(--transition);
}

/* ======= HERO ======= */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
  position: relative;
}

.scroll-indicator {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  animation: bounce 2s ease-in-out infinite;
  transition: opacity 0.4s ease, color var(--transition);
}

.scroll-indicator:hover { color: var(--accent); }

.scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-indicator { animation: none; }
}

/* ======= NAV LATERAL (dots por seccion) ======= */
.side-nav {
  position: fixed;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  z-index: 90;
}

.side-nav__dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  background: transparent;
  opacity: 0.55;
  transition: all var(--transition);
}

.side-nav__dot:hover { border-color: var(--accent); opacity: 1; }

.side-nav__dot.active {
  background: var(--accent);
  border-color: var(--accent);
  opacity: 1;
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
}

.side-nav__label {
  position: absolute;
  right: 1.4rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}

.side-nav__dot:hover .side-nav__label {
  opacity: 1;
  transform: translateY(-50%) translateX(-4px);
}

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

.hero__container {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  align-items: center;
  gap: 3rem;
}

.hero__greeting {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
}

.hero__name {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0.5rem 0;
}

.hero__role {
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hero__description {
  color: var(--text-muted);
  max-width: 480px;
  margin-bottom: 2rem;
}

.hero__buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero__img {
  display: flex;
  justify-content: center;
}

.hero__img img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid var(--accent);
  box-shadow: 0 0 40px rgba(14, 165, 233, 0.25);
}

/* ======= SOBRE MI ======= */
.about {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: start;
}

.about__text p { margin-bottom: 1.25rem; color: var(--text-muted); }
.about__text strong { color: var(--text); }

.about__facts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.fact__label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.fact__value { color: var(--text); font-size: 0.95rem; }
.fact__link:hover { text-decoration: underline; }

/* ======= TIMELINE (sobre mi) ======= */
.timeline__title {
  font-size: 1.1rem;
  margin: 3rem 0 1.5rem;
  font-family: var(--font-mono);
  color: var(--accent);
}

.timeline {
  position: relative;
  padding-left: 1.75rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  padding-left: 1rem;
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.timeline__duration {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.6rem;
}

.timeline__desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.timeline__desc strong { color: var(--text); }

/* ======= CONOCIMIENTOS ======= */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.5rem;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform var(--transition), border-color var(--transition);
}

.skill-group:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.skill-group__title {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 1rem;
  font-family: var(--font-mono);
}

.skill-group__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  transition: all var(--transition);
}

.skill:hover { border-color: var(--accent); color: var(--accent); }

/* ======= PROYECTOS ======= */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px var(--shadow);
}

.project-card__header {
  height: 140px;
  display: flex;
  align-items: flex-end;
  padding: 1rem 1.25rem;
}

.project-card__header--finarg {
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
}

.project-card__header--gopro {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.project-card__header--onepass {
  background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
}

.project-card__tag {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.project-card__body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.project-card__title { font-size: 1.25rem; }

.project-card__role {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: -0.5rem;
}

.project-card__description {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.project-card__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-card__tech li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  background: rgba(14, 165, 233, 0.1);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.project-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.project-card__link:hover { text-decoration: underline; }

.projects__more {
  margin-top: 2rem;
  text-align: center;
  font-weight: 500;
}

/* ======= REDES ======= */
.social {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.social-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-align: center;
  transition: all var(--transition);
}

.social-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 28px var(--shadow);
}

.social-card__name { font-weight: 700; font-size: 1.05rem; }
.social-card__user { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); }

/* ======= CONTACTO ======= */
#contacto { padding: 4rem 0 3rem; }

.contact__intro { color: var(--text-muted); margin-bottom: 1.5rem; }

.contact-form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.form-field { display: flex; flex-direction: column; gap: 0.4rem; }

.form-field label { font-weight: 600; font-size: 0.9rem; }

.form-field input,
.form-field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-field.invalid input,
.form-field.invalid textarea { border-color: #ef4444; }

.form-error {
  color: #ef4444;
  font-size: 0.8rem;
  min-height: 1.1em;
}

.form-status { font-size: 0.9rem; color: var(--accent); min-height: 1.2em; }

/* ======= FOOTER ======= */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer__top { font-weight: 600; }

/* ======= RESPONSIVE ======= */
@media (max-width: 820px) {
  .hero__container {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }
  .hero__description { margin-inline: auto; }
  .hero__buttons { justify-content: center; }
  .hero__img { order: -1; }
  .hero__img img { width: 220px; height: 220px; }

  .about { grid-template-columns: 1fr; }

  .nav__list {
    position: fixed;
    top: var(--header-height);
    right: -100%;
    flex-direction: column;
    background: var(--bg-alt);
    border-left: 1px solid var(--border);
    width: min(280px, 75vw);
    height: calc(100vh - var(--header-height));
    padding: 2rem;
    gap: 1.25rem;
    transition: right var(--transition);
  }
  .nav__list.open { right: 0; }

  .nav__toggle { display: flex; }
  .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); }
}

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .section { padding: 3.5rem 0; }
}

/* Ventanas bajas: compactar contacto para que el form entre completo */
@media (max-height: 720px) {
  #contacto { padding: 2.5rem 0 2rem; }
  #contacto .section__title { font-size: 1.5rem; margin-bottom: 1.25rem; }
  .contact__intro { margin-bottom: 1rem; }
  .contact-form { gap: 0.85rem; }
  .contact-form textarea { min-height: 90px; }
}
