/* ================================================
   index.css
   Stili specifici della homepage (index.php).
   Dipende da: base.css (caricato prima).

   Contiene: hero h1, layout wrapper, banner ricerca,
             news card, empty state, loading overlay,
             transizioni pagina, ad card, paginazione,
             giornalini, bottone "mostra altri".
================================================ */

/* ================================================
   HERO — titolo con gradiente
================================================ */
.hero-title {
    background: linear-gradient(135deg, #b45309 0%, #ff7000 50%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================================
   LAYOUT WRAPPER (desktop 2 colonne)
================================================ */
@media (min-width: 1024px) {
    .layout-wrapper { display: flex; max-width: 100%; margin: 0 auto; }
    .main-content   { width: 98%; }
}

/* ================================================
   NEWS CARD — layout flip 50/50
================================================ */
.news-card {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(6px);
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.news-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.card-body {
    display: flex;
    align-items: flex-start;
    min-height: 110px;
}

.card-body--img-left  { flex-direction: row; }
/* da invertire, il problema lo ha il js */
.card-body--img-right { flex-direction: row-reverse; }

.card-media {
    flex: 0 0 170px;
    width: 170px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem;
}

.card-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.card-text {
    flex: 1;
    padding: 0.85rem 0.85rem 0.85rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    min-width: 0;
}

.card-body--img-right .card-text {
    padding: 0.85rem 0 0.85rem 0.85rem;
}

.card-date     { font-size: 0.78rem; font-weight: 600; color: #2563eb; margin: 0; }
.card-location { font-size: 0.82rem; font-weight: 600; color: #374151; margin: 0; }
.card-meta     { font-size: 0.78rem; color: #6b7280; margin: 0; }
.card-author   { font-size: 0.82rem; font-weight: 600; color: #4b5563; margin: 0; }

.card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 640px) {
    .card-body--img-left,
    .card-body--img-right { flex-direction: row; }

    .card-media {
        flex: 0 0 30%;
        width: 30%;
        padding: 0.5rem;
    }

    .card-thumb {
        height: 70px;
        border-radius: 6px;
    }

    .card-badges .inline-block { font-size: 0.65rem; padding: 1px 6px; }

    .card-text { flex: 1; padding: 0.5rem 0.5rem 0.5rem 0; }

    .card-body--img-right .card-text { padding: 0.5rem 0 0.5rem 0.5rem; }

    .card-title  { font-size: 0.82rem; -webkit-line-clamp: 4; }
    .card-date, .card-meta, .card-location, .card-author { font-size: 0.7rem; }
}

/* ================================================
   EMPTY STATE
================================================ */
.empty-state  { text-align: center; padding: 2.5rem 1rem; color: #6b7280; }
.empty-title  { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.empty-sub    { font-size: 0.85rem; }

/* ================================================
   LOADING OVERLAY — sovrapposto al contenuto
================================================ */
#eventsContainer,
#postsContainer {
    position: relative;
    min-height: 120px;
}

#eventsContainer.is-loading::after,
#postsContainer.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 248, 240, 0.72);
    backdrop-filter: blur(3px);
    border-radius: 12px;
}

#eventsContainer.is-loading::before,
#postsContainer.is-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 11;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid rgba(255,112,0,0.20);
    border-top-color: #ff7000;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    pointer-events: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================
   TRANSIZIONI PAGINA
================================================ */
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

#eventsContainer.content-exit,
#postsContainer.content-exit { opacity: 0.4; }

#eventsContainer.content-enter,
#postsContainer.content-enter { animation: contentFadeIn 0.28s ease-out both; }

.loader-skeleton {
    height: 100px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f3e8d0 25%, #fde9c4 50%, #f3e8d0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    margin-bottom: 0.75rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ================================================
   AD CARDS
================================================ */
.ad-card {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
    background: #fff;
}

.ad-wrapper {
    position: relative;
    width: 100%;
    padding-top: 35%; /* rapporto 1000×350 */
    overflow: hidden;
}

.ad-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease;
}

/* Canvas overlay hover-to-play GIF */
.ad-gif-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.25s ease;
    z-index: 2;
}

/* Tooltip "animazione al passaggio del cursore" */
.ad-card:has(.ad-gif-canvas) .ad-wrapper::after {
    content: "▶  animazione al passaggio del cursore";
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.65rem;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.4);
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 3;
}

/* Bottone mute video mp4 */
.ad-mute-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 6px;
    transition: background 0.2s;
}

.ad-mute-btn:hover { background: rgba(0, 0, 0, 0.80); }
.ad-mute-icon { width: 100%; height: 100%; }

/* ================================================
   PAGINAZIONE
================================================ */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.75);
    border: 1px solid #e5e7eb;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #ff7000;
    border-color: #ff7000;
    color: #fff;
}

.pagination-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination-info {
    font-size: 0.82rem;
    color: #6b7280;
    align-self: center;
}

/* ================================================
   GIORNALINI
================================================ */
.giornalino-card {
    background: rgba(255,255,255,0.88) !important;
    transition: box-shadow 0.25s, transform 0.25s,
                max-height 0.45s ease, opacity 0.4s ease, margin 0.4s ease;
    overflow: hidden;
}

.giornalino-card:hover {
    box-shadow: 0 8px 24px rgba(255,112,0,0.18);
    transform: translateY(-3px);
}

.giornalino-card img { transition: transform 0.3s ease; }
.giornalino-card:hover img { transform: scale(1.05); }

.giornalino-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.giornalino-card:not(.giornalino-hidden) {
    max-height: 400px;
    opacity: 1;
}

/* ================================================
   PULSANTE "MOSTRA ALTRI GIORNALINI"
================================================ */
.giornalini-more-btn {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 1.8rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #ff7000 0%, #ffaa00 100%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(255,112,0,0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.giornalini-more-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 28px rgba(255,112,0,0.45);
    background: linear-gradient(135deg, #e56500 0%, #ff9900 100%);
}

.giornalini-more-btn:active { transform: scale(0.97); }

.giornalini-more-icon {
    display: flex;
    align-items: center;
    animation: bounceDown 1.6s ease-in-out infinite;
}

.giornalini-more-icon svg { width: 20px; height: 20px; }

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(4px); }
}