/* TQ Sfogliabili — vetrina e modale. */

.tqsf-vetrina { text-align: center; }
.tqsf-titolo { margin: 0 0 18px; }

.tqsf-palco {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.tqsf-numeri { flex: 1 1 auto; min-width: 0; }

/* La copertina è un <button>: si apre da tastiera e si annuncia da sola. */
.tqsf-numero {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
}
.tqsf-copertina { width: 100%; height: auto; display: block; }

.tqsf-senza-copertina {
    display: block;
    padding: 40px 16px;
    background: #eef3f9;
    color: #1f3a5f;
    font-weight: 600;
    line-height: 1.4;
}

/* La lente al centro dice che si apre: senza, la copertina sembra un'immagine
   qualunque e nessuno ci clicca. */
.tqsf-lente {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, .82) no-repeat center / 26px 26px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231f3a5f'%3E%3Cpath d='M9 3H3v6l2.3-2.3 3 3L9.9 8l-3-3zM15 3h6v6l-2.3-2.3-3 3L14.1 8l3-3zM9 21H3v-6l2.3 2.3 3-3L9.9 16l-3 3zM15 21h6v-6l-2.3 2.3-3-3L14.1 16l3 3z'/%3E%3C/svg%3E");
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.tqsf-numero:hover .tqsf-lente,
.tqsf-numero:focus-visible .tqsf-lente { opacity: 1; }

.tqsf-freccia {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: #1f3a5f;
    font-size: 40px;
    line-height: 1;
    cursor: pointer;
}
.tqsf-freccia:hover { color: #0051a2; }

.tqsf-pulsanti { display: flex; gap: 14px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.tqsf-pulsante {
    display: inline-block;
    padding: 14px 34px;
    background: #ffb800;
    color: #1a1a1a;
    font-weight: 700;
    letter-spacing: .04em;
    text-decoration: none;
    border-radius: 3px;
}
.tqsf-pulsante:hover { background: #e6a600; color: #1a1a1a; }

/* ── Bottone singolo ─────────────────────────────────────────────────────
   È un <button>: senza queste regole si porterebbe dietro bordo, carattere
   e cursore di serie del browser, e quelli dei bottoni del tema.
   Selettore raddoppiato per battere un `button { … }` del tema. */
.tqsf-bottone { margin: 0; text-align: left; }
.tqsf-bottone.tqsf-allinea-centro { text-align: center; }
.tqsf-bottone.tqsf-allinea-destra { text-align: right; }

.tqsf-bottone .tqsf-pulsante {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.2;
    text-transform: none;
    box-shadow: none;
}
.tqsf-bottone .tqsf-pulsante:focus-visible { outline: 2px solid #1a1a1a; outline-offset: 2px; }

/* ── Modale ──────────────────────────────────────────────────────────── */
html.tqsf-aperta { overflow: hidden; }

.tqsf-modale {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tqsf-modale[hidden] { display: none; }

.tqsf-modale-fondo { position: absolute; inset: 0; background: rgba(0, 0, 0, .8); }

.tqsf-modale-riquadro {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
}

.tqsf-modale-barra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #1f3a5f;
    color: #fff;
    flex: none;
}
.tqsf-modale-titolo { margin: 0; font-size: 16px; color: #fff; }

.tqsf-modale-chiudi {
    border: 0;
    background: none;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    padding: 0 6px;
    cursor: pointer;
}

.tqsf-modale-corpo { flex: 1 1 auto; position: relative; background: #f4f4f4; }

/* L'iframe riempie il riquadro: il visualizzatore si dimensiona da solo. */
.tqsf-frame { width: 100%; height: 100%; border: 0; display: block; }

.tqsf-attesa,
.tqsf-ripiego {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin: 0;
    padding: 24px;
    text-align: center;
    color: #50575e;
}
.tqsf-ripiego p { max-width: 46ch; margin: 0; line-height: 1.5; }

.tqsf-vuoto {
    padding: 14px;
    border: 1px dashed #c3c4c7;
    background: #fbfbfb;
    color: #646970;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 767px) {
    .tqsf-modale { padding: 0; }
    .tqsf-modale-riquadro { border-radius: 0; }
    .tqsf-freccia { width: 34px; font-size: 30px; }
    .tqsf-pulsante { padding: 12px 22px; }
}

/* ── Archivio storico (Issuu) ────────────────────────────────────────── */
.tqsf-storico { width: 100%; }

.tqsf-storico-cerca {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0 0 16px;
}
.tqsf-storico-cerca input[type="search"],
.tqsf-storico-cerca select {
    padding: 10px 12px;
    border: 1px solid #d6d6d6;
    border-radius: 3px;
    font: inherit;
    min-width: 14em;
}
/* Il pulsante della ricerca è un <button>: senza queste righe si porta
   dietro bordo e carattere di serie del browser e del tema. */
.tqsf-storico-cerca .tqsf-pulsante {
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.2;
}

.tqsf-storico-conteggio,
.tqsf-storico-vuoto { margin: 0 0 14px; color: #666; font-size: 14px; }

/* Un numero di cui non si conosce il documento Issuu non si apre: resta la
   copertina, senza lente e senza cursore da cliccare. */
.tqsf-numero--chiuso { display: block; cursor: default; }
.tqsf-numero--chiuso .tqsf-copertina { opacity: .85; }

.tqsf-cella-pdf { display: block; margin-top: 4px; font-size: 13px; }
.tqsf-cella-nota { display: block; margin-top: 4px; font-size: 12px; color: #b32d2e; }

/* ── Archivio ────────────────────────────────────────────────────────── */
.tqsf-archivio { width: 100%; }

.tqsf-griglia {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 26px 20px;
}

.tqsf-cella { margin: 0; }
.tqsf-cella .tqsf-copertina { box-shadow: 0 2px 10px rgba(0, 0, 0, .14); }

.tqsf-cella-testo {
    display: block;
    margin-top: 10px;
    line-height: 1.4;
    text-align: center;
}
.tqsf-cella-nome { display: block; font-weight: 600; }
.tqsf-cella-data { display: block; font-size: 13px; color: #646970; }

.tqsf-pagine {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 30px;
}
.tqsf-pagina {
    display: inline-block;
    min-width: 38px;
    padding: 8px 10px;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    text-align: center;
    text-decoration: none;
    color: #1f3a5f;
}
.tqsf-pagina:hover { border-color: #1f3a5f; color: #1f3a5f; }
.tqsf-pagina--attuale { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }

.tqsf-pagina-archivio { padding: 30px 20px; max-width: 1230px; margin: 0 auto; }

@media (max-width: 767px) {
    .tqsf-griglia { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
}
