/* ==========================================================================
   0. CARICAMENTO RIGOROSO FONT CUSTOM (.OTF)
   ========================================================================== */
@font-face {
  font-family: "SwissWorksSerif";
  src: url("/suisseworks/SUISSEWORKS-BOOK.OTF") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "SwissWorksSerif";
  src: url("/suisseworks/SUISSEWORKS-BOOKITALIC.OTF") format("opentype");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

/* ==========================================================================
   1. RESET E IMPOSTAZIONI DI BASE (ALLINEAMENTO TIPOGRAFICO DESKTOP)
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  position: relative;
  background-color: #fff;
  color: #000;
  font-family: "SwissWorksSerif", "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.main-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  padding: 15px 20px;
  width: 100%;
}

.main-grid .section {
  display: block;
  line-height: 1.2;
}

.brand {
  grid-column: 1 / 3;
}
.works {
  grid-column: 3 / 7;
  position: relative;
}
.about {
  grid-column: 7 / 13;
}

.list,
p,
a {
  font-size: inherit;
  font-weight: normal;
  text-decoration: none;
  color: inherit;
  list-style: none;
  line-height: inherit;
}

a {
  transition: opacity 0.2s ease-in-out;
}
a:hover,
.button:hover {
  opacity: 0.4;
  cursor: pointer;
}

/* ==========================================================================
   2. HOMEPAGE: LISTE PROGETTI E COPERTINA (DESKTOP)
   ========================================================================== */
.home-works-column {
  display: block;
}

.column-title {
  font-size: inherit;
  font-weight: normal;
  color: #000;
  line-height: 1.2;
  display: inline-block;
  margin: 0 0 20px 0;
}
.column-title:hover {
  opacity: 1;
  cursor: default;
}

.list li,
.dropdown-menu li {
  margin-bottom: 0;
  position: relative;
}

.list li a,
.dropdown-menu li a {
  display: inline-block;
  position: relative;
  padding-left: 0;
  transition:
    padding-left 0.25s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.2s ease-in-out;
}

.list li a::before,
.dropdown-menu li a::before {
  content: "★";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  font-family: sans-serif;
  font-size: 14px;
  transition: opacity 0.2s ease-in-out;
}

.list li a:hover,
.dropdown-menu li a:hover {
  padding-left: 15px;
}
.list li a:hover::before,
.dropdown-menu li a:hover::before {
  opacity: 1;
}

.about-trigger-text::after {
  content: "(read more)";
}

#preview-container {
  position: fixed;
  left: calc(50% + 10px);
  right: 20px;
  bottom: 20px;
  height: 70vh;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#bg-image-overlay {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: left bottom;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

#preview-container.active #bg-image-overlay {
  opacity: 1;
}
#mobile-gallery-trigger {
  display: none;
}

/* ==========================================================================
   3. PANNELLO INDIPENDENTE ABOUT BIOGRAFIA (DESKTOP)
   ========================================================================== */
#about-panel-shaded {
  position: fixed;
  top: 45px;
  right: 0;
  bottom: 0;
  left: calc(50% - 10px);
  background-color: #d9d9d9;
  color: #fff;
  z-index: 400;
  padding: 15px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.3s ease-in-out;
  opacity: 0;
  pointer-events: none;
}

.is-landing #about-panel-shaded {
  top: 0;
}
#about-panel-shaded.about-active {
  opacity: 1;
  pointer-events: auto;
}
.about-panel-content {
  margin-top: 0px;
  max-width: 100%;
}
.about-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  color: #fff;
}
.about-footer a {
  color: #fff;
}

/* ==========================================================================
   4. INTERFACCIA PAGINE PROGETTO (DESKTOP)
   ========================================================================== */
.project-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background-color: #fff;
  z-index: 300;
}

.scattered-container {
  position: fixed;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
}

.scat-img {
  position: absolute;
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
  transition:
    left 0.6s cubic-bezier(0.25, 1, 0.5, 1),
    top 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}
.scat-img:hover {
  z-index: 999;
  transform: scale(1.03);
  cursor: pointer;
}

#project-panel-shaded {
  position: fixed;
  top: 45px;
  left: 0;
  bottom: 0;
  right: calc(50% - 10px);
  background-color: #d9d9d9;
  color: #fff;
  z-index: 110;
  padding: 15px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: opacity 0.3s ease-in-out;
  opacity: 0;
  pointer-events: none;
}

#project-panel-shaded.panel-active {
  opacity: 1;
  pointer-events: auto;
}

.panel-close-text {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 15px;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.2s;
}
.panel-close-text:hover {
  opacity: 0.4;
}

.project-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
}
#panel-image-caption-zone {
  display: none;
}
#panel-image-caption-zone em {
  font-style: italic;
  color: #eee;
}
#panel-action-button {
  color: #fff;
}

.panel-button-text::after {
  content: "(view gallery)";
}

/* ==========================================================================
   5. TITOLI STICKY (DESKTOP)
   ========================================================================== */
