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

/* BOTÓN HAMBURGUESA */
.nav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 1001;
  margin-right: auto;
  margin-left: 5%;
  color: inherit;
}

.nav-toggle span {
  display: block;
  width: 28px;
  height: 3px;
  background: currentColor;
  border-radius: 3px;
  transition: 0.3s;
}

/* ANIMACIÓN DEL BOTÓN */
.nav.open + .nav-toggle span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav.open + .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav.open + .nav-toggle span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* MENÚ PRINCIPAL */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  /* cerrado */
  height: 100vh;
  background: var(--bg, #111);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0;
  padding-top: 5rem;
  transition: width 0.3s ease;
  z-index: 1000;
}

/* MENÚ ABIERTO */
.nav.open {
  width: 75%;
  max-width: 320px;
}

.nav-item:hover {
  background: var(--card-hover, #222);
}

/* ICONOS */
.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* BOTÓN TEMA */
.theme {
  margin: 1rem;
  padding: 1rem;
  border: 1px solid var(--border, #444);
  border-radius: 12px;
  min-height: auto; /* Aseguramos que no ocupe toda la altura */
  background: var(--card-bg, #1a1a1a);
}

/* ================= Móvil (≤ 767px) ================= */
@media (max-width: 767px) {
  .nav {
    display: flex;
    flex-direction: column; /* items uno debajo del otro */
    align-items: flex-start;
    gap: 0.5rem;
  }

  .nav-item,
  #themeToggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    width: 100%;
    padding: 10px 15px;
    padding: 12px 15px;
    margin-bottom: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* Propiedades para el efecto de gradiente */
    position: relative;
    z-index: 1;
    overflow: hidden;
    transition: all 0.3s ease;
  }

  #themeToggle {
    display: none; /* oculto por defecto */
  }

  /* Se muestra toggle solo si el menú está abierto */
  .nav.is-open #themeToggle {
    display: flex;
  }

  /* Añade padding al menú para separar los items de los bordes */
  .nav.open {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Efecto hover/active para móvil */
  .nav-item:hover,
  .nav-item:active {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: transparent;
    color: #fff;
    background: transparent; /* El fondo lo dará el ::before */
  }
  .nav-item:hover::before,
  .nav-item:active::before {
    opacity: 1;
  }
.hero__card {
    flex-direction: row;     /* horizontal */
    align-items: center;     /* centrado vertical */
    justify-content: flex-start; /* alinea todo a la izquierda */
    gap: 1rem;               /* espacio entre icono y texto */
    padding: 10px 15px;
  }

  /* Asegúrate de que el icono no se achique */
  .hero__card > svg,
  .hero__card > img {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
  }

  /* El texto ocupa el espacio restante */
  .hero__card > span,
  .hero__card > p {
    flex: 1;
  }

  [data-theme="light"] .nav.is-open { background-color: #fff; }
  [data-theme="dark"] .nav.is-open { background-color: #111; }
}


/* ================= Desktop (≥ 768px) ================= */
@media (min-width: 768px) {
  /* Estilos para la barra del encabezado */
  .header__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .nav {
    display: flex;
    flex-direction: row;
    position: static;
    width: auto;
    height: auto;
    background: transparent;
    padding: 0;
    overflow: visible;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 0;
    padding-top: 0; /* Anula el padding-top del móvil */
    transition: none;
    z-index: auto; /* Reinicia el z-index del móvil */
  }

  /* Anula el estado 'open' en escritorio para evitar que se quede con un ancho fijo */
  .nav.open {
    /* Asegura que el estado 'open' no tenga ningún efecto en escritorio */
    width: auto;
  }

  .nav-item,
  #themeToggle {
    /* Estilos base para el layout de texto + icono */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    background: transparent;
    border: none;
    padding: 0.5rem; /* Padding para un área de clic cómoda */
    border-radius: var(--radius);
    /* Propiedades para el efecto de gradiente */
    position: relative;
    z-index: 1;
    overflow: hidden;
    transition: all 0.3s ease;
  }

  .nav-item:hover {
    color: #fff;
  }

  .nav-item:hover::before {
    opacity: 1;
  }

  .nav-toggle {
    display: none;
    visibility: hidden; /* Oculta completamente el botón */
    pointer-events: none; /* Desactiva cualquier interacción */
  }
}
/* Estilos específicos para el botón de tema en escritorio */
@media (min-width: 768px) {
  #themeToggle {
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 700;
  }
  #themeToggle:hover {
    transform: translateY(-2px);
    border-color: transparent;
    color: #fff;
  }
  #themeToggle:hover::before { opacity: 1; }
}

