/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base */
html,
body {
  height: 100%; /* Asegura que html y body tomen la altura completa del viewport */
  overflow-x: hidden; /* Previene el scroll horizontal */
  overflow-y: auto; /* Hace que el body sea el contenedor principal de scroll vertical */
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  line-height: 1.6;
  color: #000;
  background: #fff;
}

.container {
  display: flex;
  height: 100%; /* Ensure container takes full height */
  position: relative; /* MODIFIED: Added for absolute positioning of main-content */
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  padding: 60px 40px; /* Padding normal */
  z-index: 100;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.hidden {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none; /* Deshabilita interacciones cuando está oculto */
}

.sidebar.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.name {
  font-family: "Inter", sans-serif;
  font-size: 26px; /* Agrandado */
  color: #000;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
  line-height: 1.2;
  white-space: nowrap; /* <--- Esto es clave */
}

.sidebar-description {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: #555;
  margin-bottom: 5px;
  line-height: 1.4;
  white-space: nowrap; /* <-- ¡Esto evita el salto de línea! */
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 60px;
}

.nav-link {
  font-family: "Inter", sans-serif;
  font-size: 16px;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  position: relative;
  transition: color 0.4s ease;
  padding-bottom: 3px;
  letter-spacing: 0.2px;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  color: #000;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0.5px;
  background: #000;
  transition: width 0.4s ease;
}

.nav-link.active::after,
.nav-link:hover::after {
  width: 100%;
}

/* Top Navbar */
.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px; /* Altura de la barra superior */
  background: #fff;
  z-index: 99; /* Menor que el sidebar para que el sidebar lo cubra si es necesario */
  display: flex;
  align-items: center;
  padding: 0 40px;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.top-navbar.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.top-navbar.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.top-navbar .name {
  font-family: "Inter", sans-serif;
  font-size: 24px;
  font-weight: 500;
  color: #000;
  margin-right: 40px; /* Espacio entre el nombre y los enlaces */
}

.top-navbar .top-navbar-links {
  display: flex;
  gap: 25px; /* Espacio entre los enlaces de la barra superior */
}

.top-navbar .nav-link {
  font-size: 15px; /* Tamaño de fuente más pequeño para la barra superior */
  padding-bottom: 2px;
}

.main-content {
  flex-grow: 1;
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  height: auto; /* Mantener auto para que el contenido determine la altura */
  overflow-y: visible; /* Permitir que el contenido desborde y cause scroll en el body */
  overflow-x: hidden;
  transition: left 0.3s ease, width 0.3s ease, top 0.3s ease, height 0.3s ease;
}

.main-content.with-sidebar {
  margin-left: 260px;
  width: calc(100% - 260px);
  height: auto;
  overflow-y: visible;
}

.main-content.with-top-navbar {
  margin-top: 80px;
  width: 100%;
  height: auto;
  overflow-y: visible;
  padding-top: 0;
}

.section {
  display: none !important;
  position: relative;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.active {
  display: flex !important;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* Principal Section (New Homepage Layout) */
#principal {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
  position: relative;
}

/* Homepage Layout - Two Column Flexbox */
.homepage-layout {
  display: flex;
  flex-direction: row; /* Explicitly set row for desktop */
  width: 100%;
  height: 100vh;
}

.homepage-navigation {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-left: 80px;
  height: 100vh;
}

.homepage-title {
  font-family: "Inter", sans-serif;
  font-size: 48px;
  font-weight: 500;
  color: #000;
  margin-bottom: 10px;
  letter-spacing: -1px;
  line-height: 1.1;
}

.homepage-subtitle {
  font-family: "Inter", sans-serif;
  font-size: 18px;
  font-weight: 300;
  color: #555;
  margin-bottom: 8px;
  line-height: 1.4;
}

.homepage-nav {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 60px;
}

.homepage-nav-link {
  font-family: "Inter", sans-serif;
  font-size: 20px;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  position: relative;
  transition: color 0.4s ease;
  padding-bottom: 4px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.homepage-nav-link:hover {
  color: #000;
}

.homepage-nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: #000;
  transition: width 0.4s ease;
}

.homepage-nav-link:hover::after {
  width: 100%;
}

.homepage-image {
  flex: 1;
  height: 100vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-right: 80px;
  padding-bottom: 10vh;
}

.homepage-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  max-width: 600px;
  max-height: 600px;
}

/* Tablet adjustments for homepage */
@media (max-width: 1024px) and (min-width: 769px) {
  .homepage-navigation {
    padding-left: 60px;
  }
}

/* Legacy hero image wrapper - now hidden */
.hero-image-wrapper {
  display: none !important;
}

/* Content Sections (Trayectoria, Prensa, Destacados, Fotos, Contacto) */
.content-section {
  display: block; /* Ensure it's block for content flow */
  min-height: auto; /* Allow height to shrink to content */
  padding: 30px 60px 80px 60px; /* MODIFIED: Consistent padding for content sections */
  align-items: flex-start; /* Align content to top */
  justify-content: flex-start; /* Align content to left */
}

.content-block {
  max-width: 1600px; /* MODIFIED: Increased max-width to give more space for 4 columns */
  text-align: left;
  padding: 0; /* Remove extra padding */
}

.section-title {
  font-family: "Inter", sans-serif;
  font-size: 40px;
  font-weight: 500;
  margin-top: 0; /* MODIFIED: Removed margin-top, now handled by content-section padding */
  margin-bottom: 30px;
  color: #000;
}

.section-text {
  font-family: "Inter", sans-serif;
  font-size: 18px;
  line-height: 1.8;
  color: #333;
  margin-bottom: 20px;
}

/* Photo Grid (general, for other sections if needed) */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 1200px;
}

