/* ── Bacheca ─────────────────────────────────────────────── */

/* Testata: filtri + frecce slider */
.bacheca-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem; margin-bottom: 2.5rem;
}
.bacheca-tabs {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.bacheca-arrows { display: flex; gap: 0.5rem; }
.bacheca-arrow {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-alt); color: var(--text-muted);
    border: none; border-radius: var(--radius);
    cursor: pointer; transition: background 0.2s, color 0.2s;
}
.bacheca-arrow:hover { background: var(--grad-gold); color: #fff; }
.bacheca-arrow.is-disabled { opacity: 0.3; pointer-events: none; }
.bacheca-arrows.is-hidden { display: none; }
.bacheca-tab {
    font-family: var(--font-sans);
    font-size: 0.72rem; font-weight: 400;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text-muted);
    background: transparent;
    border: none;
    box-shadow: inset 0 0 0 1px var(--border);
    border-radius: var(--radius);
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    transition: color 0.2s, box-shadow 0.2s, background 0.2s;
}
.bacheca-tab:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--soft); }
.bacheca-tab.is-active {
    color: #fff;
    box-shadow: none;
    background: var(--grad-gold);
}
.bacheca-tab:focus, .bacheca-arrow:focus { outline: none; }
.bacheca-tab:focus-visible, .bacheca-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Slider orizzontale */
.bacheca-grid {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0.5rem 0.25rem 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;            /* Firefox: nascondi scrollbar */
    -ms-overflow-style: none;          /* IE/Edge */
}
.bacheca-grid::-webkit-scrollbar { display: none; }   /* Chrome/Safari */

/* Card */
.bacheca-card {
    flex: 0 0 400px;
    scroll-snap-align: start;
    height: 460px;                 /* altezza fissa, come la larghezza */
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.25s, transform 0.25s;
}
.bacheca-card:hover { box-shadow: 0 12px 32px rgba(27,58,92,0.10); transform: translateY(-2px); }
.bacheca-card[data-href] { cursor: pointer; }
.bacheca-card__title a { color: inherit; text-decoration: none; transition: color 0.2s; }
.bacheca-card[data-href]:hover .bacheca-card__title a { color: var(--accent); }

.bacheca-card__body { padding: 1.4rem 1.5rem 1.6rem; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bacheca-card__title { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 400; line-height: 1.25; color: var(--text); }
.bacheca-card__date { font-family: var(--font-sans); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); margin-top: 0.45rem; }
.bacheca-card__textwrap {
    flex: 1 1 auto; min-height: 0; overflow: visible; margin-top: 0.9rem;
}
.bacheca-card__text {
    margin: 0;
    font-family: var(--font-sans); font-size: 0.92rem; font-weight: 300;
    line-height: 1.65; color: var(--text-muted);
    overflow-wrap: anywhere; word-break: break-word;
    overflow: hidden;
    display: -webkit-box; -webkit-box-orient: vertical;
    -webkit-line-clamp: 8;   /* default prima che bacheca.js calcoli le righe esatte */
}

/* Media: foto / video */
.bacheca-card__media {
    position: relative; display: block; width: 100%;
    aspect-ratio: 16 / 10; padding: 0; border: none;
    background: var(--bg-alt); cursor: pointer; overflow: hidden;
}
.bacheca-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.bacheca-card__media:hover img { transform: scale(1.04); }
.bacheca-card__ph { display: block; width: 100%; height: 100%; background: var(--bg-dark); }

/* Pulsante play sul video */
.bacheca-play {
    position: absolute; top: 50%; left: 50%;
    width: 58px; height: 58px; transform: translate(-50%, -50%);
    border-radius: 50%; background: rgba(27,58,92,0.78);
    transition: background 0.2s, transform 0.2s;
}
.bacheca-play::before {
    content: ""; position: absolute; top: 50%; left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid; border-width: 9px 0 9px 15px;
    border-color: transparent transparent transparent #fff;
}
.bacheca-video:hover .bacheca-play { background: var(--accent); transform: translate(-50%, -50%) scale(1.08); }

/* Galleria evento: badge sulla copertina */
.bacheca-gallery-badge {
    position: absolute; left: 0.7rem; bottom: 0.7rem;
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: rgba(27,58,92,0.82); color: #fff;
    font-family: var(--font-sans); font-size: 0.72rem; font-weight: 500;
    letter-spacing: 0.04em; padding: 0.3rem 0.6rem; border-radius: var(--radius);
}

