/* Prevent padding from causing overflow */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  margin:0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: #000;
  background: #fff;
  
  text-align:center;
  line-height: 1.8;
  height: 100%;
  width: 100%;
  overflow: auto;

}
header {
    
    align-items: center;
    justify-content: flex-start;    /* aligned (not centered) */
    padding: 1rem;
    position: relative;
     background: #fff;
     border-bottom: 1px solid #eee;
}


header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.2em; /* 40px/16=2.5em */
    font-weight: bold;
    letter-spacing: 8px;
}

header h2 {
      font-family: 'Poppins', sans-serif;
      font-size: 0.8em; /* 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;
}

header cite {
    display: block;
    margin-top: 0.5rem;
    margin-left: 2.5rem;
    margin-right: 2.5rem;
    font-size: 0.8rem;
   
    color: #666;
    font-style: italic;
}



h2 {
  margin-top: 0;
  font-size: 18px;
}

.top-bar a:hover, .top-bar button:hover {
  background: #ccc;
}

.obra_button {
    margin-top: 2rem;
    font-family: 'Poppins', sans-serif;
    font-size:14px;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    display: block;
    width: 150px;
    height: 36px;
    background: orange;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 2rem;
}
.obra_button a:hover, .top-bar button:hover {
    background: #ccc;
}


section {
  background: #fff;
  padding: 0.5rem;
  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: 2rem;
  margin-top: 0.5rem;

}

.menu-toggle {
    display:none; /* hidden on desktop */
    background: none;
    border: none;
    font-size: 2rem;
    color:black;
    cursor: pointer;
    
    margin-top:0.0rem;
    position: absolute;
    left: 1rem;
}

.menu-bar {
    display:block;
    justify-content:left; /* center on desktop */
    align-items:left;
    position:relative;
    margin-top:0.5rem;
    margin-bottom:0rem;
}

#navMenu ul {
    list-style: none;
    margin: 0;
    padding: 0rem;
    display: flex;                  /* desktop row */
 
}

#navMenu a {
    padding: 0.5rem 2rem;
    display: block;
    
    color:black;
    text-decoration:none;
    font-weight:500;
}

#navMenu a:hover {
    background:#eee;
    border-radius:4px;
}



main {
    max-width:800px;
    margin:0 auto;
    padding:1rem;
}

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;
    text-align:left;
}

#langBtn {
    margin:2rem auto;
    padding:0.5rem 1rem;
    font-size:0.8rem;
    cursor:pointer;
    display:block;
}

footer {
    margin:2rem 0;
    font-size:0.9rem;
    color:#555;
}


/* Mobile dropdown */
@media(max-width:768px){
  
  header {
      
      justify-content: flex-start;
  }
  
  .menu-toggle {
      display:block; /* show only on mobile */
  }
  
  .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;
    gap: 10;
    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;
  }

}

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

.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;
}

.caption {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    background: #fff;
  /*border: 1px solid #ccc;*/
    border-top: none;
    padding: 6px;
  
}

/* --- Full image view --- */
.full-image-view {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background: #000;
      overflow: auto;         /* native scrollbars */
      display: none;          /* hidden until opened */
      z-index: 999;
}

.full-image-view img {
    display: block;
    max-width: none;        /* prevent auto scaling */
    max-height: none;
}



.text-with-image {
      max-width: 800px;
      margin: auto;
}

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;
}

.text-with-image p {
  text-align: justify;
}

/* Small screen adjustments */
@media (max-width: 600px) {
  figure {
    float: left;       /* stop floating */
    width: 40%;       /* take full width */
    margin: 0 0 1rem 0;
   
  }

  .text-with-image p {
    text-align: justify;  /* no justification */
  }
 
}


/* Grids */
.grid {
    display: absolute;
    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;
}



            /* Carousel */
.carousel {
  position: relative;
  overflow: hidden;
  width: 100%;

  /* Maintain aspect ratio (e.g. 16:9) */
  aspect-ratio: 16 / 9;
  margin-bottom:2rem;
  
}

/* Position all slides on top of each other */
.carousel img {
  position: absolute;
  inset: 0; /* shorthand for top:0; right:0; bottom:0; left:0 */
  width: 100%;
  height: auto;
  object-fit: cover;

  opacity: 0;
  transition: opacity 2s ease-in-out;
  z-index: 0;
  pointer-events: none;
}

/* Show active image */
.carousel img.active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

/* Prevent first active image from "jumping in" */
.carousel img.active:first-child {
  transition: none;
}

/* Only for very first load */
.carousel img.initial {
    transition: none !important;
}

#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(2, 1fr);
  grid-auto-rows: 120px;
  gap: 8px;
  padding: 20px;
  grid-auto-flow: dense;
  cursor: pointer;
  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: zoom-in;
  transition: transform 0.2s;
}

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

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