.photo-item {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.photo-item:hover {
  transform: scale(1.02);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
}

/* Large Photo Grid (for Fotos section) */
#fotos .large-photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: minmax(400px, auto);
  gap: 20px;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto 60px auto;
  padding: 0;
}

/* Specific placement for the first few images to match the reference */
#fotos .large-photo-item-1 {
  grid-column: 1;
  grid-row: span 2;
  aspect-ratio: 1 / 1.3;
  height: 100%;
}

#fotos .large-photo-item-2 {
  grid-column: 2;
  grid-row: 1;
  aspect-ratio: 1.6 / 1;
}

#fotos .large-photo-item-3 {
  grid-column: 2;
  grid-row: 2;
  aspect-ratio: 1.3 / 1;
}

#fotos .large-photo-item-4 {
  grid-column: 1 / span 2;
  grid-row: 3;
  aspect-ratio: 2.5 / 1;
}

/* For the rest of the images (from 5 onwards), they will flow naturally in a 2-column grid */
#fotos .large-photo-item:nth-child(n + 5) {
  grid-column: auto;
  grid-row: auto;
  aspect-ratio: 1.5 / 1;
}

#fotos .large-photo-item {
  width: 100%;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}

#fotos .large-photo-item:hover {
  transform: scale(1.02);
}

#fotos .large-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
}

/* Highlights Section */
#destacados .highlights-content {
  max-width: 1600px; /* Ajustado para que coincida con .content-block y los videos sean del mismo tamaño que Trayectoria */
  margin: 0 auto; /* Centra el contenido */
}

/* Mobile improvements for Destacados content */
@media (max-width: 768px) {
  #destacados .highlights-content {
    max-width: 100%;
    padding: 0 10px;
  }
}

.highlight-item {
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.highlight-item:hover {
  transform: scale(1.02);
}

.highlight-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
}

/* Social Content */
.social-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
  align-items: center;
}

.social-link {
  font-size: 24px;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
  padding-bottom: 3px;
}

.social-link:hover {
  color: #000;
}

.social-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0.5px;
  background: #000;
  transition: width 0.3s ease;
}

.social-link:hover::after {
  width: 100%;
}

/* Contact Content */
#contacto .contact-layout {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two columns for desktop */
  gap: 60px; /* Space between columns */
  align-items: center; /* Vertically align items in the grid */
  margin-top: 30px;
}

/* Tablet adjustments for Contact */
@media (max-width: 1024px) {
  #contacto .contact-layout {
    grid-template-columns: 1fr; /* Single column on tablet */
    gap: 40px;
    text-align: center;
  }

  .contact-image-wrapper {
    width: 400px;
    height: 400px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  #contacto .contact-layout {
    gap: 30px;
    padding: 0 10px;
  }

  .contact-image-wrapper {
    width: 280px;
    height: 280px;
  }
}