/* Galleria evento: visore sfogliabile nel modal */
.bacheca-gallery-view { position: relative; }
.bacheca-gnav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border: none; border-radius: 50%;
    background: rgba(244,247,251,0.92); color: var(--bg-dark);
    font-size: 1.7rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: background 0.18s, color 0.18s;
}
.bacheca-gnav:hover { background: var(--bg-dark); color: #fff; }
.bacheca-gnav--prev { left: 0.8rem; }
.bacheca-gnav--next { right: 0.8rem; }
.bacheca-gcount {
    position: absolute; bottom: 0.8rem; left: 50%; transform: translateX(-50%);
    background: rgba(27,58,92,0.7); color: rgba(255,255,255,0.9);
    font-family: var(--font-sans); font-size: 0.7rem; letter-spacing: 0.08em;
    padding: 0.2rem 0.7rem; border-radius: 20px;
}
@media (max-width: 640px) {
    .bacheca-gnav { width: 40px; height: 40px; font-size: 1.4rem; }
}

/* Pulsante PDF */
.bacheca-card__pdf {
    display: inline-flex; align-items: center; gap: 0.5rem;
    align-self: flex-start; margin-top: 1.6rem;   /* spazio per l'eventuale riga extra del testo sopra */
    font-family: var(--font-sans); font-size: 0.75rem; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent); border-radius: var(--radius);
    padding: 0.6rem 1.1rem;
    transition: background 0.2s, color 0.2s;
}
.bacheca-card__pdf:hover { background: var(--accent); color: #fff; }

/* Card nascosta dal filtro */
.bacheca-card.is-hidden { display: none; }

/* Segnaposto bacheca vuota / filtro vuoto */
.bacheca-empty,
.bacheca-filter-empty {
    font-family: var(--font-sans); font-size: 1rem; font-weight: 300;
    color: var(--text-muted); line-height: 1.7;
    padding: 2rem 0;
}
.bacheca-filter-empty[hidden] { display: none; }

@media (max-width: 640px) {
    .bacheca-arrows { display: none; }
    .bacheca-card { flex-basis: 80%; }
}

/* ── Pagina singolo articolo (aperto dalla bacheca) ──────── */
.single-post .section__inner { max-width: 760px; }
.single-post__back {
    display: inline-block; margin-bottom: 2rem;
    font-family: var(--font-sans); font-size: 0.75rem; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
    transition: opacity 0.2s;
}
.single-post__back:hover { opacity: 0.7; }
.single-post__title {
    font-family: var(--font-serif); font-weight: 300;
    font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; color: var(--text);
}
.single-post__date {
    font-family: var(--font-sans); font-size: 0.75rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--soft); margin: 0.6rem 0 2rem;
}
.single-post__thumb { margin-bottom: 2rem; border-radius: var(--radius); overflow: hidden; }
.single-post__content {
    font-family: var(--font-sans); font-size: 1rem; font-weight: 300;
    line-height: 1.8; color: var(--text);
}
.single-post__content p { margin-bottom: 1.2rem; }
.single-post__content h2,
.single-post__content h3 { font-family: var(--font-serif); font-weight: 400; margin: 2rem 0 0.8rem; color: var(--text); }
.single-post__content img { border-radius: var(--radius); margin: 1rem 0; }
.single-post__content a { color: var(--accent); text-decoration: underline; overflow-wrap: anywhere; }
.single-post__content a.single-post__extlink { white-space: nowrap; overflow-wrap: normal; word-break: normal; font-weight: 500; }
.single-post__content ul,
.single-post__content ol { margin: 0 0 1.2rem 1.4rem; }

/* ── Modal (video + foto a tutto schermo) ────────────────── */
.bacheca-modal {
    position: fixed; inset: 0; z-index: 2100;
    display: none; align-items: center; justify-content: center;
    background: rgba(15,30,46,0.88); backdrop-filter: blur(4px);
    padding: 2rem;
}
.bacheca-modal.is-open { display: flex; }
.bacheca-modal__inner { position: relative; width: 100%; max-width: 920px; }
.bacheca-modal__frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.bacheca-modal__frame iframe,
.bacheca-modal__frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.bacheca-modal__img { display: block; width: 100%; max-height: 82vh; object-fit: contain; border-radius: var(--radius); }
.bacheca-modal__close {
    position: absolute; top: -2.6rem; right: 0;
    background: none; border: none; color: #fff; cursor: pointer;
    padding: 0.25rem; opacity: 0.85; transition: opacity 0.2s;
}
.bacheca-modal__close:hover { opacity: 1; }

@media (max-width: 640px) {
    .bacheca-modal { padding: 1rem; }
    .bacheca-modal__close { top: -2.4rem; }
	.single-post__title { padding-top: 0.5em; }
	.single-post__back { padding-top: 2em; margin-bottom: 0; }
}
