/* Gallerie: viaggi (cartina, pagine, gestione) e i miei momenti. Caricato dopo lista.css. */

/* ---------- foto di viaggio ---------- */

/* ---------- galleria momenti ---------- */
.gallery { columns: 2; column-gap: 12px; }
@media (min-width: 760px) { .gallery { columns: 4; column-gap: 16px; } }
.moment {
  break-inside: avoid; margin: 0 0 12px; border-radius: 16px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
}
@media (min-width: 760px) { .moment { margin-bottom: 16px; } }
.moment img { display: block; width: 100%; height: auto; transition: transform .3s ease; }
.moment:hover img { transform: scale(1.03); }
.moment figcaption { padding: 8px 12px 10px; font-size: .85rem; color: var(--muted); }

/* ---------- cartina dei viaggi ---------- */
.viaggi-testa { margin-bottom: 4px; }
.viaggi-testa h1 { margin-bottom: 4px; }
.section.map-page { padding-top: 4px; }
.map-comandi { display: flex; margin-bottom: 10px; }
/* pulsanti a destra; se non ci stanno si scorrono (il margine automatico sparisce quando non c'è spazio) */
.map-zoom { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; overflow-x: auto; scrollbar-width: none;
  flex: 1 1 100%; max-width: 100%; padding: 2px 0 6px; }