.contact-image-wrapper {
  width: 600px;
  height: 600px;
  overflow: hidden;
  border-radius: 8px; /* Optional: rounded corners for the image */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-main-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure the image covers the area */
  display: block;
}

.contact-details {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* Align text and links to the left */
  gap: 20px; /* Space between intro text and links group */
}

.contact-intro-text {
  font-family: "Inter", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: #333;
  margin-bottom: 10px;
}

.contact-links-group {
  display: flex;
  flex-direction: column;
  gap: 25px; /* Space between individual contact links */
  align-items: flex-start; /* Align links to the left */
}

.contact-link {
  display: flex; /* Para alinear el ícono y el texto */
  align-items: center;
  gap: 10px; /* Espacio entre el ícono y el texto */
  font-size: 20px;
  font-weight: 300;
  color: #888;
  text-decoration: none;
  position: relative;
  padding-bottom: 3px;
}

.contact-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0; /* Prevent icon from shrinking */
}

/* Mobile adjustments for contact icons and text */
@media (max-width: 768px) {
  .contact-icon {
    width: 20px;
    height: 20px;
  }

  .contact-link {
    font-size: 16px; /* Smaller text on mobile */
    gap: 8px; /* Smaller gap */
  }

  .contact-intro-text {
    font-size: 16px;
    text-align: center;
  }
}

/* Mantener los estilos de hover y after para .contact-link */
.contact-link:hover,
.contact-link.active {
  color: #000;
}

.contact-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0.5px;
  background: #000;
  transition: width 0.3s ease;
}

.contact-link:hover::after {
  width: 100%;
}

/* New grid styles for Trayectoria and Prensa */
/* media-grid for Trayectoria (3 columns) */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-top: 30px; /* Added margin-top for consistency */
}

/* Specific override for Destacados section to have 3 columns */
#destacados .media-grid {
  grid-template-columns: repeat(3, 1fr); /* Asegura 3 columnas para Destacados */
}

/* Tablet adjustments for Destacados */
@media (max-width: 1024px) {
  #destacados .media-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
}

@media (max-width: 640px) {
  #destacados .media-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

/* video-grid for Prensa (3 columns) */
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 30px; /* Space between video grid and image grid */
}

/* image-grid for Prensa (4 columns) */
.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* MODIFIED: 4 columns for images */
  gap: 20px; /* MODIFIED: Reduced gap for more image space */
}

/* Tablet adjustments for Prensa grids */
@media (max-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }
  .image-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .video-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .image-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

