/* ============ Galleria Peirano — album e lightbox ============ */

.g-main { padding-top: 120px; min-height: 70vh; }
.g-title { font-size: clamp(2.2rem, 5vw, 3.8rem); color: var(--ink); }
.g-title em { font-style: italic; color: var(--leaf); }
.g-sub { color: var(--soft); font-size: 1.02rem; max-width: 60ch; margin: 14px 0 0; }
.g-note {
  display: inline-block; margin-top: 18px; font-size: .8rem; font-weight: 600;
  color: var(--acc); border: 1px dashed var(--acc); border-radius: 999px; padding: 7px 15px;
  opacity: .85;
}
.nav-links a.active { opacity: 1; border-bottom: 2px solid var(--gold); padding-bottom: 3px; }

/* ---- ricerca nella galleria ---- */
.g-search { position: relative; margin-top: 28px; max-width: 540px; }
.g-search svg {
  position: absolute; left: 17px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--soft); pointer-events: none;
}
.g-search input {
  width: 100%; padding: 14px 20px 14px 47px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 500 1rem var(--sans); outline: none;
  transition: border-color .2s, box-shadow .25s;
}
.g-search input::placeholder { color: var(--soft); opacity: .75; }
.g-search input:focus { border-color: var(--leaf); box-shadow: var(--shadow); }
.g-results-info { margin-top: 14px; font: 600 .86rem var(--sans); color: var(--soft); }

