
          /* Prevent padding from causing overflow */
          *, *::before, *::after { box-sizing: border-box; }
          
          html, body { height: 100%; }
          
          body { margin:0; font-family: 'Poppins', sans-serif; height: 100%; }
          
          

          
          header h1 {
              margin-bottom: 20px;
              font-family: 'Poppins', sans-serif;
              font-size: 1.2rem; /* 40px/16=2.5em */
              font-weight: normal;
              letter-spacing: 8px;
              text-align: center;
          }
          
          header h2 {
              font-family: 'Poppins', sans-serif;
              font-size: 0.8rem; /* 40px/16=2.5em */
              font-weight: normal;
              letter-spacing: 2px;
          }
          
          header button {
              margin-top: 1rem;
              padding: 0.8rem 1rem;
              background: #0077cc;
              color: #fff;
              border: none;
              border-radius: 4px;
              cursor: pointer;
              align-items: center;
          }
          
          h1 {
            
              font-family: 'Poppins', sans-serif;
              font-size: 1.2rem; /* 40px/16=2.5em */
              font-weight: bold;
              letter-spacing: 8px;
              text-align: center;
          }
          
          h2 {
              margin: 0 0 0.5rem 0;
              font-family: 'Poppins', sans-serif;
              font-size: 1.0rem; /* 40px/16=2.5em */
              font-weight: normal;
              letter-spacing: 2px;
              text-align: center;
          }
          
          .top-bar a:hover, .top-bar button:hover {
              background: #ccc;
          }
          
          section {
              background: transparent;
              padding: 1.0rem;
              border-radius: 8px;
              box-shadow: 0 2px 5px rgba(0,0,0,0.05);
              margin-bottom: 20px;
          }
          
          section img {
              max-width: 100%;
              border-radius: 6px;
              margin-bottom: 1rem;
          }
          
          .menu-toggle {
            font-size:2rem;
            color: black;
            background:none;
            border:none;
            cursor:pointer;
            
            margin-top: 40px;
            position: absolute;
            left: 1rem;
          }
          
          /* Base nav menu (mobile dropdown) */
          #navMenu {
            display: none;
            position: absolute;
            top:3rem;
            left:1rem;
            background: rgba(255,255,255,0.95);
            border-radius: 4px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
          }
          #navMenu.active { display: block; }
          #navMenu ul {
            list-style:none;
            margin:0;
            padding:0;
          }
          #navMenu li { padding:0.5rem 1rem; }
          #navMenu a {
            color:black;
            text-decoration:none;
          }

          /* Desktop: horizontal bar */
          @media (min-width:768px) {
            .menu-toggle { display:none; }
            #navMenu {
              display:block;
              position:static;
              background:transparent;
              box-shadow:none;
            }
            #navMenu ul {
              display:flex;
              gap:2rem;
            }
            #navMenu li { padding:0; }
          }
          
          
          /* Main area: vertically centered when there's extra height, but scrolls when taller */
          .page-wrapper {
              flex: 1;
              display: flex;
              flex-direction: column;
              padding: 1rem;
              background: transparent;
          }
          
          /* This block is what gets centered vertically when there is extra space */
          .center-when-room {
              margin-block: auto;             /* pushes block to vertical center if there's room */
              width: 100%;
              display: flex;
              flex-direction: column;
              align-items: center;            /* keep inner content centered horizontally wrapper-wise */
              gap: 1rem;
          }
          
          
          
          main {
              width: 100%;
              max-width: 800px;               /* desktop reading width */
              margin: auto;
              background: transparent;/* horizontal centering */
              /*text-align: left;*/
          }
          
          main img {
              display: block;
              max-width: 100%;                /* never exceed container */
              height: auto;
              margin-bottom: 1rem;
              border-radius: 6px;
          }
          
          main p {
              font-size: 1.1rem;
              line-height: 1.6;
              overflow-wrap: anywhere;        /* prevent long words/URLs from causing overflow */
              margin: 0;
          }
          
          main a {
              display: inline-block;
              margin-top: 1rem;
              color: white;
              text-decoration: none;
          }
          
