/* --------------------------------------------- */
/* Estilos base del documento y variables globales */
:root {
  --bg: #0e1116;
  --bg-card: #131820;
  --text: #f5f7fb;
  --muted: #aab3c5;
  --accent: #7ab4ff;
  --accent-muted: rgba(122, 180, 255, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  --section-spacing: 70px;
  --grid-gap: 24px;
  --grid-gap-mobile: 16px;
}

/* Variables para el tema claro */
body.theme-light {
  --bg: #f7f7f8;
  --bg-card: #ffffff;
  --text: #0c0c0d;
  --muted: #5f5f62;
  --accent: #0b5cff;
  --accent-muted: rgba(11, 92, 255, 0.1);
  --border: rgba(12, 12, 13, 0.08);
  --shadow: 0 20px 40px rgba(12, 12, 13, 0.08);
}

/* Estilo general del body: tipografía, fondo y transición de tema */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
    sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 0.95rem;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Contenedor principal: limita el ancho y centra el contenido */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 110px 24px 70px;
}

/* Estilo del header fijo y su contenido */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

body.theme-light header {
  background-color: var(--bg);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--accent);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: 20px;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  box-shadow: var(--shadow);
}

/* Títulos principales y secundarios */
h1,
h2 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
}

h2 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

p {
  color: var(--muted);
  margin-bottom: 14px;
  font-size: 0.95rem;
}

section {
  scroll-margin-top: 80px;
  position: relative;
  z-index: 1;
}

.section-spacing {
  margin-bottom: var(--section-spacing);
}

#links {
  margin-bottom: 8px;
}

/* Estilo de tarjetas/card genéricas con sombra */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 60px rgba(12, 12, 13, 0.12);
}

body:not(.theme-light) .card:hover {
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
}

/* Hero: disposición del nombre y links sociales */
.hero-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: flex-start;
  gap: 20px;
}

.hero-links {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
  width: min(240px, 100%);
  justify-self: end;
  padding: 8px 8px 0;
  box-sizing: border-box;
}

/* Estilos compartidos para botones */
.btn {
  flex: 1;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Botón principal relleno */
.btn-primary {
  background-color: var(--text);
  color: var(--bg);
  box-shadow: 0 15px 30px rgba(12, 12, 13, 0.2);
}

.btn-primary:hover {
  background-color: var(--accent);
  box-shadow: var(--shadow);
}

/* Botón secundario/outline */
.btn-outline {
  background-color: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* Grid de skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

.skills-grid h3 {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.skills-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--muted);
}

.skills-grid li {
  margin-bottom: 10px;
}

/* Grid de proyectos destacados (desktop) */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Estilos de card que se mantienen solo en desktop */
.projects-grid .card {
  padding: 24px;
  border-radius: 22px;
  gap: 12px;
  min-height: 220px;
}

.project-card {
  text-decoration: none;
  color: var(--text);
}

.project-card-action {
  cursor: pointer;
}

.project-card-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.projects-grid .card h3 {
  margin: 0;
  font-size: 1.4rem;
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-badge {
  display: inline-flex;
  padding: 4px 14px;
  border-radius: 999px;
  background-color: var(--accent-muted);
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0;
}


/* Footer minimalista */
footer {
  padding: 16px 24px 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background-color: var(--bg-card);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease,
    color 0.3s ease, border-color 0.3s ease;
  z-index: 1100;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsividad específica para pantallas pequeñas (ajusta el breakpoint aquí) */
@media (max-width: 720px) {
  body {
    font-size: 0.9rem;
  }

  main {
    padding-top: 120px;
  }

  .header-inner {
    flex-direction: column;
    gap: 16px;
  }

  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }

  .theme-toggle {
    align-self: flex-end;
  }

  .hero-top {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hero-links {
    width: 100%;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    gap: 8px;
  }

  .hero-links .btn {
    width: 100%;
    min-width: unset;
    padding: 8px 2px;
    font-size: 0.85rem;
  }

  section {
    scroll-margin-top: 160px;
  }

  .grid-gap {
    gap: var(--grid-gap-mobile);
  }

  h1 {
    font-size: clamp(2rem, 10vw, 3.1rem);
  }

  h2 {
    font-size: clamp(1.4rem, 7vw, 1.9rem);
  }

  /* En mobile mostramos los proyectos como lista para evitar cards demasiado grandes */
  .projects-grid {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Ajusta el espaciado vertical entre ítems de la lista móvil */
  }

  .projects-grid .card {
    background-color: var(--bg-card); /* Ligero fondo para mantener sensación de card */
    border: 1px solid var(--border);
    border-radius: 10px; /* Bordes sutiles para no perder del todo el look de card */
    box-shadow: none;
    padding: 14px 12px; /* Ajusta el padding vertical de cada ítem */
    min-height: 120px; /* Altura mínima/fija para que todas las filas midan igual en mobile */
    max-height: 120px; /* Ajusta aquí si prefieres más altura */
    transition: background-color 0.2s ease, border-color 0.2s ease;
    overflow: hidden; /* Evita que el contenido expanda la altura fija */
  }

  .project-card {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    row-gap: 6px;
    align-items: center;
    height: 100%;
  }

  .project-header {
    align-items: center;
  }

  .projects-grid .card h3 {
    margin: 0;
    font-size: 1.05rem; /* Ajusta el tamaño del título en la lista móvil */
  }

  .project-card p {
    margin: 0;
    grid-column: 1 / 2;
    font-size: 0.9rem; /* Ajusta el tamaño del texto descriptivo */
    display: -webkit-box; /* Limita líneas para sostener altura fija */
    -webkit-line-clamp: 2; /* Ajusta el número de líneas visibles */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .project-badge {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .project-card:hover,
  .project-card:active {
    background-color: rgba(255, 255, 255, 0.03); /* Sutileza al interactuar en mobile */
    border-color: var(--accent-muted);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
