/* =========================
   BASE DE SECCIÓN
========================= */
.logo{
  margin-bottom:10px;
}

.nav-top{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:20px;
}

.menu-toggle{
  background:none;
  border:none;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:5px;
}

.menu-toggle span{
  width:16px;
  height:1px;
  background: var(--color-logo);
  display:block;
}

/* 👉 activar contenedor en biografía */
.sidenav .nav-links{
  opacity:1 !important;
  transform:translateY(0) !important;
  pointer-events:auto !important;
}

.nav-links{
  list-style:none;
  display:flex;
  flex-direction:column;
  gap:25px;
  margin-top:40px;
}

/* ocultar items */
.nav-links li{
  opacity:0;
  transform:translateY(-10px);
  pointer-events:none;
  transition:0.3s;
}

/* nav abierto */
.sidenav.active .nav-links li{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

/* excepción: biografía visible */
.nav-links li.always-visible{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

.sidenav.active .nav-links{
  opacity:1;
  transform:translateY(0);
  pointer-events:auto;
}

.main{
  margin-left:220px; /* respeta tu nav */
}

/* ===== VIEWER ===== */
.viewer{
  position:fixed;
  inset:0;
  background: var(--bg-dark);
  z-index:999;
  pointer-events:none;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:60px;

  opacity:0;
  visibility:hidden;
  transition:0.6s ease;
}

.viewer.active{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
}

/* video en el viewer */
.viewer-content video {
  max-width: 70vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}

/* imagen zoom-in */
.viewer-content img{
  max-width:70vw;
  max-height:80vh;
  object-fit:contain;
  display:block;
  transform:scale(0.92);
  opacity:0;
  transition:0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.viewer.active .viewer-content img{
  transform:scale(1);
  opacity:1;
}

/* cerrar */
.viewer-close{
  position:absolute;
  top:30px;
  right:30px;
  background:none;
  border:none;
  color: var(--text-primary);
  font-size:18px;
  cursor:pointer;
}

/* navegación */
.viewer-nav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:none;
  border:none;
  color: var(--text-primary);
  font-size:20px;
  cursor:pointer;
  z-index:1010;
  opacity:0.5;
  transition:opacity 0.3s ease;
}

.viewer-nav:hover{
  opacity:1;
}

.viewer-nav.prev{
  left:calc(220px + 30px);
}

.viewer-nav.next{
  right:30px;
}

.projects{
  padding:120px 80px;
  background: var(--bg-dark);
  min-height:100vh;
}

/* =========================
   INTRO (tipo museo)
========================= */

.projects-intro{
  margin-bottom:80px;
}

.projects-intro h1{
  font-size:14px;
  letter-spacing:4px;
  color: var(--text-primary);
  opacity:0.7;
  font-weight:400;
  margin-bottom:10px;
}

.projects-intro p{
  font-size:13px;
  color: var(--text-muted-2);
  letter-spacing:1px;
  max-width:400px;
  line-height:1.6;
}

/* =========================
   GRID GALERÍA
========================= */

.projects-grid{
  display:grid;
  grid-template-columns:repeat(3, 1fr);
  gap:60px;
  transition:0.6s ease;
}

body.viewer-open .projects-grid{
  opacity:0.15;
  transform:scale(0.98);
}

/* =========================
   PROYECTO
========================= */

.project{
  position:relative;
  overflow:hidden;
  aspect-ratio: 4 / 5;
  opacity:0;
  transform:translateY(32px);
  isolation: isolate;
}

.project.will-animate{
  will-change: transform, opacity;
  transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
              transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.project.visible{
  opacity:1;
  transform:translateY(0);
  will-change: auto;
}

/* IMAGEN */
.project img{
  width:100%;
  height:100%;
  object-fit:cover;
  cursor:pointer;
  display:block;
  filter:grayscale(15%) contrast(1.05);
  transition: transform 1s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

/* HOVER — solo transform y opacity en GPU */
.project:hover img{
  transform:scale(1.05);
  opacity:0.85;
}

.viewer-text{
  max-width:300px;
  color: var(--text-muted-4);

  opacity:0;
  transform:translateY(10px);
  transition:0.4s ease;
}

.viewer-text h2{
  font-size:12px;
  letter-spacing:3px;
  margin-bottom:10px;
  color: var(--text-primary);
}

.viewer-text p{
  font-size:12px;
  line-height:1.6;
  color: var(--text-muted-2);
}

.viewer.active .viewer-text{
  opacity:1;
  transform:translateY(0);
}

.project-info{
  position:absolute;
  bottom:20px;
  left:20px;

  color: var(--text-primary);
  font-size:11px;
  letter-spacing:2px;

  opacity:0;
  transform:translateY(10px);
  transition:0.5s ease;

  pointer-events:none;
}

.project:hover .project-info{
  opacity:1;
  transform:translateY(0);
}

.project::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(to top, var(--overlay-gradient), transparent);
  opacity:0;
  transition:0.5s ease;
}

.project:hover::before{
  opacity:1;
}

/* =========================
   MINI CONTROLS (DATA IMAGES)
========================= */

.viewer-controls-mini{
  position:absolute;
  bottom:40px;
  display:flex;
  gap:20px;
  z-index:10;
  opacity:0;
  pointer-events:none;
}

.viewer.active:hover .viewer-controls-mini{
  opacity:1;
  pointer-events:auto;
}

/* botones base */
.viewer-controls-mini button{
  background: var(--overlay-viewer-btn-bg);
  border:1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
  width:42px;
  height:42px;
  border-radius:50%;
  box-shadow:0 10px 30px rgba(0,0,0,0.4);
  font-size:18px;
  cursor:pointer;

  display:flex;
  align-items:center;
  justify-content:center;

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  transition:0.35s ease;
  opacity:0.6;
}

/* hover elegante */
.viewer-controls-mini button:hover{
  opacity:1;
  transform:scale(1.1);
  background: var(--overlay-viewer-btn-hover);
  border-color:rgba(255,255,255,0.3);
}

/* click feedback */
.viewer-controls-mini button:active{
  transform:scale(0.95);
}

/* =========================
   ZOOM DE IMAGEN
========================= */

.viewer-content img{
  cursor: zoom-in;
}

/* imagen ampliada */
.viewer-content img.zoomed{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1) !important;
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  z-index: 1100;
  cursor: zoom-out;
  opacity: 1 !important;
  transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* overlay oscuro detrás */
#zoom-overlay{
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-zoom-bg);
  z-index: 1095;
  cursor: zoom-out;
}

#zoom-overlay.active{
  display: block;
}

