/* ═══════════════════════════════════════════════════════════ */
/* INTERFLOT — UltraNoir Modal & Gallery System               */
/* ═══════════════════════════════════════════════════════════ */

/* ===== PROYECTO SAN PEDRO — GALERÍA INMERSIVA ===== */
.proyecto-section {
  position: relative;
  padding: 140px 40px;
  max-width: 1400px;
  margin: 0 auto;
  overflow: visible;
}

.proyecto-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: end;
  margin-bottom: 80px;
}
.proyecto-header-left {
  display: flex;
  flex-direction: column;
}

.proyecto-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(227,6,19,0.08);
  border: 1px solid rgba(227,6,19,0.2);
  border-radius: 100px;
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 600;
  margin-bottom: 24px;
  width: fit-content;
}
.proyecto-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--red);
  border-radius: 50%;
  animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.proyecto-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 4.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(135deg, #fff 0%, var(--silver) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.proyecto-desc {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--gray);
  max-width: 540px;
}

.proyecto-stats {
  display: flex;
  gap: 50px;
  padding-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.proyecto-stat {
  text-align: center;
}
.proyecto-stat-num {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
}
.proyecto-stat-label {
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 6px;
}

/* ===== ULTRANOIR-INSPIRED GALLERY WALL ===== */
.gallery-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 280px;
  gap: 6px;
  margin-bottom: 60px;
}

/* Layout variaciones para que se sienta orgánico */
.gallery-wall-item:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.gallery-wall-item:nth-child(5) { grid-column: span 2; }
.gallery-wall-item:nth-child(8) { grid-column: span 2; }
.gallery-wall-item:nth-child(11) { grid-column: span 2; grid-row: span 2; }

.gallery-wall-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
}

.gallery-wall-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* UltraNoir filter: desaturado + alto contraste + oscuro */
  filter: grayscale(50%) contrast(1.2) brightness(0.65);
  transition: filter 0.6s ease, transform 0.8s var(--transition);
}

.gallery-wall-item:hover img {
  filter: grayscale(10%) contrast(1.1) brightness(0.8);
  transform: scale(1.05);
}

/* Overlay gradiente */
.gallery-wall-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,13,16,0.6), transparent 60%);
  pointer-events: none;
}

/* Ícono de expandir */
.gallery-wall-item .gallery-expand {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s, transform 0.3s var(--transition);
  z-index: 2;
  color: #fff;
  font-size: 0.8rem;
}
.gallery-wall-item:hover .gallery-expand {
  opacity: 1;
  transform: translateY(0);
}

/* Caption en hover */
.gallery-wall-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 18px 16px;
  z-index: 2;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s, transform 0.4s var(--transition);
}
.gallery-wall-item:hover .gallery-wall-caption {
  opacity: 1;
  transform: translateY(0);
}
.gallery-wall-caption span {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.9);
}

/* ===== LIGHTBOX MODAL GLOBAL ===== */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(30px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s ease 0.1s, transform 0.5s var(--transition) 0.1s;
}
.lightbox-overlay.active .lightbox-content img {
  opacity: 1;
  transform: scale(1);
}

/* Counter */
.lightbox-counter {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  z-index: 2;
}

/* Close button */
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
  z-index: 3;
}
.lightbox-close:hover {
  background: rgba(227, 6, 19, 0.2);
  border-color: var(--red);
  transform: rotate(90deg);
}
.lightbox-close::before,
.lightbox-close::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: #fff;
}
.lightbox-close::before { transform: rotate(45deg); }
.lightbox-close::after { transform: rotate(-45deg); }

/* Nav arrows */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s;
  z-index: 3;
  color: #fff;
  font-size: 1.2rem;
}
.lightbox-prev { left: 30px; }
.lightbox-next { right: 30px; }
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(227, 6, 19, 0.15);
  border-color: rgba(227, 6, 19, 0.4);
}

/* ===== VIDEO THEATER MODAL ===== */
.video-theater {
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(0, 0, 0, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s;
}
.video-theater.active {
  opacity: 1;
  visibility: visible;
}

.video-theater-close {
  position: absolute;
  top: 24px;
  right: 30px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
  z-index: 3;
}
.video-theater-close:hover {
  background: rgba(227, 6, 19, 0.2);
  border-color: var(--red);
  transform: rotate(90deg);
}
.video-theater-close::before,
.video-theater-close::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: #fff;
}
.video-theater-close::before { transform: rotate(45deg); }
.video-theater-close::after { transform: rotate(-45deg); }

.video-theater-wrapper {
  width: 88vw;
  max-width: 1400px;
  aspect-ratio: 16/9;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 60px 200px rgba(0, 0, 0, 0.8);
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.6s var(--transition) 0.15s, opacity 0.5s ease 0.15s;
}
.video-theater.active .video-theater-wrapper {
  transform: scale(1);
  opacity: 1;
}

