/* ==========================================================================
   HOME.CSS — hero con globo, popup dei ricordi, nazioni, invito finale
   ========================================================================== */

/* ---------- Hero ---------- */
.hero { padding: 2rem 0 1rem; }
.hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    align-items: center;
    gap: 2rem;
    min-height: calc(100svh - var(--header-h) - 3rem);
}
.hero__title { font-size: clamp(2.4rem, 5.2vw, 4.2rem); line-height: 1.1; letter-spacing: -.01em; margin-bottom: 1.4rem; }
.hero__copy .lead-text { max-width: 44ch; margin-bottom: 2rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2.5rem; }
.hero__count { margin: 0; font: italic 1.1rem/1.6 var(--font-serif); color: var(--col-text-muted); }
.hero__count strong { font-style: normal; font-weight: 600; font-size: 1.6rem; color: var(--col-primary-dark); }

/* ---------- Globo ---------- */
.globe-stage {
    position: relative;
    height: min(80vh, 780px);
    min-height: 420px;
    animation: globe-in 1.6s cubic-bezier(.16, 1, .3, 1) both;   /* unico momento orchestrato */
}
@keyframes globe-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

#globe { position: absolute; inset: 0; }
/* sfuma i bordi del canvas nello sfondo: il globo "galleggia" sulla pagina */
.globe-stage .mapboxgl-canvas {
    -webkit-mask-image: radial-gradient(circle closest-side, #000 88%, transparent 100%);
            mask-image: radial-gradient(circle closest-side, #000 88%, transparent 100%);
}
/* da bloccato la pagina scorre sempre, anche con il dito sul globo */
.globe-stage:not(.is-active) .mapboxgl-canvas { touch-action: pan-y !important; }

.globe-hint {
    position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
    margin: 0; padding: .5rem 1.1rem; border-radius: 50px; pointer-events: none; white-space: nowrap;
    background: rgba(74, 64, 54, .78); color: var(--col-bg-base); font-size: .85rem; line-height: 1.4;
    transition: opacity var(--transition-smooth);
}
.globe-stage.is-active .globe-hint { opacity: 0; }

.globe-close {
    display: none; position: absolute; top: 12px; left: 50%; z-index: 5;
    width: 44px; height: 44px; margin-left: -22px; padding: 0; border: 0; border-radius: 50%;
    background: var(--col-bg-base); box-shadow: 0 2px 10px rgba(74, 64, 54, .22);
    -webkit-appearance: none; appearance: none; touch-action: manipulation; cursor: pointer;
}
.globe-stage.is-active .globe-close { display: block; }
.globe-stage .mapboxgl-ctrl-group { border-radius: var(--radius-md); box-shadow: var(--shadow-soft); overflow: hidden; }

/* ---------- Popup dei ricordi (card compatta) ---------- */
.mapboxgl-popup-content { padding: .8rem; border-radius: 14px; background: var(--col-bg-base); box-shadow: var(--shadow-soft); }
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip { border-top-color: var(--col-bg-base); }
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip { border-bottom-color: var(--col-bg-base); }

.memory-card { width: 210px; max-width: 100%; text-align: center; }
.memory-card h3 { margin: 0 0 .1rem; font-size: 1.05rem; line-height: 1.3; color: var(--col-primary-dark); }
.memory-card .author { margin: 0 0 .6rem; font-size: .8rem; line-height: 1.4; color: var(--col-text-muted); }
.memory-card .quote { margin: 0; max-height: 4.8em; overflow-y: auto; font: italic .9rem/1.5 var(--font-serif); }

/* La foto mantiene sempre le sue proporzioni: nessun ritaglio */
.memory-card__photo { position: relative; display: block; width: 100%; margin: 0 0 .6rem; padding: 0; border: 0; background: none; cursor: zoom-in; }
.memory-card__photo img { display: block; width: auto; max-width: 100%; max-height: 170px; margin: 0 auto; object-fit: contain; border-radius: 8px; box-shadow: 0 3px 10px rgba(74, 64, 54, .12); }
.memory-card__photo::after {
    content: ''; position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; border-radius: 50%;
    background: rgba(252, 249, 242, .92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A4036' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h5v5M9 20H4v-5M20 4l-6 6M4 20l6-6'/%3E%3C/svg%3E") center / 14px no-repeat;
}

@media (max-width: 600px) {
    .mapboxgl-popup-content { padding: .65rem; }
    .memory-card { width: 180px; }
    .memory-card__photo img { max-height: 140px; }
    .memory-card .quote { font-size: .85rem; }
}

/* ---------- Foto a schermo intero ---------- */
body.no-scroll { overflow: hidden; }
.lightbox {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 1rem;
    background: rgba(40, 33, 27, .94); animation: lightbox-in .25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox__figure { display: flex; flex-direction: column; align-items: center; gap: .9rem; max-width: min(100%, 1100px); margin: 0; }
.lightbox__figure img {
    width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 9rem); max-height: calc(100svh - 9rem);
    object-fit: contain; border-radius: 6px;
}
.lightbox figcaption { max-width: 60ch; color: var(--col-bg-base); text-align: center; font-size: .92rem; line-height: 1.5; }
.lightbox figcaption strong { display: block; font: 500 1.2rem var(--font-serif); }
.lightbox figcaption em { display: block; margin-top: .5rem; font: italic 1rem/1.6 var(--font-serif); }
.lightbox__close {
    position: absolute; top: max(.8rem, env(safe-area-inset-top)); right: max(.8rem, env(safe-area-inset-right));
    width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
    background: rgba(252, 249, 242, .16); -webkit-appearance: none; appearance: none;
    touch-action: manipulation; cursor: pointer;
}
.lightbox__close:hover { background: rgba(252, 249, 242, .3); }

/* ---------- Nazioni ---------- */
.countries { background: var(--col-bg-surface); }
.countries[hidden] { display: none; }
.country-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; margin-top: 2rem; }
.country-tag {
    display: inline-flex; align-items: center; gap: .6rem; padding: .6rem 1.1rem; border-radius: 50px; cursor: pointer;
    background: var(--col-bg-base); border: 1px solid var(--col-line); color: var(--col-text-main);
    font: 600 .95rem var(--font-sans); transition: var(--transition-smooth);
}
.country-tag:hover { border-color: var(--col-primary); color: var(--col-primary-dark); }
.tag-count { min-width: 1.5rem; padding: 0 .4rem; border-radius: 50px; background: var(--col-accent-glow); color: var(--col-text-main); font-size: .8rem; line-height: 1.5rem; text-align: center; }

/* ---------- Invito finale ---------- */
.closing__box { padding: 3.5rem 2rem; border-radius: var(--radius-lg); background: var(--col-bg-surface); }
.closing__box p { max-width: 42ch; margin: 0 auto 2rem; color: var(--col-text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero { padding-top: 1rem; }
    .hero__inner { grid-template-columns: 1fr; min-height: 0; gap: 1rem; }
    .hero__actions { margin-bottom: 1.8rem; }
    .globe-stage { height: min(112vw, 520px); min-height: 340px; margin: 0 -24px; }
    .globe-hint { white-space: normal; text-align: center; width: max-content; max-width: 85%; }
}
@media (max-width: 480px) { .hero__actions .btn { flex: 1 1 100%; } }
.globe-close::before, .globe-close::after,
.lightbox__close::before, .lightbox__close::after {
    content: ''; position: absolute; top: 50%; left: 50%; width: 18px; height: 2px; margin: -1px 0 0 -9px;
    border-radius: 2px; background: var(--col-text-main);
}
.lightbox__close::before, .lightbox__close::after { background: var(--col-bg-base); }
.globe-close::before, .lightbox__close::before { transform: rotate(45deg); }
.globe-close::after, .lightbox__close::after { transform: rotate(-45deg); }