#langBtn {
    margin:2rem auto;
    padding:0.5rem 1rem;
    font-size:0.8rem;
    cursor:pointer;
    display:block;
}
         
          
          /* Mobile: hamburger + dropdown below, no overflow */
          @media (max-width: 768px) {
              
              header {
                  
                  justify-content: flex-start;
              }
              
              .menu-toggle {
                  display: block;
              }
              
              .menu-bar {
                  justify-content:flex-start;
              }
              
              
              #navMenu ul {
                  display: none;                       /* hidden until toggle */
                  flex-direction: column;
                  position: absolute;
                  top: 100%;
                  left: 0;
                  background: #f9f9f9;
                  width: 180px);             /* fit within viewport */
                  border-radius: 4px;
                  padding: 0.5rem 0;
                  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
                  
              }
              
              #navMenu.active ul {
                  
                  display: flex;
              }
              
              #navMenu a {
                  padding: 0.5rem 1rem;
                  display: block;
                  text-decoration:none;
                  font-weight:500;
              }
              
          }
          
          /* Grids */
          .grid {
              display: grid;
              grid-template-columns: repeat(3, 1fr);
              gap: 0.5rem;
              margin-top: 1rem;
              /*background: transparent;*/
              background: url("") center/cover no-repeat;
              justify-content: center;
          }
          
          .grid img {
              width: 100%;
              display: block;
          }
          
          .grid2 {
              width: 100%;
              display: block;
          }
          
          .caption_home_thumbnail {
              text-decoration: none;
              font-family: 'Poppins', sans-serif;
              font-size: 0.5rem;
              text-align: center;
              font-weight: normal;
              letter-spacing: 2px;
          }

.static-img {
    display: flex;
    justify-content: center;
    
  
}

            /* Photo overlay */
            .photo-page {
                display: none;
                position: fixed;
                inset: 0;
                background: #111;
                overflow: auto;
            }
            .photo-page.active { display: block; }
            
            /* Container to center image in Fit mode */
            .photo-container {
                display: flex;
                width: 100%;
                justify-content: center;
                align-items: center;
            }
            /* Zoom mode: top-left anchor */
            .photo-page.zoom .photo-container {
                justify-content: flex-start;
                align-items: flex-start;
            }
            .photo-page,
            #fullImage {
              touch-action: pan-x pan-y; /* allow scrolling, block pinch-zoom */
            }
            
              /* Fixed buttons stay at viewport corners */
              .photo-btn {
                position: fixed;
                top: 1rem;
                font-size: 1.1rem;
                color: white;
                background: rgba(0,0,0,0.5);
                padding: 0.4rem 0.8rem;
                border-radius: 4px;
                z-index: 1000;
                cursor: pointer;
                border: none;
                text-decoration: none;
              }
              .photo-btn.back { left: 1rem; }
              .photo-btn.toggle { right: 1rem; }
            
            /* Large image with smooth transition */
            #fullImage {
              display: block;
              max-width: none;
              height: auto;
              transition: width 0.4s ease, height 0.4s ease;
            }
       
            /* Carousel */
            .carousel {
              position: relative;
              overflow: hidden;
              width: 100%;
              max-height: 500px;
            }

            .carousel img {
              width: 100%;
              display: none;
              object-fit: cover;
            }

            .carousel img.active {
              display: block;
              transition: opacity 1s;
            }

            .asym-gallery {
              display: grid;
              background: transparent;
              /* First two cols together = Big's width, each = half */
              grid-template-columns: 1fr 1fr 1fr;
              grid-auto-rows: 200px; /* size of small square */
              gap: 4px;
              margin: 0 8px;
              grid-template-areas:
                "big big side1"
                "big big side2"
                "bottom1 bottom2 bottom3";
            }

            .asym-gallery img {
              width: 100%;
              height: 100%;
              object-fit: cover;
              display: block;
              cursor: pointer;
            }

            .big     { grid-area: big; }
            .side1   { grid-area: side1; }
            .side2   { grid-area: side2; }
            .bottom1 { grid-area: bottom1; }
            .bottom2 { grid-area: bottom2; }
            .bottom3 { grid-area: bottom3; }

            @media (max-width: 600px) {
              .asym-gallery { grid-auto-rows: 120px; }
            }
            @media (max-width: 400px) {
              .asym-gallery { grid-auto-rows: 90px; }
            }


.asym-gallery3 {
  display: grid;
  grid-template-columns: 80% 20%;  /* left = 40%, right = 60% */
  gap: 8px;
  max-width: 80%;
  margin: 0 auto;

  /* lock into a rectangle */
  aspect-ratio: 3 / 2;
}

.asym-gallery3 .left {
  height: 100%; /* force left to full gallery height */
}

.asym-gallery3 .right {
  display: grid;
  grid-template-rows: 1fr 1fr 1fr; /* 3 equal rows */
  gap: 18px;
  height: 100%;
}

/* All images fit their containers */
.asym-gallery3 img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}