/* risultati foto (dai tag delle singole immagini) */
.g-photo-results { padding-bottom: 90px; }
.g-pr-title {
  font-size: 1.4rem; color: var(--ink); margin: 6px 0 18px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.g-ph { position: relative; }
.g-ph-album {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  background: rgba(8,16,10,.6); color: #fff; backdrop-filter: blur(4px);
  font: 600 .72rem var(--sans); border-radius: 999px; padding: 4px 10px;
  pointer-events: none;
}
.g-masonry .g-ph > .g-ph-album { opacity: 0; transition: opacity .25s; }
#gprGrid .g-ph > .g-ph-album { opacity: 1; }

/* ---- griglia album ---- */
.g-albums {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px; margin-top: 44px; padding-bottom: 90px;
}
.g-card {
  position: relative; border: 0; padding: 0; cursor: pointer; text-align: left;
  border-radius: var(--r); overflow: hidden; aspect-ratio: 4/3; background: var(--bg-2);
  box-shadow: var(--shadow); transform: translateY(0);
  transition: transform .3s var(--ease), box-shadow .3s;
}
.g-card:hover { transform: translateY(-5px); }
.g-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s var(--ease);
}
.g-card:hover img { transform: scale(1.06); }
.g-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(185deg, rgba(8,16,10,0) 40%, rgba(8,16,10,.82) 100%);
}
.g-card-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px; z-index: 2; color: #fff; }
.g-card-body h3 { font-size: 1.35rem; font-weight: 460; line-height: 1.1; }
.g-card-body span { font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.g-card-n {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  background: rgba(8,16,10,.5); color: #fff; backdrop-filter: blur(5px);
  font: 700 .72rem var(--sans); border-radius: 999px; padding: 5px 11px;
}

/* album "grande" (in evidenza) */
.g-card.big { grid-column: span 2; aspect-ratio: auto; min-height: 300px; }
@media (max-width: 640px) { .g-card.big { grid-column: span 1; } }

/* ---- pulsante "Tutti gli album" ---- */
.detail-back {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 .9rem var(--sans); cursor: pointer;
  padding: 11px 20px 11px 15px; border-radius: 999px;
  margin-bottom: 28px;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s;
}
.detail-back svg { width: 17px; height: 17px; flex: none; transition: transform .25s var(--ease); }
.detail-back:hover {
  border-color: var(--leaf); transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.detail-back:hover svg { transform: translateX(-3px); }

/* ---- vista album: masonry ---- */
.g-album-head { margin-bottom: 30px; }
.g-masonry { columns: 3 300px; column-gap: 14px; padding-bottom: 90px; }
.g-ph {
  display: block; width: 100%; margin: 0 0 14px; border: 0; padding: 0; cursor: zoom-in;
  border-radius: 14px; overflow: hidden; background: var(--bg-2);
  break-inside: avoid; box-shadow: var(--shadow);
}
.g-ph img {
  display: block; width: 100%; height: auto;
  transition: transform .6s var(--ease), opacity .5s;
}
.g-ph:hover img { transform: scale(1.04); }

/* ---- lightbox ---- */
.lb { position: fixed; inset: 0; z-index: 95; background: rgba(6, 10, 7, .96); backdrop-filter: blur(8px); }
.lb:not([hidden]) { display: flex; align-items: center; justify-content: center; animation: lbIn .2s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-fig { margin: 0; max-width: min(92vw, 1400px); max-height: 86vh; position: relative; }
.lb-fig img {
  max-width: 100%; max-height: 86vh; display: block; border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lb-close {
  position: absolute; top: 18px; right: 22px; z-index: 3;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.1); color: #fff; font-size: 26px; line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.22); }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.1); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.lb-prev { left: 20px; } .lb-next { right: 20px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.25); }
.lb-prev svg, .lb-next svg { width: 24px; height: 24px; }
.lb-meta {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center; color: rgba(255,255,255,.85);
  font: 600 .84rem var(--sans); background: rgba(255,255,255,.08);
  border-radius: 999px; padding: 8px 18px; backdrop-filter: blur(6px);
}
.lb-meta #lbAlbum { font-family: var(--serif); font-style: italic; font-size: 1rem; }

/* ---- piante riconosciute (overlay attivabile) ---- */
.lb-plants {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff;
  font: 700 .8rem var(--sans); border-radius: 999px; padding: 7px 14px;
  transition: background .2s;
}
.lb-plants svg { width: 15px; height: 15px; }
.lb-plants:hover { background: rgba(255,255,255,.28); }
.lb-plants[aria-pressed="true"] { background: #3f7d4c; }
.lb-marks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.lb-mark {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 7px; pointer-events: auto;
  background: rgba(8,16,10,.78); backdrop-filter: blur(5px); color: #fff;
  text-decoration: none; font: 600 .78rem var(--sans); white-space: nowrap;
  padding: 6px 11px 6px 8px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  animation: markIn .3s var(--ease) backwards;
}
.lb-mark:nth-child(2) { animation-delay: .06s; }
.lb-mark:nth-child(3) { animation-delay: .12s; }
.lb-mark:nth-child(4) { animation-delay: .18s; }
.lb-mark:nth-child(5) { animation-delay: .24s; }
@keyframes markIn { from { opacity: 0; transform: translate(-50%, -30%); } }
.lb-mark em { font-style: italic; font-weight: 400; opacity: .75; }
a.lb-mark:hover { background: #3f7d4c; border-color: rgba(255,255,255,.55); }
/* pianta confermata dal riconoscitore Peirano */
.lb-mark.ok { border-color: rgba(143,209,154,.7); }
.lb-mark.ok .lb-mark-dot { background: #6fe08a; box-shadow: 0 0 0 3px rgba(111,224,138,.35); }
.lb-mark-ok {
  font-style: normal; font-weight: 800; color: #6fe08a; margin-left: 1px;
  font-size: .8em; cursor: help;
}
.lb-mark-pct {
  font-weight: 700; font-size: .82em; color: #0e1b12; background: #6fe08a;
  border-radius: 999px; padding: 1px 7px; margin-left: 2px; cursor: help;
  font-variant-numeric: tabular-nums;
}
.lb-mark-dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%;
  background: #8fd19a; box-shadow: 0 0 0 3px rgba(143,209,154,.3);
}
@media (max-width: 640px) {
  .lb-mark { font-size: .68rem; padding: 4px 8px 4px 6px; }
  .lb-mark em { display: none; }
}

@media (max-width: 640px) {
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
  .lb-prev, .lb-next { width: 42px; height: 42px; }
  .g-masonry { columns: 2 150px; }
}
