/* ==========================================
   LA PIAZZETTA – GALLERY PAGE
   Scope: public /gallery visual theme
========================================== */

body.page-gallery main{
  background:
    radial-gradient(circle at 12% 0%, rgba(217,101,22,0.10), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(31,107,58,0.08), transparent 28%),
    var(--lp-cream);
}

.lp-gallery-page{
  position: relative;
  overflow: hidden;
  padding: clamp(42px, 6vw, 74px) 0 clamp(54px, 7vw, 92px);
}

.lp-gallery-page::before{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url('../../img/textures/paper-grain.png');
  background-repeat: repeat;
  opacity: 0.24;
  mix-blend-mode: multiply;
}

.lp-gallery-page > .container{
  position: relative;
  z-index: 1;
}

.lp-gallery-hero{
  position: relative;
  width: min(920px, 100%);
  margin: 0 auto clamp(28px, 4vw, 46px);
  text-align: center;
  padding: clamp(18px, 3vw, 28px) clamp(14px, 2vw, 22px);
}

.lp-gallery-hero::before,
.lp-gallery-hero::after{
  content: "";
  position: absolute;
  left: 50%;
  width: min(520px, 84vw);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(217,101,22,0.58), transparent);
}

.lp-gallery-hero::before{ top: 0; }
.lp-gallery-hero::after{ bottom: 0; }

.lp-gallery-kicker{
  margin: 0 0 6px;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: var(--fs-kicker);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(58,29,22,0.62);
}

.lp-gallery-title{
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(44px, 6vw, 78px);
  line-height: 0.98;
  color: var(--lp-bg-dark);
}

.lp-gallery-lead{
  width: min(660px, 100%);
  margin: 14px auto 0;
  color: rgba(42,37,33,0.76);
  font-size: clamp(15px, 1.6vw, 18px);
  line-height: 1.72;
}

.lp-gallery-shell{
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.82), rgba(255,255,255,0.58)),
    rgba(255,255,255,0.70);
  border: 1px solid rgba(58,29,22,0.12);
  box-shadow: 0 22px 48px rgba(58,29,22,0.08);
  padding: clamp(18px, 3vw, 34px);
}

.lp-gallery-shell::before,
.lp-gallery-shell::after{
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 1px;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(217,101,22,0.46), transparent);
}

.lp-gallery-shell::before{ left: 14px; }
.lp-gallery-shell::after{ right: 14px; }

.lp-gallery-toolbar{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-bottom: clamp(18px, 3vw, 30px);
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(58,29,22,0.10);
}

.lp-gallery-toolbar-title{
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.05;
  color: var(--lp-bg-dark);
}

.lp-gallery-current{
  margin: 6px 0 0;
  color: rgba(42,37,33,0.64);
  font-size: 14px;
}

.lp-gallery-current strong{
  color: var(--lp-red);
  font-weight: 600;
}

.lp-gallery-filter{
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.lp-gallery-filter-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border: 1px solid rgba(58,29,22,0.16);
  background: rgba(247,244,238,0.70);
  color: var(--lp-bg-dark);
  text-decoration: none;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.lp-gallery-filter-link:hover,
.lp-gallery-filter-link:focus{
  background: rgba(58,29,22,0.07);
  color: var(--lp-bg-dark);
  border-color: rgba(58,29,22,0.26);
  transform: translateY(-1px);
}

.lp-gallery-filter-link.is-active{
  background: var(--lp-bg-dark);
  color: var(--lp-cream);
  border-color: var(--lp-bg-dark);
}

.lp-gallery-empty{
  margin: 0;
  padding: clamp(24px, 4vw, 42px);
  border: 1px dashed rgba(58,29,22,0.22);
  background: rgba(247,244,238,0.62);
  color: rgba(42,37,33,0.70);
  text-align: center;
}

.lp-gallery-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 20px);
}

.lp-gallery-item{
  min-width: 0;
}

.g-card.lp-gallery-card{
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid rgba(58,29,22,0.14);
  background: #fffaf1;
  padding: 8px;
  box-shadow: 0 12px 26px rgba(58,29,22,0.08);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.g-card.lp-gallery-card::before{
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.38);
  box-shadow: inset 0 0 0 1px rgba(58,29,22,0.08);
}

.g-card.lp-gallery-card::after{
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 42%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(34,14,7,0.34));
  opacity: 0;
  transition: opacity .22s ease;
}

