/* ============================================
   GALLERY CATEGORIES - TEXTBOX STYLES
   (urban volumes, urban surfaces, inhabitants, product, miscellaneous)
   ============================================ */

/* Container principale delle text-box categorie */
#urban\ volumes-textbox,
#urban\ surfaces-textbox,
#inhabitants-textbox,
#product-textbox,
#miscellaneous-textbox {
  background: transparent;
  z-index: 1002;
}

/* Desktop styles */
@media (min-width: 769px) {
  #urban\ volumes-textbox,
  #urban\ surfaces-textbox,
  #inhabitants-textbox,
  #product-textbox,
  #miscellaneous-textbox {
    position: fixed;
    top: 0;
    left: auto;        
    right: 0;          
    width: 70vw;       
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
  }

  #urban\ volumes-textbox.active,
  #urban\ surfaces-textbox.active,
  #inhabitants-textbox.active,
  #product-textbox.active,
  #miscellaneous-textbox.active {
    transform: translateX(0);
  }

  #urban\ volumes-textbox .text-box-content,
  #urban\ surfaces-textbox .text-box-content,
  #inhabitants-textbox .text-box-content,
  #product-textbox .text-box-content,
  #miscellaneous-textbox .text-box-content {
    display: block; 
    position: relative; 
    height: 100%;
    width: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
  }

  #urban\ volumes-textbox .single-photo-container,
  #urban\ surfaces-textbox .single-photo-container,
  #inhabitants-textbox .single-photo-container,
  #product-textbox .single-photo-container,
  #miscellaneous-textbox .single-photo-container {
    display: inline-flex; 
    justify-content: center;
    align-items: center;
    position: absolute;  
    bottom: 18%;         
    right: -1vw;          
    width: max-content;   
    height: 65vh;        
    margin: 0;      
  }

  #urban\ volumes-textbox .single-photo-box,
  #urban\ surfaces-textbox .single-photo-box,
  #inhabitants-textbox .single-photo-box,
  #product-textbox .single-photo-box,
  #miscellaneous-textbox .single-photo-box {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #urban\ volumes-textbox .single-photo,
  #urban\ surfaces-textbox .single-photo,
  #inhabitants-textbox .single-photo,
  #product-textbox .single-photo,
  #miscellaneous-textbox .single-photo {
    height: 100%;        
    max-height: 100%;    
    width: auto;         
    max-width: 65vw;     
    object-fit: contain;
    display: block; 
    z-index: 1;    
  }

  #urban\ volumes-textbox .nav-arrow,
  #urban\ surfaces-textbox .nav-arrow,
  #inhabitants-textbox .nav-arrow,
  #product-textbox .nav-arrow,
  #miscellaneous-textbox .nav-arrow {
    position: absolute; 
    top: 0;             
    bottom: 0;          
    width: 50%;         
    height: 100%;       
    background: transparent;
    border: none;
    color: transparent;
    cursor: pointer;
    z-index: 10;        
    transition: background 0.2s ease;
    padding: 0;         
    margin: 0;          
  }

  #urban\ volumes-textbox .nav-arrow:hover,
  #urban\ surfaces-textbox .nav-arrow:hover,
  #inhabitants-textbox .nav-arrow:hover,
  #product-textbox .nav-arrow:hover,
  #miscellaneous-textbox .nav-arrow:hover {
    background: rgba(255, 255, 255, 0.04); 
  }

  #urban\ volumes-textbox .nav-arrow.prev,
  #urban\ surfaces-textbox .nav-arrow.prev,
  #inhabitants-textbox .nav-arrow.prev,
  #product-textbox .nav-arrow.prev,
  #miscellaneous-textbox .nav-arrow.prev {
    left: 0;            
    right: auto;
  }

  #urban\ volumes-textbox .nav-arrow.next,
  #urban\ surfaces-textbox .nav-arrow.next,
  #inhabitants-textbox .nav-arrow.next,
  #product-textbox .nav-arrow.next,
  #miscellaneous-textbox .nav-arrow.next {
    right: 0;           
    left: auto;
  }

  #urban\ volumes-textbox .text-box-back,
  #urban\ surfaces-textbox .text-box-back,
  #inhabitants-textbox .text-box-back,
  #product-textbox .text-box-back,
  #miscellaneous-textbox .text-box-back {
    display: none !important;
  }

  #urban\ volumes-textbox .text-box-back:hover,
  #urban\ surfaces-textbox .text-box-back:hover,
  #inhabitants-textbox .text-box-back:hover,
  #product-textbox .text-box-back:hover,
  #miscellaneous-textbox .text-box-back:hover {
    color: var(--accent-lime);
    opacity: 1;
  }

  #urban\ volumes-textbox .text-box-back::before,
  #urban\ surfaces-textbox .text-box-back::before,
  #inhabitants-textbox .text-box-back::before,
  #product-textbox .text-box-back::before,
  #miscellaneous-textbox .text-box-back::before {
    content: '«';
    font-size: 2.2vh;
    margin-right: 0.3vw;
  }
}

