/* ================================================= */
/* == 1. CONFIGURACIÓN GLOBAL Y RESET             == */
/* ================================================= */

html {
  scroll-behavior: smooth;
  box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

h1, h2, h3 {
  font-family: 'Poppins', sans-serif;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #007bff;
  font-weight: 700;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ================================================= */
/* == 2. LAYOUT PRINCIPAL (HEADER, FOOTER)        == */
/* ================================================= */

header {
  background-color: #f8f9fa;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
  position: relative;
  z-index: 10;
}

header .container {
  display: flex;
  justify-content: space-between; /* Alineación original restaurada */
  align-items: center;
}

.logo img {
  height: 60px;
  width: auto;
}

footer {
  background-color: #333;
  color: white;
  padding: 2rem 0;
}

footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

footer a {
  color: #f1f1f1;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
}

.social-icons {
  display: flex; /* Estilo de íconos restaurado */
  gap: 1.5rem;
}

.social-icons a {
  color: white;
  font-size: 1.5rem;
  transition: transform 0.3s ease, color 0.3s ease;
}

.social-icons a:hover {
  color: #007bff;
  transform: scale(1.2);
}

/* ================================================= */
/* == 3. NAVEGACIÓN (DESKTOP, MÓVIL, BOTONES)     == */
/* ================================================= */

.main-nav-desktop {
  display: block;
}
.main-nav-desktop ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1.5rem;
}
.main-nav-desktop a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
  transition: color 0.3s;
}
.main-nav-desktop a:hover {
  color: #007bff;
}

#main-content {
  position: relative;
  z-index: 1;
  background-color: white;
  transition: transform 0.5s ease;
}
#main-content.shifted {
  transform: translateX(280px);
}
.side-nav {
  display: block;
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background-color: #fff;
  padding-top: 60px;
  z-index: 2000;
  overflow-x: hidden;
  transition: left 0.5s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.side-nav.open {
  left: 0;
}
.side-nav a {
  padding: 10px 15px 10px 30px;
  text-decoration: none;
  font-size: 1.2rem;
  color: #333;
  display: block;
  transition: color 0.3s, background-color 0.3s;
}
.side-nav a:hover {
  color: #007bff;
  background-color: #f8f9fa;
}
.side-nav .close-btn {
  position: absolute;
  top: 0;
  right: 25px;
  font-size: 36px;
  color: #555;
}
.side-nav .close-btn:hover {
    color: #007bff;
}

.menu-toggle {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1000;
}
.hamburger-box {
  position: relative;
  display: inline-block;
  width: 100%;
  height: 100%;
}
.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
  position: absolute;
  width: 32px;
  height: 3px;
  background-color: #333;
  border-radius: 5px;
  transition: all 0.3s ease-in-out;
}
.hamburger-inner {
  display: block;
  top: 50%;
  transform: translateY(-50%);
}
.hamburger-inner::before, .hamburger-inner::after {
  content: "";
  display: block;
}
.hamburger-inner::before {
  top: -10px;
}
.hamburger-inner::after {
  bottom: -10px;
}
.menu-toggle.is-active .hamburger-inner {
  transform: rotate(225deg);
}
.menu-toggle.is-active .hamburger-inner::before {
  top: 0;
  transform: rotate(90deg);
}
.menu-toggle.is-active .hamburger-inner::after {
  opacity: 0;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  z-index: 1999;
  cursor: pointer;
}
.overlay.visible {
  display: block;
}

/* ================================================= */
/* == 4. ESTILOS DE SECCIONES Y COMPONENTES       == */
/* ================================================= */

section {
  padding: 4rem 0;
}

/* --- Estilos de la Sección Hero --- */
.hero {
  text-align: center; /* <-- ESTA LÍNEA CENTRA TODO */
}
.hero-content {
  max-width: 800px; /* Limita el ancho del texto en pantallas grandes */
  margin: 0 auto;   /* Centra el bloque de contenido */
}
.hero h1 {
  font-size: 2.5rem;
}

.portafolio, .sobre-nosotros {
  background-color: #f8f9fa;
}

.projects-grid, .services-grid, .articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 380px));
  gap: 20px;
  margin-top: 2rem;
  justify-content: center; /* Centra las tarjetas cuando hay espacio extra */
}

.project img {
  width: 100%;
  aspect-ratio: 4 / 3; /* <-- Proporción más cuadrada, ideal para variedad de imágenes */
  object-fit: cover;
  background-color: #eee;
}