.video-theater-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-theater-title {
  margin-top: 20px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease 0.4s, transform 0.4s var(--transition) 0.4s;
}
.video-theater.active .video-theater-title {
  opacity: 1;
  transform: translateY(0);
}

/* ===== VIDEO SHOWCASE CARDS ===== */
.video-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 40px;
}

.video-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16/9;
  background: var(--black-card);
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.5s var(--transition),
              border-color 0.4s;
}
.video-card:hover {
  transform: translateY(-6px);
  border-color: rgba(227,6,19,0.3);
}

.video-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(40%) contrast(1.1) brightness(0.7);
  transition: filter 0.6s, transform 0.8s var(--transition);
}
.video-card:hover .video-card-thumb {
  filter: grayscale(0%) contrast(1.05) brightness(0.85);
  transform: scale(1.06);
}

/* Gradient overlay */
.video-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,13,16,0.85) 0%, transparent 60%);
  pointer-events: none;
}

/* Play Button */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 72px;
  height: 72px;
  background: rgba(227, 6, 19, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.4s var(--transition),
              background 0.3s,
              box-shadow 0.3s;
  box-shadow: 0 8px 40px rgba(227, 6, 19, 0.3);
}
.video-card:hover .video-play-btn {
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 12px 60px rgba(227, 6, 19, 0.5);
}

.video-play-btn::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 22px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

/* Ripple animation on play */
.video-play-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(227, 6, 19, 0.4);
  border-radius: 50%;
  animation: playRipple 2s ease-out infinite;
}
@keyframes playRipple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Video card info */
.video-card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  z-index: 2;
}
.video-card-info h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 6px 0;
}
.video-card-info p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

/* ===== CORPORATIVO SECTION ===== */
.corporativo-section {
  position: relative;
  padding: 120px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.corp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 60px;
}

.corp-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  aspect-ratio: 4/3;
}
.corp-img-wrap:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.corp-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* UltraNoir: desaturado + alto contraste + dark */
  filter: grayscale(50%) contrast(1.2) brightness(0.65);
  transition: filter 0.6s ease, transform 0.8s var(--transition);
}
.corp-img-wrap:hover img {
  filter: grayscale(10%) contrast(1.1) brightness(0.8);
  transform: scale(1.05);
}
.corp-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(11,13,16,0.6), transparent 60%);
  pointer-events: none;
}

.corp-label {
  position: absolute;
  bottom: 14px;
  left: 16px;
  z-index: 2;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s var(--transition);
}
.corp-img-wrap:hover .corp-label {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .proyecto-header { grid-template-columns: 1fr; gap: 40px; }
  .gallery-wall {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 220px;
  }
  .gallery-wall-item:nth-child(1) { grid-column: span 2; grid-row: span 1; }
  .gallery-wall-item:nth-child(5) { grid-column: span 1; }
  .gallery-wall-item:nth-child(8) { grid-column: span 1; }
  .gallery-wall-item:nth-child(11) { grid-column: span 1; grid-row: span 1; }
  .corp-grid { grid-template-columns: repeat(2, 1fr); }
  .video-cards { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .proyecto-section { padding: 80px 20px; }
  .proyecto-stats { gap: 30px; flex-wrap: wrap; }
  .gallery-wall {
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: 200px;
  }
  .gallery-wall-item:nth-child(1) { grid-column: span 2; grid-row: span 1; }
  .gallery-wall-item:nth-child(5),
  .gallery-wall-item:nth-child(8),
  .gallery-wall-item:nth-child(11) { grid-column: span 1; grid-row: span 1; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
  .lightbox-prev, .lightbox-next { width: 44px; height: 44px; }
  .video-cards { grid-template-columns: 1fr; }
  .video-theater-wrapper { width: 95vw; }
  .corp-grid { grid-template-columns: 1fr; }
  .corp-img-wrap:first-child { grid-column: span 1; grid-row: span 1; }
  .corporativo-section { padding: 80px 20px; }
}

@media (max-width: 480px) {
  .gallery-wall {
    grid-template-columns: 1fr;
    grid-auto-rows: 260px;
  }
  .gallery-wall-item:nth-child(1) { grid-column: span 1; }
}

/* ═══════════════════════════════════════════════════════════ */
/* C5 TERMINAL (Catálogo Marketing)                            */
/* ═══════════════════════════════════════════════════════════ */

/* Botón de Acceso */
.btn-c5 {
  position: relative;
  background: var(--bg-darker);
  border: 1px solid rgba(227,6,19,0.3);
  color: #fff;
  padding: 18px 40px;
  font-family: var(--font-heading);
  letter-spacing: 3px;
  font-size: 0.85rem;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(227,6,19,0.1);
  transition: all 0.3s;
}
.btn-c5:hover {
  border-color: rgba(227,6,19,0.8);
  box-shadow: 0 0 40px rgba(227,6,19,0.2), 0 0 10px rgba(0, 150, 255, 0.2);
}
.c5-btn-scan {
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(227,6,19,0.2), rgba(0, 150, 255, 0.2), transparent);
  animation: c5Scan 4s linear infinite;
}
@keyframes c5Scan {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Modal Overlay */
.c5-terminal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999; /* Just below lightbox 10000 */
  background: rgba(5, 6, 8, 0.98);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}
.c5-terminal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Fondo scanlines estilo monitor */
.c5-terminal-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.2) 2px,
    rgba(0, 0, 0, 0.2) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Viñeta oscura en las orillas */