/* Styles for media items (common to video and image grids) */
.media-item {
  background-color: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.media-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.media-item video,
.media-item img {
  width: 100%;
  aspect-ratio: 3 / 4; /* Default vertical aspect ratio */
  object-fit: cover; /* Default to cover for other sections */
  display: block;
}

/* Specific aspect ratio for videos in the video-grid (Prensa) */
.video-grid .media-item video {
  aspect-ratio: 16 / 9; /* Make videos in video-grid wider */
}

/* IMPORTANT: Ensure images in image-grid (Prensa) show entirely */
.image-grid .media-item img {
  object-fit: contain; /* Changed to contain for Prensa images */
}

.media-item .media-title {
  font-family: "Inter", sans-serif;
  font-size: 20px;
  font-weight: 500;
  color: #000;
  margin: 15px 15px 5px 15px;
  line-height: 1.3;
}

.media-item .media-description {
  font-family: "Inter", sans-serif;
  font-weight: bold;
  font-size: 14px;
  color: #555;
  padding: 0 15px 15px 15px;
  line-height: 1.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  /* Hide top navbar completely on mobile */
  .top-navbar,
  .top-navbar.visible,
  .top-navbar.hidden {
    display: none !important;
  }

  .sidebar {
    position: fixed; /* Changed back to fixed for better positioning */
    left: -300px; /* Hidden by default */
    top: 0;
    transition: left 0.3s ease;
    z-index: 1001; /* Higher than overlay */
    width: 300px;
    height: 100vh;
    background: #fff;
    padding: 60px 40px;
    justify-content: flex-start;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar.open {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    margin-top: 0; /* Remove any top margin */
    width: 100%;
  }

  .main-content.with-top-navbar {
    margin-top: 0 !important; /* Ensure no top margin */
  }

  .section {
    padding: 20px 15px; /* Reduced padding for mobile */
  }

  /* Mobile adjustments for homepage */
  .homepage-layout {
    flex-direction: row !important;
    height: 100vh;
  }

  .homepage-navigation {
    flex: 1;
    align-items: flex-start;
    text-align: left;
    padding: 20px;
    justify-content: center;
    height: 100vh;
  }

  .homepage-title {
    font-size: 36px;
    margin-bottom: 8px;
  }

  .homepage-subtitle {
    font-size: 16px;
    margin-bottom: 6px;
  }

  .homepage-nav {
    gap: 20px;
    margin-top: 40px;
  }

  .homepage-nav-link {
    font-size: 18px;
  }

  .homepage-image {
    flex: 1;
    height: 100vh;
    position: relative;
    overflow: hidden;
  }

  .homepage-image img {
    width: 200%;
    height: 100vh;
    object-fit: cover;
    border-radius: 50%;
    position: absolute;
    right: 0;
    top: 10vh;
    transform: translateX(50%);
  }

  .name {
    font-size: 24px;
  }

  .sidebar-description {
    font-size: 12px;
  }

  .navigation {
    gap: 20px;
    margin-top: 40px;
  }

  .nav-link {
    font-size: 15px;
  }

  .section-title {
    font-size: 32px;
    margin-top: 0; /* MODIFIED: Removed margin-top, now handled by content-section padding */
  }

  .section-text {
    font-size: 16px;
  }

  /* Mobile grid for photos - updated to use photo-gallery-grid */
  #fotos {
    padding: 20px 10px 30px 10px; /* Reduced padding for mobile */
  }

  .highlights-content {
    gap: 30px;
  }

  .social-link {
    font-size: 20px;
  }

  .contact-link {
    font-size: 18px;
  }

  .top-navbar {
    height: 60px;
    padding: 0 20px;
  }

  .top-navbar .name {
    font-size: 20px;
    margin-right: 20px;
  }

  .top-navbar .top-navbar-links {
    gap: 15px;
  }

  .top-navbar .nav-link {
    font-size: 13px;
  }

  .main-content.with-top-navbar {
    margin-top: 60px;
    height: auto;
  }

  .content-section {
    padding: 20px 15px 30px 15px; /* More compact mobile padding */
  }
  /* Mobile adjustments for new grids */
  .video-grid,
  .image-grid,
  .media-grid {
    /* Ensure media-grid also becomes single column on mobile */
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 15px; /* Reduced gap for mobile */
  }
  /* Specific override for Destacados section on mobile to remain 1 column */
  #destacados .media-grid {
    grid-template-columns: 1fr;
    gap: 15px; /* Smaller gap for mobile */
  }
  .media-item video,
  .media-item img {
    aspect-ratio: 3 / 4; /* Maintain vertical aspect ratio on mobile */
  }
  /* Override for mobile to ensure videos are vertical again */
  .video-grid .media-item video {
    aspect-ratio: 16 / 9; /* Keep horizontal for mobile videos */
  }
  /* Override for mobile to ensure images are vertical again */
  .image-grid .media-item img {
    object-fit: contain; /* Keep contain for mobile too */
    aspect-ratio: 4 / 3; /* Better aspect ratio for mobile images */
  }
  .media-item .media-title {
    font-size: 16px; /* Smaller title for mobile */
    margin: 10px 10px 5px 10px; /* Reduced margins */
  }
  .media-item .media-description {
    font-size: 13px;
    padding: 0 10px 10px 10px; /* Reduced padding */
  }

  /* Mobile adjustments for Contacto section */
  #contacto .contact-layout {
    grid-template-columns: 1fr !important;
    gap: 30px; /* Smaller gap for mobile */
    padding: 0 10px;
  }

  .contact-details {
    align-items: center; /* Center align for mobile */
    text-align: center;
  }

  .contact-links-group {
    align-items: center; /* Center align links for mobile */
  }

  .contact-image-wrapper {
    width: 250px;
    height: 250px;
    margin: 0 auto;
  }
}

