/*
========================================
Histórico de cambios

v1: Estilos iniciales (oscuro, azul, blanco, gris, responsive, grid proyectos)
v2: Agregado modo claro/oscuro con switch, uso de root variables
v3: Header sticky/fixed, padding-top en body, sombra
v4: Secciones min-height 100vh menos header (desktop/mobile)
v5: Menú burger para mobile, animación y despliegue
v6: Grid proyectos "ver más", responsive
v7: Mejoras responsive, detalles visuales, mayor accesibilidad
v8: [ACTUAL] Todas las secciones min-height 100vh con header sticky flotante, menú burger en mobile, grid proyectos con ver más, modo claro/oscuro, y todos los ajustes de hoy.
========================================
*/

:root {
  /* Oscuro */
  --header-bg-dark: #0a1931;
  --footer-bg-dark: #0a1931;
  --border-dark: #39aafc;
  --bg-dark: #1a1a1a;
  --bg-dark-alt: #222d3a;
  --bg-dark-main: #111;
  --text-dark: #f5f5f5;

  /* Claro */
  --header-bg-light: #39aafc;
  --footer-bg-light: #39aafc;
  --border-light: #185adb;
  --bg-light: #fff;
  --bg-light-alt: #e6ecf5;
  --bg-light-main: #f2f4f8;
  --text-light: #21243d;

  /* Comunes */
  --primary: #185adb;
  --primary-accent: #39aafc;
  --btn-bg: #39aafc;
  --btn-bg-hover: #185adb;
  --btn-text: #111;
  --btn-text-hover: #fff;
}

html {
  scroll-behavior: smooth;
}

/* ===== HEADER STICKY Y MENU ===== */
header {
  background: var(--header-bg-dark);
  color: #fff;
  padding: 1.2rem 0 0.7rem 0;
  border-bottom: 3px solid var(--border-dark);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.08);
  transition: background 0.3s, border-color 0.3s;
}
body.light header {
  background: var(--header-bg-light);
  border-bottom: 3px solid var(--border-light);
  color: var(--text-light);
}

/* Espacio arriba para el header */
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-dark-main);
  color: var(--text-dark);
  transition: background 0.3s, color 0.3s;
  padding-top: 85px;
}
body.light {
  background: var(--bg-light-main);
  color: var(--text-light);
}

@media (max-width: 600px) {
  body {
    padding-top: 75px;
  }
  header {
    padding: 0.9rem 0 0.5rem 0;
  }
}

/* Layout del header */
.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: wrap;
  position: relative;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.header-text {
  flex: 2;
  min-width: 220px;
}
.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ===== MENÚ BURGER MOBILE ===== */
.burger {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 200;
}
.burger span,
.burger span:before,
.burger span:after {
  display: block;
  background: #fff;
  height: 4px;
  width: 28px;
  border-radius: 2px;
  position: absolute;
  left: 6px;
  transition: all 0.3s;
}
.burger span {
  top: 18px;
}
.burger span:before {
  content: '';
  top: -10px;
}
.burger span:after {
  content: '';
  top: 10px;
}
.burger.active span {
  background: transparent;
}
.burger.active span:before {
  transform: rotate(45deg) translate(5px,5px);
}
.burger.active span:after {
  transform: rotate(-45deg) translate(6px,-6px);
}

/* Navegación y menú burger */
nav {
  transition: max-height 0.3s, opacity 0.3s;
}
@media (max-width: 700px) {
  nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--header-bg-dark, #0a1931);
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    box-shadow: 0 6px 18px 0 rgba(0,0,0,0.09);
    z-index: 150;
  }
  nav.open {
    max-height: 400px;
    opacity: 1;
  }
  nav ul {
    flex-direction: column;
    gap: 1.2rem;
    align-items: flex-start;
    margin: 1rem 0;
    padding: 0 1.5rem 1rem 1.5rem;
  }
  .burger {
    display: block;
    margin-left: 1rem;
  }
  .theme-switch {
    margin-top: 0.5rem;
  }
  .header-flex {
    flex-wrap: nowrap;
  }
}

