/* ========================================
   1. IMPORTACIONES Y VARIABLES
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=VT323&display=swap');

:root {
  --font-tech: 'VT323', monospace;
  --font-text: 'Inter', sans-serif;
}

/* ========================================
   2. ESTILOS BASE
   ======================================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 0;
    background-color: #00A0E8; /* Color de respaldo */

    font-family: var(--font-text);
    /* ELIMINADO: font-weight: 300 (Se traslada a clase .fw-light en HTML) */
}

/* Pseudo-elementos para gestionar la transición del degradado del body */
body::before,
body::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Se colocan detrás del contenido */
    transition: opacity 0.5s ease-in-out;
}

/* Capa 1: Tema Default */
body::before {
    background-image: linear-gradient(to right, #00A0E8, #ECA0BE);
    opacity: 1;
}

/* Capa 2: Tema Alternativo (Invisible por defecto) */
body::after {
    background-image: linear-gradient(to right, #838885, #c1a0a0, #ECA0BE);
    opacity: 0;
}

main {
    flex: 1;
}

/* ========================================
   3. TIPOGRAFÍA
   ======================================== */

/* VT323 - Títulos y elementos estructurales */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-tech);
  /* ELIMINADO: text-transform: uppercase (Se traslada a clase .text-uppercase en HTML) */
  letter-spacing: 1px;
  font-weight: 400;
}

h1 {
  letter-spacing: 2px;
}

h2 {
  font-size: 3rem;
  color: #fff;
}

/* Hero específico */
#hero h1, .hero h1 {
  font-size: 4.5rem;
  line-height: 1;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.5);
}

/* Cursor parpadeante estilo terminal */
.cursor-blink {
  display: inline-block;
  margin-left: 8px;
  animation: blink 1s step-start infinite;
  color: inherit;
}

/* Animación de parpadeo */
@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

/* Inter - Texto legible */
p {
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
}

/* ========================================
   4. NAVEGACIÓN
   ======================================== */
.navbar {
    /* Cambiamos a background-color para permitir transición suave */
    background-color: rgba(0, 160, 232, 0.9);
    transition: background-color 0.5s ease-in-out;
}

.navbar-nav .nav-link,
.nav-menu a {
  font-family: var(--font-tech);
  /* ELIMINADO: font-size: 1.5rem (Se traslada a clase .fs-4 en HTML) */
  letter-spacing: 1px;
  /* ELIMINADO: text-transform: uppercase (Se traslada a .text-uppercase en HTML) */
  transition: color 0.3s ease, opacity 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ========================================
   5. COMPONENTES - CARDS Y PROYECTOS
   ======================================== */
.card-title {
  font-family: var(--font-tech);
  font-size: 1.8rem;
  /* ELIMINADO: text-transform: uppercase (Se traslada a HTML) */
}

/* --- NUEVO CÓDIGO: Efectos de Hover en Imágenes de Proyectos --- */
.card-img-wrapper {
  overflow: hidden; /* Mantiene la imagen dentro de los límites al hacer zoom */
  /* Replica el radio de borde superior (border-radius) típico de las cards de Bootstrap */
  border-top-left-radius: calc(0.375rem - 1px);
  border-top-right-radius: calc(0.375rem - 1px);
}

.card-img-top {
  transition: transform 0.4s ease, filter 0.4s ease; /* Transición suave para el efecto */
}

/* Al pasar el mouse sobre el link/contenedor, aplicamos los efectos a la imagen */
.card-img-link:hover .card-img-top {
  transform: scale(1.05);       /* Pequeño zoom */
  filter: brightness(1.15);     /* Efecto de iluminación (+15% brillo) */
}
/* --------------------------------------------------------------- */

.card-text,
.description,
.portfolio-info p {
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
}

/* Íconos en tarjetas de proyectos */
.culinariaJobsico, 
.githubico {
    width: 30px;
    height: auto;
}

/* ========================================
   6. SKILLS
   ======================================== */
.skills .progress .skill,
.skill-name {
  font-family: var(--font-tech);
  font-size: 1.3rem;
  /* ELIMINADO: text-transform: uppercase (Se traslada a HTML) */
}

/* Espacio fijo para comentarios de versión */
.skill-comment-space {
  min-height: 30px; /* Altura mínima fija */
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-text);
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 8px;
}

