.gw-wrap { --gw-gap: 14px; margin: 1.5em 0; }
.gw-wrap, .gw-wrap * { box-sizing: border-box; }
.gw-msg { opacity: .7; }

/* Testata della galleria: titolo ben leggibile, indipendente dal tema */
.gw-wrap .gw-back { margin: 0 0 14px; font-size: 15px; }
.gw-wrap .gw-back a { text-decoration: none; font-weight: 600; }
.gw-wrap .gw-head { margin: 0 0 22px; padding: 0 0 14px; border-bottom: 2px solid rgba(128,128,128,.25); }
.gw-wrap .gw-head .gw-title {
    margin: 0 0 6px; padding: 0;
    font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.15; font-weight: 700;
    text-transform: none; letter-spacing: 0; color: inherit;
}
.gw-wrap .gw-head .gw-sub { margin: 0 0 6px; font-size: 1.1rem; line-height: 1.4; opacity: .85; }
.gw-wrap .gw-head .gw-meta { margin: 0; font-size: .9rem; opacity: .6; }

.gw-grid {
    display: grid;
    grid-template-columns: repeat(var(--gw-cols, 4), 1fr);
    gap: var(--gw-gap);
}
@media (max-width: 900px) { .gw-grid { grid-template-columns: repeat(min(var(--gw-cols, 4), 3), 1fr); } }
@media (max-width: 600px) { .gw-grid { grid-template-columns: repeat(2, 1fr); } }

/* Niente trascinamento / salvataggio rapido delle immagini */
.gw-wrap img, .gw-lb-img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Foto */
.gw-item { position: relative; margin: 0; overflow: hidden; border-radius: 6px; background: #eee; aspect-ratio: 1 / 1; }
.gw-item .gw-link, .gw-item img { display: block; width: 100%; height: 100%; }
.gw-item img { object-fit: cover; transition: transform .3s ease; }
.gw-item:hover img { transform: scale(1.04); }
.gw-dl {
    position: absolute; right: 8px; bottom: 8px;
    width: 36px; height: 36px; line-height: 36px; text-align: center;
    border-radius: 50%; background: rgba(0,0,0,.65); color: #fff !important;
    font-size: 20px; text-decoration: none !important;
    opacity: 0; transition: opacity .2s ease;
}
.gw-item:hover .gw-dl, .gw-dl:focus { opacity: 1; }
@media (hover: none) { .gw-dl { opacity: 1; } }

/* Elenco gallerie: scheda con immagine e titolo SOTTO, su fondo pieno (sempre leggibile) */
.gw-wrap a.gw-album {
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 8px; background: #fff; color: #1d2327 !important;
    border: 1px solid rgba(0,0,0,.12); box-shadow: 0 1px 4px rgba(0,0,0,.08);
    text-decoration: none !important; transition: box-shadow .2s ease, transform .2s ease;
}
.gw-wrap a.gw-album:hover { box-shadow: 0 6px 18px rgba(0,0,0,.18); transform: translateY(-2px); }
.gw-album-thumb { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #ddd; }
.gw-album-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.gw-wrap a.gw-album:hover .gw-album-thumb img { transform: scale(1.05); }
.gw-album-info { display: block; padding: 12px 14px 14px; }
.gw-wrap .gw-album-name {
    display: block; font-size: 1.15rem; line-height: 1.25; font-weight: 700;
    color: #1d2327; text-transform: none; letter-spacing: 0; margin: 0 0 4px;
}
.gw-wrap .gw-album-sub { display: block; font-size: .95rem; line-height: 1.35; color: #3c434a; margin: 0 0 6px; }
.gw-wrap .gw-album-count { display: block; font-size: .85rem; color: #646970; }

/* Visualizzatore */
.gw-lb { position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; }
.gw-lb.open { display: flex; }
.gw-lb-img { position: absolute; inset: 64px 64px 24px; background-repeat: no-repeat; background-position: center; background-size: contain; }
@media (max-width: 600px) { .gw-lb-img { inset: 64px 8px 16px; } }
.gw-lb button, .gw-lb a.gw-lb-dl {
    position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0;
    width: 44px; height: 44px; border-radius: 50%; font-size: 24px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.gw-lb button:hover, .gw-lb a.gw-lb-dl:hover { background: rgba(255,255,255,.28); }
.gw-lb-close { top: 8px; right: 12px; }
.gw-lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.gw-lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.gw-lb a.gw-lb-dl { top: 8px; right: 64px; width: auto; border-radius: 22px; padding: 0 18px; font-size: 15px; font-weight: 600; background: #fff; color: #111 !important; white-space: nowrap; }
.gw-lb a.gw-lb-dl:hover { background: #e6e6e6; }
.gw-lb-count { position: absolute; top: 14px; left: 16px; right: 190px; color: #fff; font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-lb-count strong { font-weight: 700; }
.gw-lb-count span { opacity: .75; margin-left: 8px; }

/* Nome del fotografo accanto al titolo */
.gw-wrap .gw-by { font-weight: 400; font-size: .62em; opacity: .7; white-space: nowrap; }
.gw-wrap .gw-album-name .gw-by { font-size: .78em; }

/* Barra di ordinamento e filtri */
.gw-wrap .gw-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; align-items: center; }
.gw-wrap .gw-toolbar input, .gw-wrap .gw-toolbar select {
    font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid rgba(128,128,128,.45);
    border-radius: 8px; background: #fff; color: #1d2327; min-height: 40px; max-width: 100%;
}
.gw-wrap .gw-toolbar .gw-search { flex: 1 1 200px; min-width: 160px; }
.gw-wrap .gw-grid [hidden], .gw-wrap [hidden] { display: none !important; }

/* Contatore di download sulla foto */
.gw-item .gw-count {
    position: absolute; left: 8px; bottom: 8px; padding: 3px 9px; border-radius: 12px;
    background: rgba(0,0,0,.62); color: #fff; font-size: 12px; line-height: 1.4; pointer-events: none;
}