.c5-terminal-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 150px rgba(0,0,0,0.9);
  pointer-events: none;
  z-index: 2;
}

.c5-terminal-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 40px;
}

/* Header de la Terminal */
.c5-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 20px;
  margin-bottom: 30px;
  font-family: var(--font-heading);
  letter-spacing: 4px;
}
.c5-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
}
.c5-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
}
.blink-red {
  animation: blinkRed 1.5s infinite;
}
@keyframes blinkRed {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px var(--red); }
  50% { opacity: 0.3; box-shadow: none; }
}

.c5-close-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 16px;
  cursor: pointer;
  font-family: var(--font-heading);
  letter-spacing: 2px;
  font-size: 0.7rem;
  transition: all 0.3s;
}
.c5-close-btn:hover {
  background: var(--red);
  border-color: var(--red);
}

/* Grid de Imágenes (Mosaico Flex) */
.c5-grid {
  display: flex;
  flex: 1;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 15px;
  padding-bottom: 40px;
}
.c5-grid::-webkit-scrollbar { width: 6px; }
.c5-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
.c5-grid::-webkit-scrollbar-thumb { background: rgba(227,6,19,0.5); }

/* Item de la Galería */
.c5-item {
  position: relative;
  width: 320px; /* Tamaño fijo, no se deformarán ni se harán gigantes */
  flex-grow: 0;
  min-height: 200px;
  background: #000;
  border: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  overflow: hidden;
}

.c5-item img {
  width: 100%;
  height: auto;
  display: block;
  /* Filtro de visión nocturna / cámara de seguridad */
  filter: sepia(100%) hue-rotate(180deg) saturate(150%) brightness(0.3) contrast(1.2);
  transition: filter 0.5s ease, transform 0.8s ease;
}

/* Escáner Láser */
.c5-laser {
  position: absolute;
  top: -10px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--red);
  box-shadow: 0 0 15px 5px rgba(227,6,19,0.6);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

/* Hover Effects */
.c5-item:hover img {
  /* Revelar color original */
  filter: grayscale(0%) contrast(1.1) brightness(0.9);
  transform: scale(1.05);
}

.c5-item:hover .c5-laser {
  opacity: 1;
  animation: laserScanDown 0.8s ease-out forwards;
}
@keyframes laserScanDown {
  0% { top: -10px; opacity: 1; }
  100% { top: 110%; opacity: 0; }
}

/* Corchetes Tácticos [ ] */
.c5-brackets::before, .c5-brackets::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid transparent;
  transition: border-color 0.3s;
  pointer-events: none;
  z-index: 2;
}
.c5-brackets::before {
  top: 15px; left: 15px;
  border-top-color: rgba(255,255,255,0.1);
  border-left-color: rgba(255,255,255,0.1);
}
.c5-brackets::after {
  bottom: 15px; right: 15px;
  border-bottom-color: rgba(255,255,255,0.1);
  border-right-color: rgba(255,255,255,0.1);
}
.c5-item:hover .c5-brackets::before { border-color: var(--red); }
.c5-item:hover .c5-brackets::after { border-color: rgba(0, 150, 255, 0.8); }

/* Etiqueta / ID de la Foto */
.c5-item-label {
  position: absolute;
  bottom: 15px; left: 15px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #fff;
  background: rgba(0,0,0,0.8);
  padding: 4px 8px;
  opacity: 0.4;
  z-index: 3;
  transition: all 0.3s;
}
.c5-item:hover .c5-item-label {
  opacity: 1;
  color: var(--red);
}

/* Responsividad para la C5 Terminal */
@media (max-width: 768px) {
  .c5-terminal-content {
    padding: 20px;
  }
  .c5-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .c5-grid {
    gap: 15px;
    padding-right: 5px;
  }
}
