/* =========================================================================
   Chiesa di Pandino — Pagina "Album" (album fotografico singolo)
   Stili specifici di questa pagina. I token :root sono definiti in style.css.
   Riproduce il design Album.dc.html: testata album + galleria masonry +
   lightbox a schermo intero.
   ========================================================================= */

/* ---- Testata album ---------------------------------------------------- */
.album-head {
  background: linear-gradient(180deg, #fbeede 0%, var(--bg) 100%);
  border-bottom: 1px solid rgba(38, 48, 58, 0.06);
}
.album-head .container {
  padding-top: 34px;
  padding-bottom: 40px;
}

.album-head__back {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.album-head__back:hover { text-decoration: underline; }

.album-head__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.album-head__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.album-head__badge {
  background: #fbefe2;
  color: var(--accent);
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.album-head__period {
  font-size: 13.5px;
  color: var(--muted-2);
  font-weight: 600;
}
.album-head__title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(34px, 6vw, 46px);
  line-height: 1.04;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.album-head__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.album-pill {
  padding: 11px 18px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}
.album-pill--count {
  background: var(--surface);
  border: 1px solid rgba(38, 48, 58, 0.12);
  color: var(--text);
}
.album-pill--download {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
}
.album-pill--download:hover { background: #9c521a; transform: translateY(-1px); }

/* ---- Galleria masonry ------------------------------------------------- */
.album-gallery .container {
  padding-top: 40px;
  padding-bottom: 8px;
}

.masonry {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 14px;
}
.masonry__item { grid-column: span 1; grid-row: span 1; }
/* Tasselli di dimensioni diverse (mosaico), ripetuti ogni 6 elementi */
.masonry__item:nth-child(6n+1) { grid-column: span 2; grid-row: span 2; } /* grande */
.masonry__item:nth-child(6n+3) { grid-row: span 2; }                      /* alto */
.masonry__item:nth-child(6n+5) { grid-column: span 2; }                   /* largo */

/* Placeholder a righe nello stile del design ([ foto ]) */
.thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--muted);
  padding: 0;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.thumb:hover,
.thumb:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 16px 36px rgba(31, 41, 51, 0.18);
}
/* Quando si inserisce una foto reale: <img> dentro .thumb riempie il tassello */
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Varianti colore delle copertine (dal design) */
.thumb--blue {
  background:
    repeating-linear-gradient(45deg, rgba(31,41,51,.05) 0 12px, rgba(31,41,51,.08) 12px 24px),
    #cdd8e2;
}
.thumb--accent {
  background:
    repeating-linear-gradient(45deg, rgba(181,100,31,.07) 0 12px, rgba(181,100,31,.12) 12px 24px),
    #ecd9c4;
}
.thumb--teal {
  background:
    repeating-linear-gradient(45deg, rgba(43,163,154,.07) 0 12px, rgba(43,163,154,.12) 12px 24px),
    #d6ece9;
}
.thumb--sand {
  background:
    repeating-linear-gradient(45deg, rgba(31,41,51,.05) 0 12px, rgba(31,41,51,.08) 12px 24px),
    #d8cdbb;
}
.thumb--gold {
  background:
    repeating-linear-gradient(45deg, rgba(242,169,59,.1) 0 12px, rgba(242,169,59,.16) 12px 24px),
    #f5e6c8;
}

/* Animazione di comparsa (rispettata da prefers-reduced-motion in style.css) */
@keyframes albumFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.masonry__item:not([hidden]) {
  animation: albumFadeUp 0.55s ease both;
}

/* ---- "Carica altre foto" --------------------------------------------- */
.album-more {
  display: flex;
  justify-content: center;
  padding: 30px 0 64px;
}
.album-more__btn {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid rgba(47, 93, 134, 0.3);
  font-weight: 700;
  font-size: 15px;
  padding: 14px 30px;
}
.album-more__btn:hover { background: var(--primary-tint); }
.album-more[hidden] { display: none; }

/* ---- Lightbox a schermo intero --------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 22, 30, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  /* Tap ravvicinati su ‹ › non devono zoomare la pagina (double-tap zoom
     mobile) né selezionare contenuti coi doppi click da desktop. */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.lightbox button { touch-action: manipulation; }
.lightbox[hidden] { display: none; }

.lightbox__counter {
  position: absolute;
  top: 24px;
  left: 32px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.lightbox__close {
  position: absolute;
  top: 18px;
  right: 28px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox__stage {
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 1100px;
  width: 100%;
}
.lightbox__nav {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox__photo {
  flex: 1;
  height: 74vh;
  border-radius: 16px;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 12px, rgba(255,255,255,.07) 12px 24px),
    #2a3742;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  animation: albumLbIn 0.3s ease;
}
@keyframes albumLbIn {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* Varianti di copertina riflesse nel lightbox (impostate via JS) */
.lb-cover--blue {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 12px, rgba(255,255,255,.07) 12px 24px),
    #3a4a59;
}
.lb-cover--accent {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, rgba(255,255,255,.09) 12px 24px),
    #5c3a16;
}
.lb-cover--teal {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, rgba(255,255,255,.09) 12px 24px),
    #1f4a47;
}
.lb-cover--sand {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 12px, rgba(255,255,255,.07) 12px 24px),
    #4a4234;
}
.lb-cover--gold {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 12px, rgba(255,255,255,.09) 12px 24px),
    #5c4a1e;
}

.lightbox__caption {
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1023px) {
  .masonry { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 180px; }
}

@media (max-width: 620px) {
  .album-head .container { padding-top: 28px; padding-bottom: 32px; }
  .album-head__row { align-items: flex-start; }
  .album-head__actions { width: 100%; }
  .masonry { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; gap: 10px; }
  .lightbox { padding: 16px; }
  .lightbox__counter { left: 18px; top: 16px; }
  .lightbox__close { top: 12px; right: 16px; }
  .lightbox__stage { gap: 10px; }
  .lightbox__nav { width: 44px; height: 44px; font-size: 20px; }
  .lightbox__photo { height: 64vh; }
}
