/* === RESET Y BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #111;
    color: #eaeaea;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* === ENCABEZADO === */
.portfolio-header {
    text-align: center;
    padding: 4rem 1rem 2rem;
}

.portfolio-header h1 {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.portfolio-header p {
    font-size: 1rem;
    color: #aaa;
    letter-spacing: 1px;
}

/* === GALERÍA === */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    width: 90%;
    max-width: 1200px;
    margin: 2rem auto 4rem;
}

.portfolio-item {
    position: relative;
    aspect-ratio: 1 / 1; /* mantiene las imágenes cuadradas */
    overflow: hidden;
    border-radius: 12px;
    background: #1a1a1a;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: grayscale(100%) brightness(0.9);
}

.portfolio-item:hover img {
    transform: scale(1.05);
    filter: grayscale(0%) brightness(1.1);
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1rem;
}

.portfolio-item:hover .overlay {
    opacity: 1;
}

/* === FOOTER === */
.portfolio-footer {
    padding: 2rem;
    text-align: center;
    margin-top: auto;
}

.portfolio-footer a {
    color: #aaa;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.portfolio-footer a:hover {
    color: #fff;
}

/* === MODAL === */
/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

/* El tamaño base del modal-content (para mensajes privados) */
.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  width: auto; /* Ajuste para el contenido privado */
  background: linear-gradient(180deg, #1b1b1b 0%, #101010 100%);;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(80, 80, 80, 0.6);
  /* Estilo base para el contenido privado */
  min-width: 300px;
  padding: 1.5rem; /* El contenido privado tiene padding directo aquí */
  display: flex; /* Para centrar el contenido privado */
  justify-content: center;
  align-items: center;
  animation: zoomIn 0.4s ease;
}

/* === ESTILO DE 2 COLUMNAS (VIDEO + DESCRIPCIÓN) === */
.modal-content.project-modal-content {
    /* Nuevo tamaño que permite ambas columnas (ej: 80vw x 60vh) */
    width: 80vw; 
    height: 60vh;
    padding: 0; /* Quitamos el padding base para que el grid ocupe todo */
    display: grid;
    grid-template-columns: 2fr 1fr; /* 2/3 para video, 1/3 para descripción */
    gap: 0; 
}

/* Escondemos los wrappers de media y descripción si no se usa el modo proyecto */
.modal-media-wrapper,
.modal-description-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
  color: #eaeaea;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.6;
  font-family: 'Inter', sans-serif;
  backdrop-filter: blur(2px);
}

/* Mostramos los wrappers de media y descripción en modo proyecto */
.modal-content.project-modal-content .modal-media-wrapper,
.modal-content.project-modal-content .modal-description-wrapper {
    display: flex;
}

/* Contenedor de la media (columna 1) */
.modal-media-wrapper {
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
}

/* Contenido (video o imagen) ocupa todo el wrapper */
.modal-media-wrapper div,
.modal-media-wrapper iframe,
.modal-media-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
}
/* Forzar el iframe a tomar el tamaño de su contenedor 16:9 */
.modal-media-wrapper > div {
    position: relative;
    width: 100%;
    height: 100%;
    padding-bottom: 56.25%; /* No necesitamos esto si el wrapper tiene altura fija */
}
.modal-media-wrapper iframe {
    position: absolute;
    inset: 0;
}

/* DESCRIPCIÓN DEL PROYECTO (columna 2) */
/* ==== MODAL DESCRIPTION (lado del texto) ==== */
.modal-description-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
  color: #e0e0e0;
  border-left: 3px solid rgba(255, 255, 255, 0.05);
  line-height: 1.6;
  font-family: 'Inter', sans-serif;
}

/* Título */
.modal-description-wrapper h3 {
  font-size: 1.6rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 1rem;
  letter-spacing: 1.5px;
  position: relative;
}

/* Pequeña línea decorativa bajo el título */
.modal-description-wrapper h3::after {
  content: "";
  display: block;
  width: 50px;
  height: 2px;
  background: #fff;
  margin-top: 0.6rem;
  border-radius: 2px;
  opacity: 0.3;
}

/* Texto del párrafo */
.modal-description-wrapper p {
  color: #bbb;
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
  max-width: 90%;
}

/* Si hay varios párrafos */
.modal-description-wrapper p + p {
  margin-top: 0.5rem;
}

/* Sutil transición al abrir */
.modal-description-wrapper {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .modal-description-wrapper {
    border-left: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 1.5rem;
    text-align: center;
    align-items: center;
  }
  .modal-description-wrapper h3::after {
    margin: 0.5rem auto 0;
  }
  .modal-description-wrapper p {
    max-width: 100%;
  }
}

/* Botón de cierre - Ajustar posición */
.close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.8rem;
  color: #ccc;
  cursor: pointer;
  transition: color 0.3s ease;
  z-index: 10;
}
.close-btn:hover {
  color: #fff;
}

/* BOTONES */
.portfolio-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}
.btn {
    background: #eaeaea;
    color: #111;
    text-decoration: none;
    padding: 0.7rem 1.4rem;
    border-radius: 30px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}
.btn:hover {
    background: #fff;
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    border: 1px solid #eaeaea;
    color: #eaeaea;
}
.btn-outline:hover {
    background: #eaeaea;
    color: #111;
}



/* Estilo específico para mensaje de contenido privado */

.modal-message {
  padding: 2rem;
  color: #eaeaea;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.modal-message p {
  color: #cfcfcf;
  line-height: 1.6;
  max-width: 800px;
}

.modal-message .msg-cta {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.modal-message .btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.168);
  color: #eaeaea;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
.modal-message .btn-ghost:hover {
  transform: translateY(-3px);
  background: rgba(255,255,255,0.03);
}

/* Botón principal (contacto) */
.modal-message .btn-primary {
  background: #eaeaea;
  color: #111;
  padding: 0.6rem 1.2rem;
  border-radius: 22px;
  text-decoration: none;
}

.modal-content {
  position: relative;
  width: 64vw; /* Contenedor principal del modal */
  height: 36vw;
  /* ... (otras reglas) ... */
}

.modal-body {
    /* Asegura que el cuerpo del modal ocupe todo el espacio del modal-content */
    width: 100%;
    height: 100%;
    /* Flexbox o Grid si es necesario para centrado, aunque con el wrapper no es estricto */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Esto asegura que el contenedor responsive que inserta JS ocupe todo el modal-body */
.modal-body > div {
    width: 100%;
    height: 100%;
}


/* MODIFICAR las reglas que intentaste usar antes, haciéndolas más específicas: */
.modal-body iframe,
.modal-body img {
  /* Estas dimensiones fijas eran el problema, cámbialas */
  /* width: 64vw; */
  /* height:36vw; */

  /* Deben ocupar el 100% de su contenedor (el wrapper o el modal-body) */
  width: 100%; 
  height: 100%;
  object-fit: contain; 
  border: none;
}