/* =======================================
   MOBILE STYLES
   ======================================= */
@media (max-width: 768px) {
  
  #urban\ volumes-textbox,
  #urban\ surfaces-textbox,
  #inhabitants-textbox,
  #product-textbox,
  #miscellaneous-textbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: var(--bg-dark);
    z-index: 1000;
    overflow-y: auto;
    transform: none !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    border-radius: 0 !important;
  }

  #urban\ volumes-textbox.active,
  #urban\ surfaces-textbox.active,
  #inhabitants-textbox.active,
  #product-textbox.active,
  #miscellaneous-textbox.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 50;
  }

  #urban\ volumes-textbox .text-box-back,
  #urban\ surfaces-textbox .text-box-back,
  #inhabitants-textbox .text-box-back,
  #product-textbox .text-box-back,
  #miscellaneous-textbox .text-box-back {
    display: flex !important;
    position: fixed !important;
    top: calc(env(safe-area-inset-top) + 2vh) !important;
    left: 5vw !important;
    z-index: 3000 !important;      
    pointer-events: auto !important; 
    padding: 10px 30px 10px 0 !important;
    font-size: 2.2vh !important;
    color: var(--text-main) !important;
    text-decoration: none !important;
  }

  body:has(.text-box.active) .gallery-back-button {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  #urban\ volumes-textbox .single-photo-container,
  #urban\ surfaces-textbox .single-photo-container,
  #inhabitants-textbox .single-photo-container,
  #product-textbox .single-photo-container,
  #miscellaneous-textbox .single-photo-container {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: max-content !important;
    max-height: none !important;
    bottom: auto !important;
    right: auto !important;
  }

  #urban\ volumes-textbox .single-photo-box,
  #urban\ surfaces-textbox .single-photo-box,
  #inhabitants-textbox .single-photo-box,
  #product-textbox .single-photo-box,
  #miscellaneous-textbox .single-photo-box {
    height: max-content !important;
    display: block !important;
  }

  #urban\ volumes-textbox .text-box-content,
  #urban\ surfaces-textbox .text-box-content,
  #inhabitants-textbox .text-box-content,
  #product-textbox .text-box-content,
  #miscellaneous-textbox .text-box-content {
    display: block !important;
    height: 100% !important;
    max-height: 100vh !important;
    width: 100%;
    padding: 0 !important;
    padding-bottom: 12vh !important;
    margin: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    overscroll-behavior: contain !important;
  }

  .gallery-layout-wrapper {
     position: relative !important;
     bottom: auto !important;
     right: auto !important;
     width: 100% !important;
     overflow: visible;
  }

  #urban\ volumes-textbox .single-photo,
  #urban\ surfaces-textbox .single-photo,
  #inhabitants-textbox .single-photo,
  #product-textbox .single-photo,
  #miscellaneous-textbox .single-photo {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important; 
    display: block;
    margin: 0 auto !important; 
  }

  .nav-bar-container {
    display: none !important; 
  }

  .category-nav-footer {
    margin-top: 1vh !important;
  }

  #urban\ volumes-textbox .nav-arrow,
  #urban\ surfaces-textbox .nav-arrow,
  #inhabitants-textbox .nav-arrow,
  #product-textbox .nav-arrow,
  #miscellaneous-textbox .nav-arrow {
    position: absolute !important;
    top: 0 !important;
    height: 100% !important;
    width: 30% !important;
    z-index: 99999 !important;
    background: transparent;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    pointer-events: auto !important;
    padding: 0;
    margin: 0;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }

  .project-back-button, 
  .gallery-back-button, 
  #worksBackButton {
    position: fixed !important;
    top: calc(env(safe-area-inset-top) + 2vh) !important;
    left: 5vw !important;
    z-index: 99999 !important;
    pointer-events: auto !important;
  }

  .active, .visible {
    z-index: 9999 !important;
  }

  #urban\ volumes-textbox .nav-arrow.prev,
  #urban\ surfaces-textbox .nav-arrow.prev,
  #inhabitants-textbox .nav-arrow.prev,
  #product-textbox .nav-arrow.prev,
  #miscellaneous-textbox .nav-arrow.prev {
    left: 0 !important;
    right: auto !important;
  }

  #urban\ volumes-textbox .nav-arrow.next,
  #urban\ surfaces-textbox .nav-arrow.next,
  #inhabitants-textbox .nav-arrow.next,
  #product-textbox .nav-arrow.next,
  #miscellaneous-textbox .nav-arrow.next {
    right: 0 !important;
    left: auto !important;
  }

  .category-nav-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5vh;
    margin-top: 2vh;
    width: 100%;
  }

  .nav-bar-container {
    display: flex;
    gap: 0.4vw;
    height: 0.4vh;      
    width: 100%;      
    max-width: 100%;
  }

  .nav-segment {
    flex: 1;
    background: rgba(var(--text-main-rgb), 0.3);
    transition: background 0.3s ease;
  }

  .nav-segment.active {
    background: var(--accent-lime);
  }

  .photo-title {
    font-size: 1.6vh;
    font-weight: 300;
    letter-spacing: 0.05em;
    text-transform: none; 
    color: var(--accent-lime); 
  }
}