/* ========================================
   7. FORMULARIO DE CONTACTO
   ======================================== */
input, textarea, select {
  font-family: var(--font-text);
  font-size: 1rem;
}

input::placeholder, 
textarea::placeholder {
  font-family: var(--font-text);
  font-weight: 300;
}

/* Botón de envío */
#contact-form input[type="submit"],
#contact-form button[type="submit"] {
  font-family: var(--font-tech);
  /* ELIMINADO: text-transform: uppercase (Se traslada a HTML) */
  letter-spacing: 1px;
  background-color: #76a0d3;
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 0.375rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  width: auto;
  display: inline-block;
}

#contact-form input[type="submit"]:hover,
#contact-form button[type="submit"]:hover {
  background-color: #3d78bf;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#contact-form input[type="submit"]:active,
#contact-form button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   8. FOOTER
   ======================================== */
footer {
    background-color: #ECA0BE;
    transition: background-color 0.5s ease-in-out;
}

footer img {
    width: 60px;
    height: auto;
    margin: 0 10px;
    transition: transform 0.3s ease;
}

footer img:hover {
    transform: scale(1.1);
}

/* ========================================
   9. CONTROLES UI - SELECTOR DE TEMAS
   ======================================== */
#theme-switcher {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.theme-btn {
    width: 20px;
    height: 20px;
    border: 2px solid black;
    border-radius: 50%;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
}

.theme-btn:hover {
    transform: scale(1.2);
}

.theme-btn.active {
    background-color: black;
}

body.theme-dark .theme-btn {
    border: 2px solid white;
}

body.theme-dark .theme-btn.active {
    background-color: white;
}

/* ========================================
   10. CONTROLES UI - BOTÓN VOLVER ARRIBA
   ======================================== */
#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #ECA0BE;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, background-color 0.3s;
}

#btn-back-to-top:hover {
    transform: scale(1.1);
    background-color: #d68aab;
}

body.theme-dark #btn-back-to-top {
    background-color: #5AFF9D;
    box-shadow: 0 0 20px rgba(90, 255, 157, 0.5);
}

body.theme-dark #btn-back-to-top:hover {
    background-color: #42DDA5;
    box-shadow: 0 0 30px rgba(90, 255, 157, 0.8);
}

/* ========================================
   11. TEMA ALTERNATIVO
   ======================================== */
/* En lugar de cambiar el background, hacemos visible la capa ::after */
body.theme-alternative::after {
    opacity: 1;
}

/* (Opcional) Puedes quitar la regla antigua de body.theme-alternative que tenía el background-image */
/* body.theme-alternative { ... } */

body.theme-alternative .navbar {
    /* Usamos background-color sólido para transición suave */
    background-color: rgba(131, 136, 133, 0.9);
}

body.theme-alternative #contact-form input[type="submit"],
body.theme-alternative #contact-form button[type="submit"] {
  background-color: #c1a0a0;
}

body.theme-alternative #contact-form input[type="submit"]:hover,
body.theme-alternative #contact-form button[type="submit"]:hover {
  background-color: #a37272;
}

/* ========================================
   11B. TEMA OSCURO (DARK MODE)
   ======================================== */