/* ===== TITULOS Y NAVEGACION ===== */
h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 2px;
}
.subtitle {
  color: var(--primary-accent);
  font-weight: 400;
  margin: 0.5rem 0 1rem 0;
}
body.light .subtitle {
  color: var(--primary);
}
nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  display: flex;
  justify-content: flex-start;
  gap: 2rem;
}
nav a {
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.1rem;
  transition: color 0.2s;
}
nav a:hover {
  color: #fff;
}
body.light nav a {
  color: var(--primary);
}
body.light nav a:hover {
  color: var(--primary);
  background: var(--primary-accent, #FFFFFF);
}

/* ===== SECCIONES 100VH ===== */
.section,
.section.alt {
  min-height: calc(100vh - 115px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 600px) {
  .section,
  .section.alt {
    min-height: calc(100vh - 105px);
  }
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}
.section-flex {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.section-text {
  flex: 2;
  min-width: 220px;
}
h2 {
  color: var(--primary-accent);
  margin-top: 0;
  font-size: 2rem;
  font-weight: 600;
  text-shadow: 1px 1px 2px #0001;
  transition: color 0.3s;
}
body.light h2 {
  color: var(--primary);
  text-shadow: 1px 1px 2px #fff;
}
ul.interests {
  list-style: disc inside;
  color: inherit;
}

/* ===== GRID DE PROYECTOS ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}
.project-card {
  background: var(--bg-dark-main, #f8f8f8);
  border: 1px solid var(--primary-accent, #39aafc);
  border-radius: 8px;
  padding: 1rem;
  color: var(--text-dark, #21243d);
  transition: box-shadow 0.2s, background 0.3s, color 0.3s;
  min-width: 0;
  font-size: 1rem;
}
.project-card h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--primary-accent, #39aafc);
}
body.light .project-card {
  background: var(--bg-light-main, #f8f8f8);
  border: 1px solid var(--primary, #185adb);
  color: var(--text-light, #21243d);
}
body.light .project-card h3 {
  color: var(--primary, #185adb);
}
.project-card a {
  color: var(--primary-accent, #39aafc);
  text-decoration: underline;
  font-weight: bold;
  transition: color 0.2s, background 0.2s;
  padding: 1px 3px;
  border-radius: 4px;
}
.project-card a:hover {
  color: #fff;
  background: var(--primary, #185adb);
}
body.light .project-card a {
  color: var(--primary, #185adb);
}
body.light .project-card a:hover {
  color: var(--btn-text, #111);
  background: var(--primary-accent, #39aafc);
}

/* ===== BOTÓN VER MÁS PROYECTOS ===== */
.ver-mas-btn {
  display: block;
  margin: 2rem auto 0 auto;
  padding: 0.7rem 2rem;
  background: var(--primary-accent, #39aafc);
  color: var(--btn-text, #111);
  font-weight: bold;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1.05rem;
  transition: background 0.2s, color 0.2s;
}
.ver-mas-btn:hover {
  background: var(--primary, #185adb);
  color: var(--btn-text-hover, #fff);
}
body.light .ver-mas-btn {
  background: var(--primary, #185adb);
  color: #fff;
}
body.light .ver-mas-btn:hover {
  background: var(--primary-accent, #39aafc);
  color: var(--btn-text, #111);
}

/* ===== OTROS BOTONES Y LINKS ===== */
.mail-btn {
  display: inline-block;
  margin: 1rem 0;
  padding: 0.6rem 1.4rem;
  background: var(--btn-bg);
  color: var(--btn-text) !important;
  font-weight: bold;
  font-size: 1.1rem;
  border-radius: 30px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  box-shadow: 0 2px 10px #0001;
  letter-spacing: 1px;
  border: none;
}
.mail-btn:hover {
  background: var(--btn-bg-hover);
  color: var(--btn-text-hover) !important;
}
body.light .mail-btn {
  background: var(--primary);
  color: #fff !important;
}
body.light .mail-btn:hover {
  background: var(--primary-accent);
  color: var(--btn-text) !important;
}

.social-links a {
  margin-right: 1rem;
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s;
}
.social-links a:hover {
  color: #fff;
}
body.light .social-links a {
  color: var(--primary);
}
body.light .social-links a:hover {
  color: var(--primary-accent);
}

/* ===== FOOTER ===== */
footer {
  background: var(--footer-bg-dark);
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  border-top: 2px solid var(--border-dark);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
body.light footer {
  background: var(--footer-bg-light);
  color: var(--text-light);
  border-top: 2px solid var(--border-light);
}

/* ===== RESPONSIVE GENERAL ===== */
@media (max-width: 900px) {
  .container {
    padding: 1.5rem 0.8rem;
  }
  .header-flex,
  .section-flex {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  nav ul {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding-left: 0;
  }
}
@media (max-width: 600px) {
  .container {
    padding: 1rem 0.4rem;
  }
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.3rem;
  }
  .project-card {
    font-size: 0.95rem;
    padding: 0.7rem 0.6rem;
  }
  .section-flex {
    gap: 0.7rem;
  }
  .mail-btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
  }
  nav ul {
    gap: 0.6rem;
  }
  .theme-switch {
    margin-top: 0.5rem;
  }
  .ver-mas-btn {
    width: 100%;
    font-size: 1rem;
    padding: 0.6rem 0;
  }
}
/* Efecto typewriter cursor 
.typewriter-cursor {
  display: inline-block;
  width: 1ch;
  color: inherit;
  background: none;
  animation: blink 1s steps(1) infinite;
  font-weight: 900;
  font-size: 2.5rem;
  vertical-align: bottom;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
 */
 #typewriter-title {
  min-height: 3.1rem;
  display: block;
}
@media (max-width: 600px) {
  #typewriter-title {
    min-height: 2.3rem;
  }
}

/* ===== SWITCH MODO CLARO/OSCURO ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  background-color: #ccc;
  border-radius: 34px;
  top: 0; left: 0; right: 0; bottom: 0;
  transition: .4s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: .4s;
}
input:checked + .slider {
  background-color: #185adb;
}
input:checked + .slider:before {
  transform: translateX(20px);
}
@media (min-width: 701px) {
  .theme-switch {
    position: absolute;
    top: 100px;
    right: 32px;
    margin-top: 0 !important;
    z-index: 201;
  }
  .header-flex {
    position: relative;
  }
}