/* Mobile Menu Button */
.mobile-menu {
  display: none;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1002;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 20px;
  color: #000;
  cursor: pointer;
  font-weight: 400;
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

/* Mobile sidebar overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .mobile-menu {
    display: block;
  }
}

/* Focus states */
.nav-link:focus,
.social-link:focus,
.contact-link:focus {
  outline: 1px solid #000;
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: #000;
  color: #fff;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Image Modal Styles */
.image-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 10000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.9); /* Black w/ opacity */
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-modal.active {
  display: flex;
  opacity: 1;
}

.image-modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 90%;
  object-fit: contain; /* Ensure the image fits within the modal */
}

.image-modal-caption {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 150px;
}

.image-modal-close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.image-modal-close:hover,
.image-modal-close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

/* Animation for modal */
.image-modal-content {
  -webkit-animation-name: zoom;
  -webkit-animation-duration: 0.6s;
  animation-name: zoom;
  animation-duration: 0.6s;
}

@-webkit-keyframes zoom {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

@keyframes zoom {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* New styles for the photo gallery grid */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns */
  gap: 20px; /* Gap between images */
  width: 100%;
  max-width: 1600px; /* Adjust as needed */
  margin: 0 auto;
}

/* Tablet adjustments for photo gallery */
@media (max-width: 1024px) {
  .photo-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .photo-gallery-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on small mobile */
    gap: 12px;
  }
}

.photo-gallery-item {
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease;
  aspect-ratio: 1 / 1; /* Maintain square aspect ratio */
}

.photo-gallery-item:hover {
  transform: scale(1.02);
}

.photo-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure images fill the space without distortion */
  display: block;
  filter: none; /* Ensure no filters are applied */
}

/* Mobile adjustments for photo gallery */
  .photo-gallery-item {
    aspect-ratio: 1 / 1; /* Keep square aspect ratio */
  }

  #fotos {
    padding: 20px 10px 30px 10px; /* Reduced padding for mobile */
  }

  #fotos .section-title {
    text-align: center; /* Center title on mobile */
    margin-bottom: 20px;
  }


#destacados .media-grid .media-item video {
  aspect-ratio: 3 / 4;
}

/* Better mobile handling for Destacados videos */
@media (max-width: 768px) {
  #destacados .media-grid .media-item video {
    aspect-ratio: 16 / 9; /* Horizontal on mobile for better viewing */
  }
}

/* New grid styles for Trayectoria */
#trayectoria .trayectoria-videos {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 5 columns for videos */
  gap: 30px;
  margin-top: 30px;
}

#trayectoria .trayectoria-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 columns for images */
  gap: 30px;
  margin-top: 30px; /* Add margin between video and image grids */
}

/* ================== ADICIONES FULL RESPONSIVE ================== */

/* Menú hamburguesa siempre visible en móvil */
.mobile-menu {
  display: block !important;
}
@media (min-width: 769px) {
  .mobile-menu {
    display: none !important;
  }
}

/* Imagen de inicio partida a la mitad en smartphones */
@media (max-width: 480px) {
  .hero-image-wrapper {
    position: relative !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    clip-path: inset(0 0 0 50%) !important;
  }
  .hero-image-wrapper img {
    width: 200% !important;
    height: 100% !important;
    object-fit: cover !important;
    transform: translateX(-25%) !important;
  }
  #principal {
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* Asegurar navegación funcional en tablets */
@media (max-width: 1024px) and (min-width: 769px) {
  .sidebar {
    left: -260px !important;
  }
  .sidebar.open {
    left: 0 !important;
  }
  .top-navbar.visible {
    display: flex !important;
  }
  .top-navbar.hidden {
    display: none !important;
  }
}

/* Ajustes de sección Contacto en móviles */
@media (max-width: 768px) {
  #contacto .contact-layout {
    grid-template-columns: 1fr !important;
    padding: 20px !important;
  }
  .contact-details,
  .contact-links-group {
    align-items: center !important;
    text-align: center !important;
  }
}

/* ====== FINAL RESPONSIVE OPTIMIZATIONS ====== */