/* =========================
   VIDEO CONTROLS (CUSTOM)
========================= */

.viewer-content{
  position: relative;
}

/* contenedor flotante */
.video-controls{
  position:absolute;
  bottom:30px;
  left:50%;
  transform:translateX(-50%);

  display:flex;
  align-items:center;
  justify-content: center;
  gap:16px;

  padding:10px 18px;

  border-radius:999px;

  background:rgba(255,255,255,0.03);
  border:1px solid rgba(255,255,255,0.08);

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  opacity:0;
  transition:0.4s ease;

  box-shadow:0 0 40px rgba(255,255,255,0.03);
}

/* aparecen solo al interactuar */
.viewer-content:hover .video-controls{
  opacity:1;
}

.video-play{
  background:none;
  border:none;
  cursor:pointer;
  opacity:0.7;
  transition:0.3s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  width:20px;
  height:20px;
}

.video-play:hover{
  opacity:1;
  transform:scale(1.15);
}

.video-progress{
  width:100px;
  height:1px;
  background:rgba(255,255,255,0.2);
  position:relative;
  overflow:hidden;
}

.video-bar{
  width:0%;
  height:100%;
  background:white;

  box-shadow:0 0 10px rgba(255,255,255,0.5);
  transition:width 0.15s linear;
}

.viewer-content video{
  max-width:70vw;
  max-height:80vh;
  object-fit:contain;
  display:block;
  filter:contrast(1.05) brightness(0.95);
}

/* =========================
   BOTONES SVG (mute, fullscreen)
========================= */

.video-mute-btn,
.video-fullscreen{
  background:none;
  border:none;
  cursor:pointer;
  opacity:0.65;
  transition:0.3s ease;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  flex-shrink:0;
}

.video-mute-btn:hover,
.video-fullscreen:hover{
  opacity:1;
  transform:scale(1.15);
}

/* =========================
   VOLUMEN RETRACTIL
========================= */

.volume-wrap{
  position:relative;
  display:flex;
  align-items:center;
}

/* caja flotante que sube por encima del botón */
.volume-slider-box{
  position:absolute;
  bottom:calc(100% + 10px);
  left:50%;
  transform:translateX(-50%);

  display:flex;
  align-items:center;
  justify-content:center;

  width:28px;
  height:0;
  opacity:0;
  overflow:hidden;
  padding:0;

  background:rgba(15,15,15,0.75);
  border:1px solid rgba(255,255,255,0.1);
  border-radius:14px;
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);

  transition: height 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
  pointer-events:none;
}

.volume-slider-box.open{
  height:80px;
  opacity:1;
  padding:8px 0;
  pointer-events:auto;
}