.project, .article {
  background-color: white;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.project a, .article a {
  display: block;
  padding: 10px;
  text-align: center;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  transition: background-color 0.3s;
}
.project a:hover, .article a:hover {
  background-color: #0056b3;
}
.project h3, .project p, .article h3, .article p {
  padding: 0 1rem;
}
.project h3, .article h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.project p, .article p {
  padding-bottom: 1rem;
}
.article .meta {
  font-size: 0.9rem;
  color: #6c757d;
  padding-bottom: 0.5rem;
}

.service {
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 5px;
  text-align: center;
}

.contact-form {
  max-width: 600px;
  margin: 0 auto;
}
.form-group {
  margin-bottom: 1.5rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.button {
  display: inline-block;
  padding: 10px 20px;
  text-decoration: none;
  border-radius: 5px;
  transition: background-color 0.3s ease;
  cursor: pointer;
  border: none;
  font-weight: bold;
}
.button.primary {
  background-color: #007bff;
  color: white;
}
.button.primary:hover {
  background-color: #0056b3;
}
.button.secondary {
  background-color: #6c757d;
  color: white;
}
.button.secondary:hover {
  background-color: #5a6268;
}

.cta-center {
  text-align: center;
  margin-top: 2rem;
}

/* ================================================= */
/* == 5. BOTÓN VOLVER ARRIBA Y CLASES DE UTILIDAD == */
/* ================================================= */

.back-to-top {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  position: fixed !important;
  bottom: 30px !important;
  right: 30px !important;
  z-index: 999 !important;
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  background-color: #007bff;
  color: white;
  font-size: 24px;
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
.back-to-top:hover {
  background-color: #0056b3;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.main-nav-desktop a.active,
.side-nav a.active {
  color: #007bff;
  font-weight: bold;
}

/* ================================================= */
/* == 6. MEDIA QUERIES PARA DISEÑO RESPONSIVE     == */
/* ================================================= */

@media (max-width: 992px) {
  /* --- Visibilidad de la Navegación --- */
  .main-nav-desktop {
    display: none;
  }
  .menu-toggle {
    display: inline-block;
  }

  /* --- Ajustes de Texto y Layout --- */
  .hero h1 {
    font-size: 2rem;
  }
  .projects-grid, .services-grid, .articles-grid {
    grid-template-columns: 1fr;
  }
}

/* ================================================= */
/* == ESTILOS PARA PÁGINA DE DETALLE DE PROYECTO == */
/* ================================================= */

.project-detail-page #project-image {
  max-width: 800px; /*<-- La imagen nunca será más ancha que 800px */
  width: 100%;      /* Se asegura de que sea responsive en pantallas pequeñas */
  margin: 2rem auto; /* Centra la imagen y le da espacio vertical */
  display: block;
  border-radius: 8px; /* Bordes redondeados para un look moderno */
  box-shadow: 0 4px 15px rgba(0,0,0,0.1); /* Sombra sutil */
}

.project-detail-page #project-description p {
    line-height: 1.8; /* Mejora la legibilidad de la descripción */
    font-size: 1.1rem;
}



/* ================================================= */
/* == ESTILOS PARA LA SECCIÓN DE FUNCIONALIDADES  == */
/* ================================================= */

.features-grid {
  display: grid;
  gap: 2rem; /* Espacio entre cada función */
  margin-top: 2rem;
}

.feature-item {
  display: grid;
  grid-template-columns: 1fr; /* Una columna en móviles */
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid #eee;
}

.feature-item:last-child {
  border-bottom: none;
}

.feature-item img {
  display: block;
  width: auto;         /* El ancho se ajustará para mantener la proporción */
  max-width: 100%;     /* Nunca será más ancha que su contenedor */
  max-height: 70vh;    /* <-- LÍNEA CLAVE: Su altura no superará el 70% de la pantalla */
  margin: 0 auto;      /* Centra la imagen */
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.feature-item h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

/* En pantallas más grandes, usamos dos columnas */
@media (min-width: 768px) {
  .feature-item {
    grid-template-columns: 1fr 2fr; /* Columna de imagen, columna de texto */
  }

  /* Alternamos la posición de la imagen para un diseño más dinámico */
  .feature-item:nth-child(even) {
    grid-template-columns: 2fr 1fr;
  }
  
  .feature-item:nth-child(even) img {
    grid-column: 2; /* Mueve la imagen a la segunda columna */
    grid-row: 1;
  }
}



/* ================================================= */
/* == ESTILOS PARA LA PÁGINA "SOBRE NOSOTROS"     == */
/* ================================================= */

.about-details {
  margin-top: 3rem;
  display: grid;
  gap: 3rem;
}

.team-grid {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap; /* Permite que los miembros se ajusten en varias líneas */
}

.team-member {
  text-align: center;
  max-width: 250px;
}

.team-member img {
  width: 150px;
  height: 150px;
  border-radius: 50%; /* Hace la imagen redonda */
  object-fit: cover;
  margin-bottom: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.team-member h3 {
  margin-bottom: 0.25rem;
  color: #333; /* Un color más oscuro para el nombre */
}

.team-member p.role {
  color: #6c757d; /* Un color gris para el cargo */
  margin-top: 0;
}



/* ================================================= */
/* == SOLUCIÓN AGRESIVA PARA ELIMINAR DESPLAZAMIENTO == */
/* ================================================= */

#main-content,
.hero,
.portafolio,
.servicios,
.sobre-nosotros,
.blog,
.contacto {
    overflow-x: hidden;
}

/* ================================================= */
/* == 7. ESTILOS PARA PÁGINA DE DETALLE (MEJORADO) == */
/* ================================================= */

.project-detail-page {
    background-color: #f8f9fa; /* Un fondo suave para toda la página */
    padding-bottom: 4rem;      /* Espacio extra al final */
}

.project-header {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 2rem;
}

.project-header h1 {
    font-size: 2.8rem;
    color: #333;
}

#project-image {
  max-width: 800px; 
  width: 100%;     
  margin: 0 auto 2rem auto; /* Centrada y con espacio inferior */
  display: block;
  border-radius: 8px; 
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); /* Sombra más pronunciada */
}

.project-content-card {
    background-color: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin: 0 auto 2rem auto;
    max-width: 800px;
}

.project-content-card h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

#project-summary-content p {
    line-height: 1.8;
    font-size: 1.1rem;
    color: #555;
}

.project-cta {
    text-align: center;
}

.project-cta .button {
    padding: 12px 25px;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.project-cta .button:hover {
    transform: translateY(-2px);
}

/* Para añadir el ícono al botón */
.project-cta .button i {
    margin-left: 8px;
}

/* ================================================= */
/* == 8. SOLUCIÓN PARA EL FOOTER FLOTANTE         == */
/* ================================================= */

/* Hacemos que el contenedor principal ocupe toda la altura */
#main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Mínimo el 100% de la altura de la pantalla */
}

/* Hacemos que el contenido principal crezca y empuje el footer */
main {
    flex-grow: 1;
}