/* Additional breakpoint for very small devices */
@media (max-width: 480px) {
  .section-title {
    font-size: 28px; /* Smaller titles on very small screens */
  }

  .content-section {
    padding: 15px 10px 20px 10px; /* Minimal padding for very small screens */
  }

  .media-item .media-title {
    font-size: 14px;
    margin: 8px 8px 4px 8px;
  }

  .media-item .media-description {
    font-size: 12px;
    padding: 0 8px 8px 8px;
  }

  /* Homepage adjustments for very small screens */
  .homepage-navigation {
    margin: 0 15px;
    padding: 30px 15px;
  }

  .homepage-title {
    font-size: 32px;
  }

  .homepage-subtitle {
    font-size: 14px;
  }

  .homepage-nav {
    margin-top: 30px;
    gap: 18px;
  }

  .homepage-nav-link {
    font-size: 16px;
  }
}

/* Improved navigation visibility */
@media (max-width: 768px) {
  .mobile-menu {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1002;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    display: block !important;
  }
}

/* Hide mobile menu on larger screens */
@media (min-width: 769px) {
  .mobile-menu {
    display: none !important;
  }
}

/*=========================
  LAYOUT “Trayectoria”
=========================*/

/* Escritorio: 5 videos arriba + 3 fotos debajo */
@media (min-width: 769px) {
  #trayectoria .trayectoria-videos {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 30px;
    margin-top: 30px;
  }
  #trayectoria .trayectoria-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 30px;
  }
}

/* Móvil: 1 columna para todo */
@media (max-width: 768px) {
  #trayectoria .trayectoria-videos,
  #trayectoria .trayectoria-images {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
  }
}

/* ================================
   REFINAMIENTO Sección “Inicio” Desktop
   ================================ */
@media (min-width: 769px) {
  .homepage-layout {
    /* Centra ambos bloques y añade espacio entre ellos */
    justify-content: center !important;
    align-items: center !important;
    gap: 200px !important;
    height: 100vh; /* Mantén el 100% de altura de viewport */
  }

  .homepage-navigation {
    /* Que ocupe sólo lo necesario y reduzca padding */
    flex: 0 0 auto !important;
    height: auto !important;
    padding-left: 20px !important;
  }

  .homepage-image {
    /* Igual, sólo lo necesario y quita padding-bottom */
    flex: 0 0 auto !important;
    height: auto !important;
    padding-right: 20px !important;
    padding-bottom: 0 !important;
  }

  .homepage-image img {
    /* Haz la foto más grande dentro de límites */
    width: auto !important;
    height: auto !important;
    max-width: 700px !important;
    max-height: 700px !important;
  }
}

/*=========================
  FOTO Galería: 1 columna en móvil
=========================*/
@media (max-width: 768px) {
  .photo-gallery-grid {
    grid-template-columns: 1fr !important;  /* Una sola columna */
    gap: 20px !important;                   /* Espacio un poco mayor */
    padding: 0 10px !important;             /* Margen lateral para respirar */
  }
}

/* —————————————
   Contador-footer en #principal (todas las vistas)
   ————————————— */
#principal {
  position: relative;    /* ancla para el contador absolute */
  min-height: 100vh;     /* que ocupe toda la altura del viewport */
  overflow: hidden;      /* evita que aparezca scroll por el absolute */
}

#principal .visit-counter {
  position: absolute;
  bottom: 20px;          /* separación desde la base */
  left: 50%;             /* punto de inicio */
  transform: translateX(-50%); /* centrar exactamente */
  margin: 0;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 1.60rem;
  font-weight: bolder;
  color: #222;
  white-space: nowrap;
}

/* ================== Solución Trayectoria ================== */
/* 1) Grilla responsive que nunca corta el texto */
#trayectoria .trayectoria-videos {
  display: grid;
  /* Mínimo 250px por tarjeta, y tantas como quepan */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  /* Cada fila escala su altura al contenido */
  grid-auto-rows: min-content;
  gap: 30px;
  margin-top: 30px;
}

/* 2) Asegura que cada tarjeta muestre TODO su título */
#trayectoria .trayectoria-videos .media-item {
  /* Altura auto y sin overflow oculto */
  height: auto !important;
  overflow: visible !important;
}