.map-zoom > :first-child { margin-left: auto; }
.map-zoom::-webkit-scrollbar { display: none; }
/* continenti in primo piano; i loro stati (e le regioni d'Italia) scorrono fuori alla loro destra (viaggi_zone.js) */
.zg, .zg-stati { display: inline-flex; gap: 6px; align-items: center; flex: none; }
.zg-stati { max-width: 0; overflow: hidden; opacity: 0; transition: max-width .5s cubic-bezier(.2, .8, .2, 1), opacity .35s ease; }
.zg-stati.aperta { opacity: 1; }
.map-zoom .chip.cont { font-weight: 800; color: var(--gold); border: 1.5px solid var(--gold); background: rgba(214, 173, 82, .1); }
.map-zoom .chip.cont.aperto { background: var(--gold); color: var(--gold-ink); box-shadow: 0 4px 14px rgba(214, 173, 82, .3); }
.map-zoom .chip.stato { font-size: .82rem; padding: 5px 11px; color: var(--muted); border-color: var(--line); background: var(--surface); }
.map-zoom .chip.regione { font-size: .76rem; padding: 4px 10px; color: var(--muted); border: 1px dashed var(--line); background: transparent; }
.map-zoom .chip.stato.on, .map-zoom .chip.regione.on { color: var(--ink); border-color: var(--emerald); background: rgba(47, 163, 111, .18); font-weight: 700; }
.map-zoom .chip.cont.on { box-shadow: 0 0 0 2px rgba(214, 173, 82, .45); }
.travel-map {
  position: relative; border-radius: 24px; overflow: hidden; max-width: 100%;
  background: radial-gradient(120% 120% at 50% 0%, rgba(23, 48, 39, .9), rgba(11, 22, 18, .95));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.map-svg { display: block; width: 100%; height: auto; aspect-ratio: 960 / 500; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .9rem; padding: 16px; text-align: center; }
.travel-map.map-ready .map-loading { display: none; }
.travel-map.map-failed .map-svg { display: none; }
.travel-map.map-failed .map-loading { position: static; padding: 28px 16px; }
.map-sphere { fill: rgba(47, 163, 111, .05); stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.map-graticule { fill: none; stroke: rgba(214, 173, 82, .07); stroke-width: .5; vector-effect: non-scaling-stroke; }
.map-country { fill: #1d3a30; transition: fill .3s ease; }
.map-country:hover { fill: #24473b; }
.map-country.visited { fill: rgba(214, 173, 82, .35); }
.map-borders { fill: none; stroke: rgba(11, 22, 18, .9); stroke-width: .6; vector-effect: non-scaling-stroke; }
.map-pin { cursor: pointer; outline: none; }
.pin-dot { fill: var(--gold); stroke: var(--bg); stroke-width: 2; }
.pin-ring { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: .7; transform-box: fill-box; transform-origin: center; animation: pin-pulse 2.4s ease-out infinite; }
.map-pin.active .pin-dot, .map-pin:focus-visible .pin-dot { fill: var(--red); }
.map-pin.pop .pin-dot { animation: pin-pop .5s cubic-bezier(.3, 1.6, .5, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes pin-pulse { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes pin-pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.map-card {
  position: absolute; z-index: 3; width: 220px; border-radius: 16px; overflow: hidden; text-decoration: none;
  background: var(--surface); border: 1px solid var(--gold); box-shadow: var(--shadow); color: var(--ink);
  animation: card-in .2s ease-out;
}
.map-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.map-card-body { display: grid; gap: 2px; padding: 10px 12px 12px; }
.map-card-place { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--emerald); }
.map-card-name { font-family: var(--font-display); font-size: 1.25rem; }
.map-card-go { font-size: .85rem; color: var(--gold); }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pin-ring, .map-card { animation: none; } }

/* ---------- pagina di un viaggio ---------- */
.trip-hero { position: relative; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); margin-bottom: 24px; aspect-ratio: 16 / 9; max-width: 100%; }
@media (min-width: 760px) { .trip-hero { aspect-ratio: 21 / 8; } }
.trip-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trip-hero-text { position: absolute; inset: auto 0 0 0; padding: 48px 20px 20px; background: linear-gradient(to top, rgba(11, 22, 18, .95), rgba(11, 22, 18, 0)); }
.trip-hero-text h1 { margin: 2px 0 0; }
.back { display: inline-flex; gap: 6px; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--gold); }
.moment button { all: unset; display: block; cursor: zoom-in; }
.map-country-outlined { stroke: rgba(11, 22, 18, .9); stroke-width: .6; vector-effect: non-scaling-stroke; }

/* ---------- link nelle passioni e pagina viaggi ---------- */
.passion-link { margin-top: 4px; font-size: .9rem; font-weight: 700; color: var(--gold); text-decoration: none; }
.passion-link:hover { color: var(--ink); }
.map-page .section-head { align-items: center; }
.trip-card {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); transition: transform .18s ease, border-color .18s ease;
}
.trip-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.trip-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.trip-card-body { display: grid; gap: 2px; padding: 10px 14px 14px; }
.trip-card-name { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }

/* ---------- i miei momenti ---------- */
a.passion { text-decoration: none; color: var(--ink); transition: transform .18s ease, border-color .18s ease; }
a.passion:hover { transform: translateY(-3px); border-color: var(--gold); }
.moments-featured { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .moments-featured.count-2 { grid-template-columns: 1fr 1fr; }
  .moments-featured.count-many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .moments-featured.count-1 .moment-big { max-width: 760px; margin: 0 auto; }
}
.moment-big { border-color: var(--gold); }
.moment-big .moment-open img { max-height: 70vh; width: 100%; object-fit: cover; }
.moment-open { all: unset; display: block; cursor: zoom-in; width: 100%; }
.moment-open:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.moment-open img { display: block; width: 100%; height: auto; }
.moment figcaption { display: grid; gap: 2px; }
.moment-title { color: var(--ink); font-weight: 600; }
.moment-meta { font-size: .8rem; color: var(--muted); }
.year-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.year-head h2 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.2rem); color: var(--gold); }
/* ---------- foto a schermo intero (static/js/foto.js): si apre dalla miniatura e ci torna ---------- */
.fz { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.fz.aperta { pointer-events: auto; }
.fz-fondo { position: absolute; inset: 0; background: rgba(3, 8, 6, .94); backdrop-filter: blur(4px); opacity: 0; transition: opacity .32s ease; }
.fz.aperta .fz-fondo { opacity: 1; }
.fz-img { position: fixed; display: block; object-fit: cover; transform-origin: center; border-radius: 0; background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6); transition: transform .32s cubic-bezier(.2, .8, .2, 1), clip-path .32s cubic-bezier(.2, .8, .2, 1), opacity .32s ease; }
.fz-img:not([src]) { display: none; }
.fz-x, .fz-freccia, .fz-sotto { opacity: 0; transition: opacity .25s ease; }
.fz.aperta .fz-x, .fz.aperta .fz-freccia, .fz.aperta .fz-sotto { opacity: 1; transition-delay: .12s; }
.fz-x { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(11, 22, 18, .8); color: var(--ink); font-size: 1rem; cursor: pointer; }
.fz-freccia { position: fixed; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(11, 22, 18, .7); color: var(--ink); font-size: 1.7rem; line-height: 1; cursor: pointer; }
.fz-freccia:hover, .fz-x:hover { border-color: var(--gold); color: var(--gold); }
.fz-freccia.sx { left: 10px; } .fz-freccia.dx { right: 10px; }
.fz-freccia[hidden] { display: none; }
.fz-sotto { position: fixed; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; gap: 8px;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.fz-dida { margin: 0; display: grid; gap: 2px; }
.fz-dida span { color: var(--muted); font-size: .9rem; }
.fz-scarica { padding: 6px 16px; font-size: .88rem; }
html.fz-blocca, html.fz-blocca body { overflow: hidden; }
[data-foto] { cursor: zoom-in; }

/* ---------- gestione momenti ---------- */
.upload-form { gap: 14px; }
.upload-drop {
  display: grid !important; justify-items: center; gap: 6px; padding: 22px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 14px; background: var(--bg);
}
.upload-drop:hover, .upload-drop:focus-within { border-color: var(--gold); }
.upload-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-cta { display: inline-block; padding: 10px 18px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-weight: 800; }
.upload-fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .upload-fields { grid-template-columns: 1fr 1fr 200px; } }
.upload-drop { position: relative; }
.moments-admin { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.m-item { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; min-width: 0; }
.m-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.m-star { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: var(--gold); color: var(--gold-ink); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.m-form { padding: 12px; margin: 0; gap: 10px; }
.m-actions { gap: 8px; }
.m-frecce { display: flex; justify-content: center; gap: 10px; }
.btn.icon { padding: 9px 13px; }
.moments-featured { align-items: start; }
.moment-big .moment-open { background: #000; }
.moment-big .moment-open img { max-height: 72vh; object-fit: contain; }

/* ---------- gestione viaggi ---------- */
textarea { width: 100%; resize: vertical; min-height: 64px; }
.panel + .panel { margin-top: 16px; }
.panel-title { font-size: 1.1rem; margin: 0 0 12px; }
.trip-admin-list { display: grid; gap: 10px; }
.trip-admin { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.trip-admin-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.trip-admin-main .prod-thumb { background: var(--bg); flex: none; }
.trip-admin-main .prod-thumb img { object-fit: cover; }
.trip-admin-main .prod-main { min-width: 0; display: grid; gap: 4px; }
.trip-admin-main .prod-name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-admin-main .prod-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.trip-admin-main .dash-tile-go { position: static; color: var(--gold); }
.trip-admin-order { display: flex; gap: 4px; margin: 0; }
.map-status { display: grid; gap: 6px; }
.map-status p { margin: 0; }
.coords summary { cursor: pointer; }
.coords .two { margin-top: 8px; }
.trip-desc { max-width: 70ch; color: var(--muted); margin: -8px 0 20px; white-space: pre-line; }

.card-body h3 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.full-name { font-weight: 400; overflow-wrap: anywhere; }

/* ---------- progetti: pagina pubblica e gestione ---------- */
.prog-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.prog-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; border-top: 4px solid var(--line); }
.prog-foto { display: block; width: 100%; padding: 0; border: 0; background: none; }
.prog-card img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.prog-corpo { padding: 14px 16px 16px; display: grid; gap: 6px; }
.prog-corpo h3 { margin: 0; font-size: 1.2rem; }
.prog-corpo p { margin: 0; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.prog-stato { justify-self: start; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.stato-in_corso { border-top-color: var(--gold); } .stato-in_corso .prog-stato, .prog-stato.stato-in_corso { background: var(--gold); color: var(--gold-ink); }
.stato-realizzato { border-top-color: #3fae7a; } .stato-realizzato .prog-stato, .prog-stato.stato-realizzato { background: #3fae7a; color: #06170f; }
.stato-idea { border-top-color: #6fa3d8; } .stato-idea .prog-stato, .prog-stato.stato-idea { background: #6fa3d8; color: #08121d; }
.prog-admin { display: grid; gap: 10px; }
.prog-admin .tendina > summary .prog-stato { margin-left: auto; }
.prog-admin .tendina > summary::after { margin-left: 10px; }
.prog-anteprima { width: 160px; border-radius: 12px; }

/* ---------- I nostri momenti (griglia e gestione) ---------- */
.nostri-griglia { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .nostri-griglia { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 960px) { .nostri-griglia { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.nostri-foto { position: relative; display: block; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); }
.nostri-foto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.nostri-foto:hover img { transform: scale(1.04); }
.nostri-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px; font-size: .8rem; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .7)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* dashboard */
.nostri-admin { display: grid; gap: 8px; }
.nostri-voce summary { display: flex; align-items: center; gap: 12px; }
.nostri-voce summary img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; flex: none; }
.nostri-voce .tendina-t { display: grid; min-width: 0; }
.nostri-voce .tendina-t > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nostri-voce .tendina-t > span { font-family: var(--font-body); font-weight: 500; }

/* ---------- pagine create dalla dashboard (/p/…) ---------- */
.pc-testa { text-align: center; }
.pc-icona { font-size: 2.6rem; line-height: 1; }
.pc-testo { max-width: 720px; margin: 0 auto 28px; font-size: 1.05rem; }
.pc-testo h2 { margin: 26px 0 10px; }
.pc-testo p { margin: 0 0 14px; }
.pc-testo ul { margin: 0 0 14px; padding-left: 22px; }
.pc-testo a { overflow-wrap: anywhere; }
.pc-avviso { max-width: 720px; margin: 0 auto 18px; }

/* ---------- gestione viaggio: scelta del punto sulla cartina tra le posizioni delle foto ---------- */
.pos-mappa { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); margin: 6px 0 12px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(23, 48, 39, .9), rgba(11, 22, 18, .95)); }
.pos-mappa svg { display: block; width: 100%; height: auto; aspect-ratio: 600 / 340; }
.pos-mappa-msg { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; text-align: center; padding: 12px; }
.pos-paese { fill: #1d3a30; stroke: var(--line); stroke-width: .6; }
.pos-pin .anello { fill: none; stroke-width: 2; }
.pos-pin.ora .punto { fill: var(--gold); } .pos-pin.ora .anello { stroke: var(--gold); }
.pos-pin.nuovo .punto { fill: #57c48a; } .pos-pin.nuovo .anello { stroke: #57c48a; animation: pos-pulsa 1.2s ease-out infinite; }
@keyframes pos-pulsa { from { r: 6; opacity: 1; } to { r: 18; opacity: 0; } }
.pos-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pos-voce { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; }
.pos-voce.su, .pos-voce:focus-visible { border-color: #57c48a; background: rgba(87, 196, 138, .08); }
.pos-voce.consigliata { border-color: var(--gold); box-shadow: inset 4px 0 0 var(--gold); }
.pos-voce.attuale { opacity: .85; }
.pos-foto { display: flex; flex: none; }
.pos-foto img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 2px solid var(--surface-2); margin-left: -12px; }
.pos-foto img:first-child { margin-left: 0; }
.pos-testo { display: grid; gap: 2px; flex: 1; min-width: 0; }
.pos-testo strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-tag { justify-self: start; font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.pos-tag.consigliato { background: var(--gold); color: var(--gold-ink); }
.pos-tag.ora { border: 1px solid var(--gold); color: var(--gold); }
.pos-voce form { margin: 0; flex: none; }
.pos-voce .btn { padding: 7px 14px; font-size: .88rem; }