#project-title-sticky,
#image-title-sticky {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 130;
  display: none;
  pointer-events: none;
  padding: 0;
  margin: 0;
}
#project-title-sticky {
  top: 40px;
}
#image-title-sticky {
  top: calc(40px + 1.2em);
}
#project-title-sticky.title-visible,
#image-title-sticky.title-visible {
  display: block;
}

#project-title-sticky .sticky-trigger-zone,
#image-title-sticky .sticky-trigger-zone {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  padding: 0 20px;
  width: 100%;
  margin: 0;
}

.sticky-trigger-zone span {
  grid-column: 3 / 7;
  font-weight: normal;
  color: #000;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.2s;
  padding: 0;
  margin-top: 20px;
}
.sticky-trigger-zone span:hover {
  opacity: 0.5;
}
.italic-trigger span {
  font-style: italic;
  color: #000;
}

/* ==========================================================================
   6. LIGHTBOX (DESKTOP)
   ========================================================================== */
#lightbox-overlay {
  position: fixed;
  top: 45px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background-color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 60px 40px 40px 40px;
  transition:
    left 0.35s cubic-bezier(0.25, 1, 0.5, 1),
    padding 0.35s ease;
  cursor: none;
}
#lightbox-overlay.active {
  display: flex;
}
#lightbox-overlay.shifted-right {
  left: calc(50% + 10px);
  padding: 60px 20px 40px 20px;
}

.lightbox-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
#lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.lightbox-nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 85;
  cursor: none;
}
.left-zone {
  left: 0;
}
.right-zone {
  right: 0;
}
#custom-lightbox-cursor {
  position: fixed;
  z-index: 88;
  pointer-events: none;
  display: none;
  font-family: "SwissWorksSerif", "Times New Roman", serif;
  font-size: 14px;
  color: #000;
  white-space: nowrap;
  line-height: 1;
}

/* ==========================================================================
   7. GESTIONE MENU A TENDINA WORKS (DESKTOP)
   ========================================================================== */
.dropdown-container {
  display: block;
}
.dropdown-trigger {
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-block;
  line-height: 1.2;
}
.dropdown-trigger:hover {
  opacity: 0.4;
}

.dropdown-menu {
  position: absolute;
  top: 35px;
  left: 0;
  width: max-content;
  max-width: 450px;
  background-color: #fff;
  display: none;
  flex-direction: column;
  z-index: 310;
  padding-top: 10px;
  list-style: none !important; /* <--- AGGIUNGI QUESTA RIGA */
}
.dropdown-menu.dropdown-active {
  display: flex;
}
.dropdown-menu li a {
  display: block;
  position: relative;
  padding: 0 20px 0 0;
  font-size: 15px;
  color: #000;
  transition:
    padding-left 0.25s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.2s ease-in-out;
}
.dropdown-menu li a:hover {
  opacity: 0.4;
}

.language-switch-fixed {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 500;
  font-family: "SwissWorksSerif", "Times New Roman", serif;
  font-size: 15px;
  color: #000;
  line-height: 1.2;
  background-color: transparent;
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
  user-select: none;
}
.language-switch-fixed:hover {
  opacity: 0.4;
}

#about-panel-shaded.about-active ~ .language-switch-fixed,
#project-panel-shaded.panel-active ~ .language-switch-fixed {
  color: #fff;
}

#mobile-project-header {
  display: none;
}

/* ==========================================================================
   8. ADATTAMENTO COMPLETO PER DISPOSITIVI MOBILE (SOTTO I 768px)
   ========================================================================== */