#trayectoria .trayectoria-videos .media-item .media-title {
  /* Permitir quiebres de palabra normales */
  white-space: normal;
  overflow-wrap: break-word;
  text-overflow: clip;
}

/* ——— Tablet: 769px a 1210px ——— */
@media (min-width: 769px) and (max-width: 1210px) {
  /* 1) Permite overflow para no cortar nada */
  #principal {
    overflow: visible;
  }

  /* 2) Layout: altura automática y gap reducido */
  .homepage-layout {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 60px !important;     /* algo menor que en desktop */
    height: auto !important;   /* que ajuste altura */
    padding: 40px 20px;        /* padding interior */
  }

  /* 3) Sidebar: ajusta padding para que quepa */
  .homepage-navigation {
    padding-left: 20px !important;
    flex: 0 0 auto;
    height: auto !important;
  }

  /* 4) Imagen: no supere el ancho disponible */
  .homepage-image {
    padding-right: 20px !important;
    flex: 0 0 auto;
  }
  .homepage-image img {
    max-width: 40vw !important;  /* ocupa hasta 40% del viewport */
    width: auto !important;
    height: auto !important;
  }
}

/* — Tablet ajustes para Contacto (≤1024px) — */
@media (max-width: 1024px) {
  #contacto .contact-layout {
    grid-template-columns: 1fr;  /* Una sola columna */
    gap: 40px;
    text-align: center;
  }

  /* Imagen adaptativa: ancho relativo y altura automática */
  .contact-image-wrapper {
    width: 80%;            /* Ocupa el 80% del contenedor */
    max-width: 400px;      /* No supere 400px de ancho */
    aspect-ratio: 1 / 1;   /* Mantiene proporción cuadrada */
    height: auto;          /* Altura según el ancho */
    margin: 0 auto;
  }

  /* La imagen interna llena totalmente el wrapper */
  .contact-main-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ————— Destacados: 1 video por fila en móvil (<766px) ————— */
@media (max-width: 766px) {
  #destacados .destacados-videos {
    display: grid !important;
    grid-template-columns: 1fr !important;    /* una sola columna */
    grid-auto-rows: min-content !important;   /* altura según contenido */
    gap: 30px !important;                     /* espacio entre videos */
    margin-top: 20px !important;
  }

  /* Cada ítem debe permitir altura automática */
  #destacados .destacados-videos .media-item {
    height: auto !important;
    overflow: visible !important;
  }

  /* El iframe/video ocupa todo el ancho */
  #destacados .destacados-videos .media-item iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;                     /* mantiene proporción */
  }
}

/* ————— Destacados: vídeos verticales grandes en móvil (<766px) ————— */
@media (max-width: 766px) {
  /* Una sola columna para que el vídeo ocupe todo el ancho disponible */
  #destacados .media-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 10px;    /* Reduce padding lateral */
  }

  /* Vídeo vertical: retrato, ancho casi completo y centrado */
  #destacados .media-grid .media-item video {
    aspect-ratio: 3 / 4 !important;      /* Mantén la proporción vertical portrait */
    width: 90vw !important;              /* Ocupa 90% del viewport */
    max-width: 400px !important;         /* Límite razonable en móviles */
    height: auto !important;             /* Ajusta la altura acorde al ancho */
    display: block;
    margin: 0 auto;                      /* Centrado horizontal */
    object-fit: cover !important;        /* Que cubra sin deformar */
  }
}

/* Fix contador de visitas en mobile: siempre visible y sin recortes */
@media (max-width: 768px) {
  #principal .visit-counter {
    position: fixed;                           /* sale del flujo de #principal */
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom)); /* respeta barra del navegador */
    transform: translateX(-50%);
    z-index: 1005;                             /* por encima de sidebar (1001) y menú (1002) */
    padding: 8px 14px;
    border-radius: 10px;
    line-height: 1.2;
    font-size: clamp(16px, 3.8vw, 22px);       /* adapta tamaño */
    max-width: calc(100vw - 32px);             /* evita desbordes en pantallas angostas */
    text-align: center;
    white-space: normal;                       /* permite salto si el número crece */

  }
}