/* Paleta vibrante para modo oscuro con colores fluorescentes */
body.theme-dark::before {
    background-image: linear-gradient(to right, #000000, #003255, #0064AA, #168182, #2B9D5A, #2ABAAC, #29D6FF, #42DDA5, #5AFF9D);
    opacity: 1;
}

body.theme-dark::after {
    opacity: 0;
}

body.theme-dark {
    background-color: #000000;
}

body.theme-dark .navbar {
    background-color: #000000 !important;
    border-bottom: 2px solid #29D6FF;
}

body.theme-dark h2,
body.theme-dark h1 {
    color: #5AFF9D;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
}

body.theme-dark .card {
    background-color: rgba(0, 100, 170, 0.15);
    border: 1px solid #29D6FF;
}

body.theme-dark .card-title {
    color: #42DDA5;
}

body.theme-dark .card-text {
    color: #e0e0e0;
}

body.theme-dark .badge {
    background-color: #168182 !important;
    color: #5AFF9D;
}

body.theme-dark #contact-form input[type="submit"],
body.theme-dark #contact-form button[type="submit"] {
    background-color: #2ABAAC;
    color: #000000;
    border: 2px solid #29D6FF;
}

body.theme-dark #contact-form input[type="submit"]:hover,
body.theme-dark #contact-form button[type="submit"]:hover {
    background-color: #29D6FF;
    color: #000000;
    box-shadow: 0 0 20px rgba(41, 214, 255, 0.6);
}

body.theme-dark .form-control,
body.theme-dark textarea {
    background-color: rgba(0, 100, 170, 0.2);
    border: 1px solid #2ABAAC;
    color: #e0e0e0;
}

body.theme-dark .form-control:focus,
body.theme-dark textarea:focus {
    background-color: rgba(0, 100, 170, 0.3);
    border-color: #29D6FF;
    box-shadow: 0 0 10px rgba(41, 214, 255, 0.5);
    color: #5AFF9D;
}

body.theme-dark .text-muted {
    color: #42DDA5 !important;
}

body.theme-dark a {
    color: #29D6FF;
}

body.theme-dark a:hover {
    color: #5AFF9D;
    text-shadow: 0 0 10px rgba(90, 255, 157, 0.5);
}

body.theme-dark footer {
    background-color: #5AFF9D;
    color: #000000 !important;
    border-top: 2px solid #29D6FF;
}

body.theme-dark footer a {
    color: #000000;
}

body.theme-dark footer a:hover {
    color: #003255;
    text-shadow: none;
}

body.theme-dark footer p {
    color: #000000;
    margin: 0;
}

body.theme-dark footer img:not([alt="MIT License"]) {
    filter: brightness(0);
}

body.theme-dark footer img[alt="MIT License"] {
    filter: brightness(1.2) contrast(1.1);
}

/* ========================================
   12. RESPONSIVE - MÓVILES Y TABLETS
   ======================================== */
@media (max-width: 768px) {
    /* Selector de temas */
    #theme-switcher {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row;
        background-color: rgba(255, 255, 255, 0.2);
        padding: 10px 15px;
        border-radius: 20px;
        -webkit-backdrop-filter: blur(5px);
        backdrop-filter: blur(5px);
    }

    .theme-btn {
        width: 25px;
        height: 25px;
    }

    /* Botón volver arriba */
    #btn-back-to-top {
        bottom: 20px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* ========================================
   13. ANIMACIONES DE ENTRADA (FADE IN)
   ======================================== */

/* Clase base para ocultar elementos inicialmente */
.fade-in-section {
    opacity: 0;
    transform: translateY(20px); /* Empieza un poco más abajo */
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

/* Clase que se agrega con JS para hacerlos aparecer */
.fade-in-section.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animación automática al cargar la página (para el Hero y About) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Aplicamos la animación al Hero y About automáticamente */
header .container-fluid > *,
#about > * {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0; /* Invisible al inicio */
}

/* Retrasos (Cascada) */
header h1 { animation-delay: 0.1s; }
header h2 { animation-delay: 0.3s; }
header p { animation-delay: 0.5s; }

#about h2 { animation-delay: 0.6s; }
#about p:nth-of-type(1) { animation-delay: 0.7s; }
#about p:nth-of-type(2) { animation-delay: 0.8s; }
#about p:nth-of-type(3) { animation-delay: 0.9s; }
#about p:nth-of-type(4) { animation-delay: 1.0s; }
#about p:nth-of-type(5) { animation-delay: 1.1s; }