/* =====================================================
   TheBill — Mobile Snap Slider
   Home page only · max-width 767px
   ===================================================== */

@media (max-width: 767px) {

    /* ---- Container principale ---- */
    #thebill-snap-slider {
        position: fixed;
        inset: 0;
        overflow-y: scroll;
        overflow-x: hidden;
        scroll-snap-type: y mandatory;
        -webkit-overflow-scrolling: touch;
        z-index: 50;
        background: #000;
    }

    /* Nascondi scrollbar */
    #thebill-snap-slider::-webkit-scrollbar { display: none; }
    #thebill-snap-slider { scrollbar-width: none; }

    /* ---- Singola slide ---- */
    .tbsnap-slide {
        position: relative;
        width: 100%;
        height: 100svh;
        scroll-snap-align: start;
        scroll-snap-stop: always;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    /* ---- Immagine di sfondo ---- */
    .tbsnap-bg {
        position: absolute;
        inset: 0;
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
        /* object-fit equivalent per background: centra verticale e orizzontale */
        background-attachment: scroll;
    }

    /* ---- Sfumatura nera dal basso verso l'alto ---- */
    .tbsnap-gradient {
        position: absolute;
        inset: 0;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.92) 0%,
            rgba(0, 0, 0, 0.60) 38%,
            rgba(0, 0, 0, 0.15) 68%,
            transparent 100%
        );
        pointer-events: none;
    }

    /* ---- Link che copre l'intera slide ---- */
    .tbsnap-cover-link {
        position: absolute;
        inset: 0;
        z-index: 1;
    }

    /* ---- Area testo in basso ---- */
    .tbsnap-content {
        position: relative;
        z-index: 2;
        padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px));
        color: #fff;
    }

    /* ---- Badge video ---- */
    .tbsnap-video-wrap {
        margin-bottom: 10px;
    }

    .tbsnap-video-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #fff;
        background: rgba(220, 38, 38, 0.88);
        border: none;
        padding: 5px 12px;
        border-radius: 2px;
        cursor: pointer;
        position: relative;
        z-index: 3;
        line-height: 1;
    }

    .tbsnap-video-badge:active {
        background: rgba(220, 38, 38, 1);
    }

    .tbsnap-video-badge--static {
        cursor: default;
        background: rgba(220, 38, 38, 0.75);
    }

    /* ---- Tag categoria ---- */
    .tbsnap-cats {
        margin-bottom: 10px;
        line-height: 1;
    }

    .tbsnap-cats a {
        display: inline-block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.07em;
        color: #fff !important;
        background: #c0392b;
        padding: 3px 9px;
        border-radius: 2px;
        text-decoration: none;
        margin-right: 5px;
        margin-bottom: 4px;
        position: relative;
        z-index: 3;
    }

    /* ---- Titolo ---- */
    .tbsnap-title {
        font-size: 1.38rem;
        font-weight: 700;
        line-height: 1.24;
        margin: 0 0 10px;
        color: #fff;
        font-family: 'EB Garamond', 'DM Serif Display', Georgia, serif;
    }

    .tbsnap-title a {
        color: #fff;
        text-decoration: none;
        position: relative;
        z-index: 3;
    }

    /* ---- Estratto ---- */
    .tbsnap-excerpt {
        font-size: 0.8rem;
        line-height: 1.45;
        color: rgba(255, 255, 255, 0.75);
        margin: 0 0 14px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ---- Meta: autore + link leggi ---- */
    .tbsnap-meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.6);
    }

    .tbsnap-author a {
        color: rgba(255, 255, 255, 0.85);
        text-decoration: none;
        font-weight: 600;
        position: relative;
        z-index: 3;
    }

    .tbsnap-read {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #fff;
        text-decoration: none;
        background: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255, 255, 255, 0.35);
        padding: 5px 12px;
        border-radius: 2px;
        position: relative;
        z-index: 3;
        transition: background 0.2s;
    }

    .tbsnap-read:active {
        background: rgba(255, 255, 255, 0.28);
    }

    /* ---- Pallini di progresso (lato destro) ---- */
    #tbsnap-dots {
        position: fixed;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        display: flex;
        flex-direction: column;
        gap: 5px;
        z-index: 60;
        pointer-events: none;
    }

    .tbsnap-dot {
        width: 4px;
        height: 4px;
        border-radius: 2px;
        background: rgba(255, 255, 255, 0.32);
        transition: height 0.25s ease, background 0.25s ease;
    }

    .tbsnap-dot.is-active {
        height: 18px;
        background: #fff;
    }

    /* ---- Contatore slide (basso centro) ---- */
    #tbsnap-counter {
        position: fixed;
        bottom: calc(32px + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        text-align: center;
        z-index: 60;
        font-size: 0.65rem;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.55);
        letter-spacing: 0.05em;
        pointer-events: none;
        white-space: nowrap;
    }

    /* ================================================================
       Slide banner (pubblicità come slide dedicata)
       ================================================================ */

    .tbsnap-slide--ad {
        background: #0d0d0d;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 20px;
        padding: 24px 20px;
    }

    .tbsnap-ad-label {
        font-size: 0.58rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: rgba(255, 255, 255, 0.25);
        margin: 0;
        text-align: center;
    }

    .tbsnap-ad-wrap {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Forza larghezza massima per banner standard */
    .tbsnap-ad-wrap iframe,
    .tbsnap-ad-wrap img,
    .tbsnap-ad-wrap > * {
        max-width: 100%;
        height: auto;
    }

    /* ================================================================
       Slide footer (ultima slide — contiene il <footer> reale)
       ================================================================ */

    .tbsnap-slide--footer {
        height: auto;
        min-height: 100svh;
        overflow-y: auto;
        display: block;
        background: #111;
        padding-top: 70px; /* spazio per l'header fisso */
        scroll-snap-align: start;
        -webkit-overflow-scrolling: touch;
    }

    /* Il footer interno alla slide non ha bisogno di margini extra */
    .tbsnap-slide--footer footer {
        margin: 0;
        background: transparent;
    }

    /* ================================================================
       Search form sopra lo slider
       Il form è già nel DOM ma senza z-index → finisce sotto il layer fixed.
       Lo portiamo a 9998 (sotto l'header 9999, sopra lo slider 50).
       ================================================================ */

    body.tbsnap-active .main-search-form {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9998;
        background: #111;
        overflow-y: auto;
        max-height: 100svh;
    }

    /* ================================================================
       Header fisso scuro durante lo slider
       ================================================================ */

    /* Forza background nero (sticky-bar di default ha background:#fff) */
    body.tbsnap-active .main-header {
        background: #181818 !important;
    }

    /* Logo: mostra versione chiara su sfondo scuro */
    body.tbsnap-active .main-header .logo-light {
        display: none !important;
    }

    body.tbsnap-active .main-header .logo-dark {
        display: block !important;
    }

    /* Link, testo e icone → bianchi */
    body.tbsnap-active .main-header a,
    body.tbsnap-active .main-header button {
        color: #fff !important;
    }

    /* SVG stroke-based (ricerca, dark-mode toggle, ecc.) */
    body.tbsnap-active .main-header svg {
        color: #fff !important;
        stroke: #fff !important;
    }

    /* Hamburger SlickNav — le 3 barre orizzontali */
    body.tbsnap-active .main-header .slicknav_icon-bar {
        background-color: #fff !important;
    }

    /* Nascondi divisore nero nel menu */
    body.tbsnap-active .main-header .horizontal-divider-black {
        display: none !important;
    }

    /* ---- Hint swipe (solo prima slide) ---- */
    .tbsnap-swipe-hint {
        position: absolute;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        z-index: 3;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        opacity: 0;
        animation: tbsnap-hint-in 0.6s 1.2s forwards, tbsnap-bounce 1.8s 1.8s ease infinite;
        pointer-events: none;
    }

    .tbsnap-swipe-hint span {
        display: block;
        width: 1.5px;
        height: 22px;
        background: rgba(255, 255, 255, 0.45);
        border-radius: 1px;
    }

    .tbsnap-swipe-hint svg {
        fill: rgba(255, 255, 255, 0.45);
    }

    @keyframes tbsnap-hint-in {
        to { opacity: 1; }
    }

    @keyframes tbsnap-bounce {
        0%, 100% { transform: translateX(-50%) translateY(0);   opacity: 0.5; }
        50%       { transform: translateX(-50%) translateY(7px); opacity: 1;   }
    }

    /* ---- Progress bar articoli ---- */
    #tbsnap-progress {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 61;
        height: 2px;
        background: rgba(255, 255, 255, 0.08);
        pointer-events: none;
    }

    #tbsnap-progress-bar {
        height: 100%;
        width: 0;
        background: rgba(255, 255, 255, 0.55);
        transition: width 0.35s ease;
    }

    /* ---- Spinner infinite scroll ---- */
    #tbsnap-loader {
        position: fixed;
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        left: 50%;
        transform: translateX(-50%);
        z-index: 60;
        width: 22px;
        height: 22px;
        border: 2px solid rgba(255, 255, 255, 0.15);
        border-top-color: rgba(255, 255, 255, 0.8);
        border-radius: 50%;
        animation: tbsnap-spin 0.7s linear infinite;
    }

    @keyframes tbsnap-spin {
        to { transform: translateX(-50%) rotate(360deg); }
    }

}