/* slider vertical */
.video-volume-range{
  -webkit-appearance:none;
  appearance:none;
  writing-mode:vertical-lr;
  direction:rtl;
  width:2px;
  height:60px;
  background:rgba(255,255,255,0.2);
  border-radius:2px;
  outline:none;
  cursor:pointer;
}

.video-volume-range::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:11px;
  height:11px;
  border-radius:50%;
  background:white;
  cursor:pointer;
  box-shadow:0 0 5px rgba(0,0,0,0.5);
  transition:transform 0.15s ease;
}

.video-volume-range::-webkit-slider-thumb:hover{
  transform:scale(1.25);
}

.video-volume-range::-moz-range-thumb{
  width:11px;
  height:11px;
  border-radius:50%;
  background:white;
  cursor:pointer;
  border:none;
}

/* =============================================
   RESPONSIVE — TOP BAR EN MÓVIL (<= 768px)
   Desktop no cambia absolutamente nada.
============================================= */
@media (max-width: 768px){

  /* Sidenav → top bar horizontal fija */
  .sidenav{
    width: 100%;
    height: 56px;
    min-height: 56px;
    flex-direction: row;
    align-items: center;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    overflow: hidden;
    gap: 0;
    justify-content: flex-start;
  }

  /* Ocultar hamburguesa */
  .menu-toggle{
    display: none;
  }

  /* nav-top (logo): mismo flex que cada link, siempre primero a la izquierda */
  .nav-top{
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: 1;
  }

  /* Logo: mismo tamaño visual que los links, alineado a la izquierda */
  .logo{
    margin-bottom: 0;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-align: center;
    white-space: nowrap;
  }

  /* nav-links: display:contents sube los li al nivel del sidenav para que order funcione */
  .nav-links{
    display: contents;
  }

  /* Cada li: flex item directo del sidenav */
  .nav-links li{
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
  }

  .nav-links a{
    font-size: 9px;
    letter-spacing: 1.5px;
    text-align: center;
    white-space: nowrap;
  }

  /* Orden fijo en móvil: INSANE · BIOGRAPHY · PROJECTS · EXHIBITIONS · CONTACT
     El HTML de exposiciones.html tiene: EXHIBITIONS(1º) CONTACT(2º) BIOGRAPHY(3º) PROJECTS(4º)
     El logo (.nav-top) ocupa order:1, los links van del 2 al 5 */
  .nav-top{ order: 1 !important; }
  .nav-links li:nth-child(1){ order: 4 !important; } /* EXHIBITIONS*/
  .nav-links li:nth-child(2){ order: 5 !important; } /* CONTACT    */
  .nav-links li:nth-child(3){ order: 2 !important; } /* BIOGRAPHY  */
  .nav-links li:nth-child(4){ order: 3 !important; } /* PROJECTS   */

  .main{
    margin-left: 0;
    padding-top: 56px;
  }

  .projects{
    padding: 80px 20px 60px;
  }

  .projects-grid{
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* Viewer: layout columna, centrado */
  .viewer{
    flex-direction: column;
    gap: 24px;
    padding: 80px 0 40px;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
  }

  /* Botón cerrar: siempre visible arriba a la derecha */
  .viewer-close{
    position: fixed;
    top: 66px;
    right: 16px;
    z-index: 1020;
    font-size: 20px;
    opacity: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
  }

  /* Flechas prev/next PROYECTO: ocultas en móvil */
  .viewer-nav{
    display: none !important;
  }

  /* Contenedor imagen: relativo para las flechas de imagen */
  .viewer-content{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }

  .viewer-content img,
  .viewer-content video{
    max-width: 94vw;
    max-height: 52vh;
    display: block;
  }

  /* Flechas de imagen estilo Instagram */
  .viewer-controls-mini{
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    width: 100%;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    gap: 0;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 1050;
  }

  .viewer-controls-mini button{
    background: rgba(0,0,0,0.35);
    border: none;
    color: rgba(255,255,255,0.85);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: background 0.2s ease, opacity 0.2s ease;
    opacity: 0.75;
    box-shadow: none;
  }

  .viewer-controls-mini button:active{
    background: rgba(0,0,0,0.55);
    opacity: 1;
  }

  .viewer-text{
    max-width: 90vw;
    width: 90vw;
    text-align: left;
    padding: 0 4px;
  }
}

/* =========================
   PAGE LOADER
========================= */

#page-loader{
  position: fixed;
  inset: 0;
  background: var(--bg-dark);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 48px;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

#page-loader.done{
  opacity: 0;
}

.loader-bar-wrap{
  width: 120px;
  height: 1px;
  background: rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}

.loader-bar{
  height: 100%;
  width: 0%;
  background: var(--text-primary);
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 0 8px rgba(255,255,255,0.3);
}