/* =======================================
   ALLINEAMENTO A DESTRA (SOLO DESKTOP)
   ======================================= */
@media (min-width: 769px) {
.gallery-layout-wrapper {
    position: absolute;
    bottom: 10%; 
    right: 3vw;
    display: flex;
    flex-direction: column; 
    align-items: flex-end;    
    width: max-content;
  }

  #urban\ volumes-textbox .single-photo-container,
  #urban\ surfaces-textbox .single-photo-container,
  #inhabitants-textbox .single-photo-container,
  #product-textbox .single-photo-container,
  #miscellaneous-textbox .single-photo-container {
    position: relative; 
    bottom: auto;
    right: auto;
  }

  .category-nav-footer {
    align-items: flex-end !important;
  }
  
  .nav-bar-container {
    justify-content: flex-end !important;
  }
  
  .photo-title {
    text-align: right !important;
    padding-right: 0.2vw; 
  }
}

body.grid-active #urban\ volumes-textbox,
body.grid-active #urban\ surfaces-textbox,
body.grid-active #inhabitants-textbox,
body.grid-active #product-textbox,
body.grid-active #miscellaneous-textbox {
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

body.grid-active #urban\ volumes-textbox .text-box-content,
body.grid-active #urban\ surfaces-textbox .text-box-content,
body.grid-active #inhabitants-textbox .text-box-content,
body.grid-active #product-textbox .text-box-content,
body.grid-active #miscellaneous-textbox .text-box-content {
  overflow: hidden !important;
  overflow-y: hidden !important;
  touch-action: none !important;
}

@media (min-width: 769px) {
  #gallery-textbox .personal-work-item {
    margin-bottom: 0.7em !important;
    margin-left: 0 !important;
    text-align: left !important;
  }
}