/* =========================================================
   PORTFOLIO — Santiago Pabón
   Sistema de diseño basado en variables CSS.
   Inspirado en Vercel/Stripe: alto contraste, mucho aire,
   acentos técnicos en monoespaciada.
   ========================================================= */

/* ---------- 1. VARIABLES (TEMA CLARO POR DEFECTO) ---------- */
:root {
  /* Color */
  --bg: #FAFAF8;
  --bg-elevated: #FFFFFF;
  --text: #14161A;
  --text-muted: #5B5F66;
  --border: #E5E3DC;
  --accent: #0F3D3E;       /* petróleo profundo */
  --accent-soft: #E7F0EF;
  --accent-2: #D97D3D;     /* ámbar, para CTA */
  --accent-2-hover: #C56A2C;
  --shadow: 0 1px 2px rgba(20,22,26,0.04), 0 8px 24px rgba(20,22,26,0.06);
  --shadow-hover: 0 4px 8px rgba(20,22,26,0.06), 0 16px 32px rgba(20,22,26,0.10);

  /* Tipografía */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Layout */
  --max-width: 1140px;
  --radius: 14px;
  --radius-sm: 8px;
  --nav-height: 72px;
  --transition: 220ms cubic-bezier(.4,0,.2,1);
}

/* Tema oscuro: se activa agregando .dark-mode al <body> */
body.dark-mode {
  --bg: #0E1110;
  --bg-elevated: #161A19;
  --text: #EDEDE8;
  --text-muted: #9B9F9A;
  --border: #262B29;
  --accent: #3FA9A0;
  --accent-soft: rgba(63,169,160,0.12);
  --accent-2: #E08F4F;
  --accent-2-hover: #ED9F60;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-hover: 0 4px 8px rgba(0,0,0,0.35), 0 16px 32px rgba(0,0,0,0.45);
}

/* ---------- 2. RESET ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

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; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent-2); }

/* Foco visible para accesibilidad de teclado */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- 3. UTILIDADES ---------- */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 96px 24px;
}

.section__head { margin-bottom: 48px; max-width: 640px; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-2);
  margin-bottom: 12px;
}

.section__head h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }

/* Animación de entrada controlada por Intersection Observer (script.js) */
.fade-up {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}
.btn--primary {
  background: var(--accent-2);
  color: #FFF8F1;
}
.btn--primary:hover {
  background: var(--accent-2-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.btn--small { padding: 9px 16px; font-size: 0.85rem; }

/* ---------- 4. NAVBAR ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.navbar__inner {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.navbar__links {
  display: flex;
  gap: 32px;
}
.navbar__links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  transition: color var(--transition);
}
.navbar__links a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 1.5px;
  background: var(--accent-2);
  transition: width var(--transition);
}
.navbar__links a:hover {
  color: var(--text);
}
.navbar__links a:hover::after { width: 100%; }

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Toggle de tema */
.theme-toggle {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.theme-toggle:hover { transform: scale(1.06); border-color: var(--accent); }
.theme-toggle .icon { width: 17px; height: 17px; color: var(--text); }
.icon--moon { display: none; }
body.dark-mode .icon--sun { display: none; }
body.dark-mode .icon--moon { display: block; }

/* Hamburguesa (oculta en escritorio) */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px; height: 38px;
  background: none;
  border: none;
  cursor: pointer;
}
.hamburger span {
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-active span:nth-child(2) { opacity: 0; }
.hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 5. HERO ---------- */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 92vh;
  padding: calc(var(--nav-height) + 40px) 24px 64px;
  display: grid;
  grid-template-columns: 1.1fr 0.7fr;
  align-items: center;
  gap: 48px;
}

.hero__title {
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  margin: 6px 0 4px;
}
.hero__role {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}
.hero__stack {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 22px;
}
.hero__desc {
  max-width: 480px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero__visual {
  position: relative;
  display: flex;
  justify-content: center;
}
.hero__glow {
  position: absolute;
  width: 280px; height: 280px;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 70%);
  opacity: 0.18;
  filter: blur(20px);
  z-index: 0;
}
.hero__avatar {
  position: relative;
  z-index: 1;
  width: 280px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}

/* ---------- 6. SOBRE MÍ ---------- */
.about__text {
  max-width: 720px;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ---------- 7. TECNOLOGÍAS ---------- */
.tech__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.tech__badge {
  text-align: center;
  padding: 18px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tech__badge:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

/* ---------- 8. PROYECTOS ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}
.project-card__img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}
.project-card__body { padding: 24px; }
.project-card__query {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 10px;
}
.project-card__body h3 { font-size: 1.2rem; margin-bottom: 8px; }
.project-card__body p { color: var(--text-muted); font-size: 0.93rem; }

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 20px;
}
.project-card__tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
}

.project-card__actions { display: flex; gap: 10px; }

/* ---------- 9. FORMACIÓN ---------- */
.education__card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 720px;
}
.education__tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent-2);
  margin-bottom: 10px;
}
.education__card h3 { font-size: 1.2rem; margin-bottom: 4px; }
.education__card > p:not(.education__desc):not(.education__tag) {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 14px;
}
.education__desc { color: var(--text-muted); }

/* ---------- 10. CONTACTO ---------- */
.contact__lead { color: var(--text-muted); margin-top: 8px; }

.contact__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.contact__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.contact__item:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.contact__item .icon { width: 20px; height: 20px; color: var(--accent); }

/* ---------- 11. FOOTER ---------- */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------- 12. BOTÓN VOLVER ARRIBA ---------- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  box-shadow: var(--shadow-hover);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 900;
}
.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top img { width: 18px; height: 18px; filter: invert(1); }
.back-to-top:hover { transform: translateY(-3px); }

/* ---------- 13. RESPONSIVE ---------- */

/* Tablet */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: auto;
    padding-top: calc(var(--nav-height) + 56px);
  }
  .hero__desc { margin-inline: auto; }
  .hero__actions { justify-content: center; }
  .hero__visual { order: -1; }

  .projects__grid { grid-template-columns: 1fr; }
  .contact__grid { grid-template-columns: repeat(2, 1fr); }
}

/* Móvil: menú hamburguesa */
@media (max-width: 768px) {
  .hamburger { display: flex; }

  .navbar__links {
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  }
  .navbar__links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .navbar__links li { width: 100%; text-align: center; }
  .navbar__links a {
    display: block;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }
  .navbar__links a::after { display: none; }

  .section { padding: 72px 20px; }
}

@media (max-width: 480px) {
  .contact__grid { grid-template-columns: 1fr; }
  .hero__actions { flex-direction: column; width: 100%; }
  .btn { width: 100%; }
}

/* Respeta la preferencia de movimiento reducido del sistema */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