/* Mobile fallback */
@media (max-width: 768px) {
  .asym-gallery3 {
    grid-template-columns: 85% 15%;  /* stack */
    aspect-ratio: auto;          /* no fixed rectangle */
  }

  .asym-gallery3 .right {
    grid-template-rows: auto auto auto;
  }

  .asym-gallery3 .left,
  .asym-gallery3 .right {
    height: auto;
  }

  .asym-gallery3 img {
    height: auto;
  }
}

.backcontainer {
    position: flex;
    display: flex;
    z-index: 4001;
    margin-top: 1rem;
    margin-bottom: 5rem;
    justify-content: center;
}

.backcontainer.hidden {
    
  opacity: 0;
  pointer-events: none;
}

.links.hidden {
    
  opacity: 0;
  pointer-events: none;
}

.links {
    position: flex;
    display: flex;
    z-index: 4000;
    margin-top: 1rem;
    margin-bottom: 5rem;
    justify-content: center;
}

/* Back button */
.back-btn {
    position: flex;
    margin-top: 1rem;
    margin-left: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: rgba(0,0,0,0.5);
      color: white;
      cursor: pointer;
      border: none;
      text-decoration: none;
      z-index: 6000;
      gap: 30px;
}

.link-btn {
    position: absolute;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 150px;
    height: 36px;
    border-radius: 8px;
    background: gray;
    color: white;
    cursor: pointer;
    border: none;
    text-decoration: none;
    z-index: 3000;
    gap: 30px;
    
}

.link-btn.scroll {
    margin-right: 10rem;
    
}

.link-btn.grid {
    
    margin-left: 10rem;
   
}

.back-btn svg {
  width: 1.2em;
  height: 1.2em;
  fill: currentColor;
}

/* Hover & tap feedback */
.link-btn:hover {
  background: rgba(0,0,0,0.8);
}
.link-btn:active {
  transform: scale(0.95);
}

.centered-btn {
  display: absolute;
  left: 50%;
  height: 40px;
  border: 8px;
  background: gray;
  color: white;
  border-radius: 4px;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  text-align: center;
  font-weight: normal;
  padding-left: 1rem;
  padding-right: 1rem;
  justify-content: center;
}

/* Hide the "Back" text on small screens */
@media (max-width: 768px) {
  .back-btn span {
    display: none;
  }
  
  .link-btn span {
    display: none;
  }
}

/*#collage img:hover { transform: scale(1.04); }*/

.collage .wide { grid-column: span 2; }
.collage .tall { grid-row: span 2; }
.collage .big  { grid-column: span 2; grid-row: span 2; }

/* Irregular collage */
.collage {
      display: grid;
      grid-template-columns: repeat(3, 1fr); /*repeat(auto-fill, minmax(150px, 3fr));*/
      grid-auto-rows: 120px;
      gap: 8px;
      padding: 20px;
      grid-auto-flow: dense;
      cursor: none;
      background: #eee url("collage_images/caravaggi.jpg") center/cover no-repeat;
    }

  .collage img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border-radius: 6px;
        cursor: none;   /*zoom-in*/
        transition: transform 0.2s;
      }
  
/*#collage img:hover { transform: scale(1.04); }*/

.collage .wide { grid-column: span 2; }
.collage .tall { grid-row: span 2; }
.collage .big  { grid-column: span 2; grid-row: span 2; }


  


/* Viewer overlay */
#viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
}
#viewer img {
  max-width: 90%;
  max-height: 90%;
  cursor: grab;
  transition: opacity 0.3s ease;
}
#viewer img:active {
  cursor: grabbing;
}
  
  #closeViewer {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    z-index: 10000; /* above the image */
  }

  #closeViewer:hover {
    background: rgba(255, 255, 255, 1);
  }
  
  

/* Spinner */
#spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  display: none;
}
@keyframes spin {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}


figure {
    float: left;
    width: 200px;
    margin: 0 25px 20px 0;
  }

  figure img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    padding-right: 1rem;
  }

  figure figcaption {
    font-size: 0.8rem;
    color: #555;
    text-align: center;
    margin-top: 4px;
    line-height: 1.3;
  }


.media-item {
      flex: 1 1 220px;
      max-width: auto;
      text-align: center;
      margin-top: 20;
}

.media-item img {
      width: 100%;
      height: auto;
      cursor: pointer;
}

.media-item video {
    width: 100%;           /* image/video fills container */
    height: auto;
/*border: 2px solid #ccc;*/
    display: block;
    cursor: pointer;
}