.g-card.lp-gallery-card:hover,
.g-card.lp-gallery-card:focus{
  transform: translateY(-4px);
  box-shadow: 0 18px 34px rgba(58,29,22,0.13);
  border-color: rgba(217,101,22,0.38);
}

.g-card.lp-gallery-card:hover::after,
.g-card.lp-gallery-card:focus::after{
  opacity: 1;
}

.lp-gallery-img-wrap{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(58,29,22,0.06);
}

.g-img.lp-gallery-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.001);
  transition: transform .35s ease, filter .35s ease;
}

.g-card.lp-gallery-card:hover .g-img.lp-gallery-img,
.g-card.lp-gallery-card:focus .g-img.lp-gallery-img{
  transform: scale(1.045);
  filter: saturate(1.04) contrast(1.02);
}

.lp-gallery-caption{
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
  color: var(--lp-cream);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}

.g-card.lp-gallery-card:hover .lp-gallery-caption,
.g-card.lp-gallery-card:focus .lp-gallery-caption{
  opacity: 1;
  transform: translateY(0);
}

.lp-gallery-caption-title{
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  line-height: 1.05;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.lp-gallery-caption-folder{
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 8px;
  background: rgba(247,244,238,0.16);
  border: 1px solid rgba(247,244,238,0.24);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

/* ---------- Lightbox ---------- */
.lb{
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(217,101,22,0.18), transparent 32%),
    rgba(18,8,4,0.92);
  display: none;
  z-index: 2000;
}

.lb.show{ display: block; }

.lb-inner{
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.lb-top{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 2vw, 18px) clamp(14px, 3vw, 28px);
  color: var(--lp-cream);
}

.lb-title{
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.1;
  max-width: 70vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-close,
.lb-nav{
  border: 1px solid rgba(247,244,238,0.18);
  background: rgba(247,244,238,0.10);
  color: var(--lp-cream);
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background-color .18s ease, transform .18s ease, border-color .18s ease;
}

.lb-close{
  width: 46px;
  height: 46px;
  border-radius: 999px;
  font-size: 1.5rem;
}

.lb-close:hover,
.lb-nav:hover{
  background: rgba(247,244,238,0.18);
  border-color: rgba(247,244,238,0.32);
  transform: translateY(-1px);
}

.lb-stage{
  flex: 1;
  position: relative;
  padding: 1rem;
  touch-action: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img{
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border: 8px solid rgba(247,244,238,0.88);
  box-shadow: 0 1.2rem 3rem rgba(0,0,0,0.46);
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
}

.lb-img.is-zoomable{ cursor: grab; }
.lb-img.is-zoomable:active{ cursor: grabbing; }

.lb-nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 999px;
  font-size: 1.5rem;
  z-index: 5;
}

.lb-nav:hover{ transform: translateY(-50%) translateY(-1px); }
.lb-prev{ left: 18px; }
.lb-next{ right: 18px; }

.lb-bottom{
  padding: 0.5rem 1rem 1.2rem;
  color: rgba(247,244,238,0.84);
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lb-pill{
  background: rgba(247,244,238,0.10);
  border: 1px solid rgba(247,244,238,0.14);
  border-radius: 999px;
  padding: 0.32rem 0.72rem;
}

@media (max-width: 991.98px){
  .lp-gallery-toolbar{
    grid-template-columns: 1fr;
    align-items: start;
  }

  .lp-gallery-filter{
    justify-content: flex-start;
  }

  .lp-gallery-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px){
  .lp-gallery-page{
    padding-top: 32px;
  }

  .lp-gallery-shell{
    padding: 16px;
  }

  .lp-gallery-shell::before,
  .lp-gallery-shell::after{
    display: none;
  }

  .lp-gallery-filter{
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .lp-gallery-filter-link{
    flex: 0 0 auto;
  }

  .lp-gallery-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .g-card.lp-gallery-card{
    padding: 6px;
  }

  .g-card.lp-gallery-card::before{
    inset: 6px;
  }

  .g-card.lp-gallery-card::after,
  .lp-gallery-caption{
    display: none;
  }

  .lb-img{
    max-height: 76vh;
    border-width: 5px;
  }

  .lb-close{
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
  }

  .lb-prev{ left: 10px; }
  .lb-next{ right: 10px; }
}