html:focus-within {
  scroll-behavior: smooth;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Pseudo-elemento para el fondo de gradiente en nav-item (ahora es global) */
.nav-item::before,
#themeToggle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* ===== Variables Globales ===== */
:root {
  /* Colores Base */
  --bg: #0d0608;
  --surface: #13090c;
  --text: #fde8e8;
  --muted: #f5c5c5;
  --primary: #ff3b47;
  --accent: #f43f5e;
  --accent2: #ff7a45;
  --card: #11070a;
  --border: #2a1216;
  --radius: 18px;
  --nav-item-hover-bg: #1f0d11; /* Color para hover/active en menú móvil (oscuro) */
  --shadow: 0 14px 36px rgba(46, 8, 12, 0.45);

  /* Tamaños */
  --container: clamp(300px, 92vw, 1100px);
  --s1: 0.55rem;
  --s2: 0.9rem;
  --s3: 1.25rem;
  --s4: 2rem;
  --s5: 3rem;
  --h1: clamp(2.2rem, 2rem + 2vw, 3.4rem);
  --h2: clamp(1.5rem, 1.2rem + 0.9vw, 2.1rem);
  --lead: 1.075rem;

  /* Gradientes */
  --gradient-body: linear-gradient(120deg, var(--bg) 0%, var(--surface) 100%);
  --gradient-card: var(--card);
  --gradient-hero: linear-gradient(135deg, var(--primary) 10%, var(--accent));
  --gradient-btn-primary: linear-gradient(
    135deg,
    var(--accent),
    var(--primary)
  );
}

/* ===== Tema Claro ===== */
html[data-theme="light"] {
  --bg: #fff5f5;
  --surface: #ffffff;
  --text: #26070a;
  --muted: #7a4b53;
  --primary: #dc2626;
  --accent: #e11d48;
  --accent2: #f97316;
  --card: #ffffff;
  --border: #f1d6d6;
  --nav-item-hover-bg: #fdf0f0; /* Color para hover/active en menú móvil (claro) */
  --shadow: 0 12px 28px rgba(120, 16, 40, 0.12);
}

/* ===== Layout ===== */
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--gradient-body);
  line-height: 1.65;
}

.container {
  width: min(100% - 1rem, var(--container));
  height: 100%;
  margin-inline: auto;
}

.section {
  padding: var(--s5) 0;
  scroll-margin-top: 80px;
}

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

.stack > * + * {
  margin-top: var(--s2);
}

.row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.row--wrap {
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: var(--s3);
}

.grid--2 {
  grid-template-columns: 1.1fr 1fr;
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 980px) {
  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
}

/* ===== Text & Muted ===== */
.muted,
.about_muted {
  color: var(--muted);
}

.about_muted {
  margin-bottom: 25px;
}

/* ===== Images ===== */
.profile-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 20px;
}

.rounded-img {
  border-radius: 15%;
  width: 80%;
  height: auto;
  object-fit: cover;
}

/* ===== Header / Nav ===== */
.header {
  position: sticky;
  display: flex;
  justify-content: center; /* centra horizontalmente */
  align-items: center;
  top: 0;
  z-index: 100;
  min-height: 70px;
  backdrop-filter: blur(10px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px; /* Altura del logo */
  width: 40px; /* Ancho del logo */
  z-index: 1002; /* Para que esté por encima del menú móvil */
}

.header__logo img {
  height: 100%;
}

.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  height: 100%;
}

.theme {
  margin-left: 0.25rem;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
}

.title {
  font-size: var(--h1);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.lead {
  font-size: var(--lead);
}

.hero__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 20px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero__card .initials {
  width: 100px;
  height: 100px;
  border-radius: 25%;
  display: grid;
  place-items: center;
  background: var(--gradient-hero);
  color: #fff;
  font-weight: 900;
  font-size: 2rem;
  margin-bottom: 10px;
}

.hero__card .meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.hero__card .meta__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

@media (max-width: 980px) {
  .hero {
    min-height: auto;
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

/* ===== Cards, Buttons & Chips ===== */
.card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: var(--s3);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn:hover {
  transform: translateY(-2px);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(66, 133, 244, 0.4);
}

.btn:hover::before {
  opacity: 1;
}

.btn--primary {
  background: var(--gradient-btn-primary);
  border: 0;
  color: #fff;
  box-shadow: 0 14px 26px rgba(255, 59, 71, 0.32);
}

.btn--ghost {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.chip {
  font-size: 0.9rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: var(--surface);
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: default;
}

.chip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chip:hover {
  border-color: transparent;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chip:hover::before {
  opacity: 1;
}

.btn--play {
  margin-top: 1rem;
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease,
    border-color 0.3s ease;
}

.btn--play::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #4285f4, #ea4335, #fbbc05, #34a853);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn--play:hover {
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 20px rgba(66, 133, 244, 0.4);
  transform: translateY(-2px);
}

.btn--play:hover::before {
  opacity: 1;
}

.btn--play .icon {
  stroke: #34a853;
  transition: stroke 0.3s ease;
  position: relative;
  z-index: 2;
}

.btn--play:hover .icon {
  stroke: #fff;
}

/* ===== Projects & Timeline ===== */
.project--featured {
  align-items: start;
}

.frame,
.frame_p {
  border: 1px dashed var(--border);
  border-radius: 16px;
  min-height: 260px;
  background: var(--surface);
}

.frame__ph {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-family: monospace;
}

.project h3 {
  margin-bottom: 0.3rem;
}

.list {
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.row .chip {
  box-shadow: 0 10px 24px rgba(255, 59, 71, 0.2);
}

/* ===== Timeline ===== */
.timeline {
  position: relative;
  padding-left: 0;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 1.5rem;
  width: 2px;
  background: var(--border);
}

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

.timeline__item + .timeline__item {
  margin-top: var(--s4);
}

.timeline__marker {
  position: absolute;
  left: calc(1.5rem - 6px);
  top: 0.4rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid var(--card);
  box-shadow: 0 0 0 1px var(--primary);
  z-index: 1;
}

.timeline__head {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

.timeline h3 {
  margin-bottom: 0.15rem;
}

/* ===== Footer ===== */
.footer {
  padding: var(--s4) 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}
