/* ============================================================
   PHOTOBOOK — HBVoid.com
   Stili per le sottosezioni fotografiche (photobook virtuali)
   Versione ottimizzata anche per mobile
   ============================================================ */

/* ---------- Cover del photobook ---------- */
.photobook-cover {
    position: relative;
    max-width: 420px;
    width: 90%;                 /* su schermi stretti non tocca i bordi */
    margin: 25px auto;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #333;
    transition: border-color 0.3s ease, transform 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.photobook-cover:hover,
.photobook-cover:active {
    border-color: #848484;
    transform: scale(1.02);
}

.photobook-cover-img {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(20%);
    transition: filter 0.4s ease;
}

.photobook-cover:hover .photobook-cover-img,
.photobook-cover:active .photobook-cover-img {
    filter: grayscale(0%);
}

.photobook-cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
    pointer-events: none;
}

.photobook-cover-title {
    color: #fff;
    font-family: 'Anton', sans-serif;
    letter-spacing: 3px;
    font-size: 1.8em;
    text-align: center;
}

.photobook-cover-hint {
    color: #aaa;
    font-size: 0.8em;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ---------- Icona share (dentro la cover, in alto a destra) ---------- */
.photobook-share-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 3px;
    color: #fff;
    cursor: pointer;
    transition: background .25s, border-color .25s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}

.photobook-share-icon:hover,
.photobook-share-icon:active {
    background: rgba(0, 0, 0, 0.85);
    border-color: #fff;
    transform: scale(1.08);
}

.photobook-share-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    pointer-events: none;
}

/* Toast di conferma sopra la cover */
.photobook-share-toast {
    position: absolute;
    top: 48px;
    right: 10px;
    z-index: 5;
    font-family: 'Anton', sans-serif;
    font-size: 0.75em;
    letter-spacing: 2px;
    color: #fff;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 5px 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}

.photobook-share-toast.show {
    opacity: 1;
}

/* ---------- Viewer fullscreen ---------- */
.photobook-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.96);
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;   /* blocca scroll pagina sotto */
}

.photobook-viewer.active {
    display: flex;
}

.photobook-stage {
    max-width: 92vw;
    max-height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: pan-y;
}

#photobook-img {
    max-width: 92vw;
    max-height: 75vh;
    object-fit: contain;
    border: 1px solid #222;
    box-shadow: 0 0 60px rgba(0,0,0,0.9);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* ---------- Didascalia sotto l'immagine ---------- */
.photobook-caption {
    margin-top: 14px;
    text-align: center;
    color: #ccc;
    max-width: 90vw;
    font-size: 0.9em;
    line-height: 1.5;
    padding: 0 10px;
}

#photobook-caption-title {
    font-family: 'Anton', sans-serif;
    color: #fff;
    letter-spacing: 2px;
    font-size: 2.4em;
    margin: 0 0 6px 0;
    text-transform: uppercase;
}
#photobook-caption-title:empty { display: none; }

#photobook-caption-text {
    margin: 0 0 8px 0;
    color: #ccc;
}
#photobook-caption-text:empty { display: none; }

#photobook-caption-meta {
    display: block;
    color: #777;
    font-size: 0.8em;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
#photobook-caption-meta:empty { display: none; }

.photobook-counter {
    display: block;
    color: #555;
    font-size: 0.75em;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* ---------- Controlli (desktop) ---------- */
.photobook-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #ccc;
    font-size: 44px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
    padding: 5px 12px;
    -webkit-tap-highlight-color: transparent;
}
.photobook-close:hover,
.photobook-close:active { color: #fff; }

.photobook-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 40px;
    padding: 20px;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.photobook-nav:hover,
.photobook-nav:active { color: #fff; }
.photobook-prev { left: 10px; }
.photobook-next { right: 10px; }

/* ============================================================
   MOBILE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    .photobook-nav {
        font-size: 30px;
        padding: 14px;
        top: auto;
        bottom: 12px;
        transform: none;
        background: rgba(0,0,0,0.55);
        border-radius: 4px;
        color: #ddd;
    }
    .photobook-prev { left: 12px; }
    .photobook-next { right: 12px; }

    .photobook-close {
        top: 8px;
        right: 10px;
        font-size: 40px;
        background: rgba(0,0,0,0.55);
        border-radius: 50%;
        width: 44px;
        height: 44px;
        line-height: 40px;
        text-align: center;
        padding: 0;
    }

    .photobook-viewer {
        padding: 12px;
    }

    .photobook-stage { max-height: 70vh; }
    #photobook-img  { max-height: 70vh; }

    .photobook-caption {
        margin-top: 10px;
        font-size: 0.85em;
        max-width: 95vw;
    }

    #photobook-caption-title { font-size: 1.7em; }

    .photobook-stage::after {
        content: "← swipe →";
        position: absolute;
        bottom: -18px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7em;
        color: #555;
        letter-spacing: 2px;
        pointer-events: none;
    }
}

/* ============================================================
   SCHERMI MOLTO STRETTI (≤ 400px)
   ============================================================ */
@media (max-width: 400px) {
    .photobook-cover { width: 94%; }
    .photobook-cover-title { font-size: 1.1em; letter-spacing: 2px; }
    .photobook-cover-hint { font-size: 0.7em; }

    #photobook-caption-title { font-size: 1.4em; }
    .photobook-caption { font-size: 0.8em; }
}