@media screen and (max-width: 768px) {
  .main-grid {
    display: block;
    position: relative;
    padding: 15px 20px;
    width: 100%;
  }
  .brand {
    position: absolute;
    top: 15px;
    left: 20px;
    display: inline-block;
  }

  .project-nav .works {
    display: none !important;
  }

  .about {
    position: absolute;
    top: 15px;
    right: 20px;
    text-align: right;
    display: inline-block;
    z-index: 100;
  }
  .about-content p {
    font-size: 0;
    color: transparent;
  }
  .about-content a {
    display: inline-block;
    font-size: 15px;
    color: #000;
    line-height: 1.2;
  }

  .about-trigger-text::after {
    content: "About" !important;
  }

  .home-works-column {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    width: 100%;
  }
  .column-title {
    font-size: 15px;
    text-transform: none;
    margin-bottom: 20px;
    display: inline-block;
  }

  .list,
  .dropdown-menu {
    padding-left: 0 !important;
    list-style: none !important;
    list-style-type: none !important;
  }
  .list li,
  .dropdown-menu li {
    line-height: 1.2;
    padding: 0;
    list-style: none !important;
    list-style-type: none !important;
  }
  .list li::before,
  .dropdown-menu li::before {
    display: none !important;
    content: "" !important;
  }

  .list li a {
    padding-top: 2px;
    padding-bottom: 2px;
    display: inline-block;
  }
  .list li a.mobile-selected {
    padding-left: 15px;
  }
  .list li a.mobile-selected::before {
    opacity: 1 !important;
    display: inline-block !important;
    content: "★" !important;
  }

  #preview-container {
    position: fixed;
    left: auto;
    right: 20px;
    bottom: 60px;
    width: 65vw;
    height: 42vh;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  #preview-container.active {
    opacity: 1;
    pointer-events: auto;
  }

  #bg-image-overlay {
    width: auto;
    height: calc(100% - 30px);
    max-width: 100%;
    object-fit: contain;
    object-position: right bottom;
    align-self: flex-end;
  }

  #mobile-gallery-trigger {
    display: none;
    position: absolute;
    right: 0;
    bottom: calc(100% - 25px);
    font-family: "SwissWorksSerif", "Times New Roman", serif;
    font-size: 15px;
    color: #000;
    background-color: transparent;
    padding: 0;
    white-space: nowrap;
    pointer-events: auto;
    z-index: 15;
  }
  #mobile-gallery-trigger.visible {
    display: block;
  }

  /* ALLINEAMENTO UNIFICATO: Entrambi i pannelli grigi partono esattamente a top: 50px */
  #about-panel-shaded,
  #project-panel-shaded {
    left: 0;
    top: 45px !important; /* Bloccati millimetricamente sotto Nicola... e About */
    right: 0;
    bottom: 0;
    z-index: 280 !important;
    padding: 20px;
    height: calc(100vh - 45px) !important; /* Altezza calibrata al centesimo */
    background-color: #d9d9d9 !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box;
  }
  .about-panel-content {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    display: flex;
    flex-direction: column;
  }
  .about-panel-content::-webkit-scrollbar {
    display: none;
  }
  .about-panel-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .about-footer {
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    flex-shrink: 0;
    padding-top: 20px;
    padding-bottom: 0px;
  }

  #project-panel-shaded * {
    font-weight: normal !important;
  }
  #project-panel-shaded .panel-close-text {
    display: none !important;
  }
  .panel-button-text::after {
    content: "(close)" !important;
  }

  /* Galleria verticale mobile a scrollo */
  #gallery-container.scattered-container {
    position: fixed !important;
    top: 110px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 20px !important;
    height: calc(100vh - 110px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 40px !important;
    padding: 20px 20px 80px 20px !important;
    z-index: 1 !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  #gallery-container.scattered-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  #gallery-container.scattered-container .img-wrapper {
    width: 100% !important;
    height: auto !important;
    max-height: 65vh !important;
    flex-shrink: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  #gallery-container.scattered-container .scat-img {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    transform: none !important;
  }

  /* La barra grigia del titolo del progetto su mobile rimane stabile a top: 45px */
  #mobile-project-header {
    display: block !important;
    position: fixed !important;
    top: 45px !important;
    left: 0 !important;
    right: 0 !important;
    height: auto !important;
    background-color: #d9d9d9 !important;
    color: #fff !important;
    z-index: 350 !important;
    padding: 12px 20px !important;
    cursor: pointer !important;
  }
  .mobile-header-title {
    font-size: 15px !important;
    font-weight: normal !important;
    line-height: 1.2 !important;
  }

  #project-title-sticky,
  #image-title-sticky,
  #lightbox-overlay {
    display: none !important;
  }

  .language-switch-fixed {
    right: auto !important;
    left: 20px !important;
    bottom: 20px !important;
    position: fixed !important;
  }

  #about-panel-shaded.about-active ~ .language-switch-fixed,
  .panel-active ~ .language-switch-fixed {
    left: auto !important;
    right: 20px !important;
  }

  /* Forza lo scorrimento del testo e blocca il bottone sul fondo */
  .project-text-content {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }
  .project-text-content p {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .project-text-content p::-webkit-scrollbar {
    display: none !important;
  }
  .project-text-content .button,
  .project-text-content #panel-action-button {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    padding-top: 15px;
    padding-bottom: 10px;
    display: inline-block;
  }
/* ==========================================================================
       BLINDATURA UNIVERSALE: TUTTE LE ANTEPRIME AL MAX 40% ALTEZZA IN HOME MOBILE
       ========================================================================== */
    
    #preview-container {
        position: fixed !important;
        top: auto !important; 
        bottom: 20px !important; /* Bloccato sul fondo dello schermo */
        left: 20px !important; 
        right: 20px !important; 
        width: auto !important; 
        height: auto !important;
        max-height: 50vh !important; /* L'intero blocco (tasto + foto) non supera la metà schermo */
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        align-items: flex-end !important;
        z-index: 10 !important;
    }

    /* Il tasto (view gallery) si appoggia SOPRA e FUORI dalla foto */
    #mobile-gallery-trigger.visible {
        position: relative !important;
        margin-bottom: 10px !important; /* Stacco netto sopra l'immagine */
        align-self: flex-end !important;
    }

    /* Regola universale rigida per ogni tipo di immagine (Orizzontale e Verticale) */
    #bg-image-overlay {
        height: 40vh !important; /* Bloccata tassativamente al 40% dell'altezza schermo */
        width: auto !important; /* La larghezza si adatta in automatico per non deformare la foto */
        max-width: 100% !important; /* Impedisce che l'immagine esca dai bordi laterali del telefono */
        object-fit: contain !important; /* Mantiene le proporzioni reali senza tagli o zoom strani */
        object-position: right bottom !important;
    }
}
