/* ==============================================================
   PUBLICMUSIC TOP100 — PRESENTAZIONE EDITORIALE
   CSS isolato: agisce soltanto sui contenitori della classifica.
   I dati, le query e il conteggio restano gestiti da Post Views Counter.
   ============================================================== */

.pmu-top100 {
    --pmu-top100-accent: var(--pm-accent, #c81724);
    --pmu-top100-accent-2: var(--pm-accent-2, #e35b63);
    --pmu-top100-ink: var(--pm-ink, #282426);
    --pmu-top100-muted: var(--pm-muted, #716a6e);
    --pmu-top100-card: rgba(255, 253, 251, .98);
    --pmu-top100-border: rgba(45, 37, 40, .10);

    box-sizing: border-box;
    width: 100%;
    max-width: 1540px;
    margin: 30px auto 46px;
    padding: 0 clamp(10px, 2vw, 28px);
    color: var(--pmu-top100-ink);
}

.pmu-top100,
.pmu-top100 * {
    box-sizing: border-box;
    animation: none !important;
    transition: none !important;
}

/* Elenco responsive */
.pmu-top100 > ol,
.pmu-top100 > .wp-block-post-views-counter-most-viewed-posts > ol,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol,
.pmu-top100 ol {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: clamp(14px, 1.5vw, 22px) !important;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    counter-reset: pmu-top100-rank;
}

/* Scheda */
.pmu-top100 > ol > li,
.pmu-top100 > .wp-block-post-views-counter-most-viewed-posts > ol > li,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li,
.pmu-top100 ol > li {
    position: relative;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    min-width: 0;
    min-height: 100%;
    margin: 0 !important;
    padding: 0 0 17px !important;
    overflow: hidden;
    border: 1px solid var(--pmu-top100-border) !important;
    border-radius: 19px !important;
    background: var(--pmu-top100-card) !important;
    box-shadow: 0 8px 24px rgba(32, 26, 29, .055) !important;
    color: var(--pmu-top100-ink);
    counter-increment: pmu-top100-rank;
    cursor: pointer;
    transform: none !important;
}

/* Numero di posizione: sostituisce i vecchi segni decorativi laterali */
.pmu-top100 > ol > li::before,
.pmu-top100 > .wp-block-post-views-counter-most-viewed-posts > ol > li::before,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li::before,
.pmu-top100 ol > li::before {
    content: counter(pmu-top100-rank, decimal-leading-zero) !important;
    position: absolute !important;
    z-index: 5;
    top: 12px !important;
    left: 12px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 43px !important;
    height: 43px !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 50%;
    background: linear-gradient(135deg, #302a2d, #171416) !important;
    color: #fff !important;
    font-family: inherit;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1;
    letter-spacing: .02em;
    text-align: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .20);
    pointer-events: none;
}

.pmu-top100 > ol > li:nth-child(1)::before,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li:nth-child(1)::before,
.pmu-top100 ol > li:nth-child(1)::before {
    background: linear-gradient(135deg, #e6bd59, #a87920) !important;
    color: #241b0c !important;
    border-color: rgba(255, 255, 255, .72);
}

.pmu-top100 > ol > li:nth-child(2)::before,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li:nth-child(2)::before,
.pmu-top100 ol > li:nth-child(2)::before {
    background: linear-gradient(135deg, #d9dce0, #858b93) !important;
    color: #202329 !important;
    border-color: rgba(255, 255, 255, .76);
}

.pmu-top100 > ol > li:nth-child(3)::before,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li:nth-child(3)::before,
.pmu-top100 ol > li:nth-child(3)::before {
    background: linear-gradient(135deg, #d99b70, #98572f) !important;
    color: #28170d !important;
    border-color: rgba(255, 255, 255, .65);
}

/* Elimina la vecchia decorazione diagonale */
.pmu-top100 > ol > li::after,
.pmu-top100 > .wp-block-post-views-counter-most-viewed-posts > ol > li::after,
.pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li::after,
.pmu-top100 ol > li::after {
    content: none !important;
    display: none !important;
}

/* Immagini e miniature */
.pmu-top100 ol > li .post-thumbnail,
.pmu-top100 ol > li .wp-block-post-featured-image,
.pmu-top100 ol > li .pvc-thumbnail,
.pmu-top100 ol > li .thumb,
.pmu-top100 ol > li figure {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: 0 !important;
    background: #eee9e6;
}

.pmu-top100 ol > li .post-thumbnail img,
.pmu-top100 ol > li .wp-block-post-featured-image img,
.pmu-top100 ol > li .pvc-thumbnail img,
.pmu-top100 ol > li .thumb img,
.pmu-top100 ol > li figure img,
.pmu-top100 ol > li > a > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    object-fit: cover !important;
    box-shadow: none !important;
}

/* Titoli */
.pmu-top100 ol > li .post-title,
.pmu-top100 ol > li .entry-title,
.pmu-top100 ol > li .wp-block-post-title,
.pmu-top100 ol > li .pvc-title,
.pmu-top100 ol > li .title {
    display: block;
    min-width: 0;
    margin: 15px 17px 6px !important;
    padding: 0 !important;
    color: var(--pmu-top100-ink) !important;
    font-family: inherit;
    font-size: clamp(1.05rem, 1.15vw, 1.28rem) !important;
    font-weight: 760 !important;
    line-height: 1.25 !important;
    letter-spacing: -.018em;
    overflow-wrap: anywhere;
}

.pmu-top100 ol > li .post-title a,
.pmu-top100 ol > li .entry-title a,
.pmu-top100 ol > li .wp-block-post-title a,
.pmu-top100 ol > li .pvc-title a,
.pmu-top100 ol > li .title a {
    color: inherit !important;
    text-decoration: none !important;
}

/* Rimuove il vecchio triangolino inserito prima del titolo */
.pmu-top100 ol > li .post-title::before,
.pmu-top100 ol > li .entry-title::before,
.pmu-top100 ol > li .wp-block-post-title::before,
.pmu-top100 ol > li .pvc-title::before,
.pmu-top100 ol > li .title::before {
    content: none !important;
    display: none !important;
}

/* Autore e metadati */
.pmu-top100 ol > li .author,
.pmu-top100 ol > li .post-author,
.pmu-top100 ol > li .pvc-author,
.pmu-top100 ol > li .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 9px;
    min-width: 0;
    margin: 0 17px !important;
    padding: 0 !important;
    color: var(--pmu-top100-muted) !important;
    font-size: .82rem !important;
    font-weight: 500;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Visualizzazioni: sostituisce il carattere corrotto "¨J" con un punto pulito */
.pmu-top100 ol > li .count,
.pmu-top100 ol > li .views,
.pmu-top100 ol > li .post-views {
    display: inline-flex !important;
    align-self: flex-start;
    align-items: center;
    gap: 7px;
    min-height: 29px;
    width: auto;
    max-width: calc(100% - 34px);
    margin: auto 17px 0 !important;
    padding: 7px 10px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: rgba(200, 23, 36, .07) !important;
    color: #8d3037 !important;
    font-size: .78rem !important;
    font-weight: 700 !important;
    line-height: 1.2;
    white-space: normal;
}

.pmu-top100 ol > li .count::before,
.pmu-top100 ol > li .views::before,
.pmu-top100 ol > li .post-views::before {
    content: "" !important;
    display: inline-block !important;
    flex: 0 0 7px;
    width: 7px !important;
    height: 7px !important;
    border: 0 !important;
    border-radius: 50%;
    background: var(--pmu-top100-accent) !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0;
}

/* Schede in evidenza: prima posizione più ampia su desktop */
@media (min-width: 1000px) {
    .pmu-top100 > ol,
    .pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol,
    .pmu-top100 ol {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pmu-top100 > ol > li:first-child,
    .pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li:first-child,
    .pmu-top100 ol > li:first-child {
        grid-column: span 2;
        border-radius: 22px !important;
    }

    .pmu-top100 ol > li:first-child .post-thumbnail,
    .pmu-top100 ol > li:first-child .wp-block-post-featured-image,
    .pmu-top100 ol > li:first-child .pvc-thumbnail,
    .pmu-top100 ol > li:first-child .thumb,
    .pmu-top100 ol > li:first-child figure {
        aspect-ratio: 16 / 8.65;
    }

    .pmu-top100 ol > li:first-child .post-title,
    .pmu-top100 ol > li:first-child .entry-title,
    .pmu-top100 ol > li:first-child .wp-block-post-title,
    .pmu-top100 ol > li:first-child .pvc-title,
    .pmu-top100 ol > li:first-child .title {
        margin-top: 18px !important;
        font-size: clamp(1.35rem, 1.65vw, 1.85rem) !important;
        line-height: 1.15 !important;
    }
}

/* Tablet e desktop medio */
@media (min-width: 620px) and (max-width: 999px) {
    .pmu-top100 > ol,
    .pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol,
    .pmu-top100 ol {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pmu-top100 > ol > li:first-child,
    .pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol > li:first-child,
    .pmu-top100 ol > li:first-child {
        grid-column: span 2;
    }
}

/* Hover sobrio, senza spostamenti o animazioni */
@media (hover: hover) {
    .pmu-top100 ol > li:hover {
        border-color: rgba(200, 23, 36, .34) !important;
        box-shadow: 0 9px 27px rgba(32, 26, 29, .075) !important;
    }

    .pmu-top100 ol > li:hover .post-title,
    .pmu-top100 ol > li:hover .entry-title,
    .pmu-top100 ol > li:hover .wp-block-post-title,
    .pmu-top100 ol > li:hover .pvc-title,
    .pmu-top100 ol > li:hover .title {
        color: var(--pmu-top100-accent) !important;
    }
}

.pmu-top100 ol > li.pmu-top100-clickable:focus-visible {
    outline: 3px solid var(--pmu-top100-accent) !important;
    outline-offset: 4px;
}

/* Smartphone */
@media (max-width: 619px) {
    .pmu-top100 {
        margin: 20px auto 30px;
        padding: 0 10px;
    }

    .pmu-top100 > ol,
    .pmu-top100 .wp-block-post-views-counter-most-viewed-posts > ol,
    .pmu-top100 ol {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px !important;
    }

    .pmu-top100 ol > li {
        border-radius: 16px !important;
        padding-bottom: 13px !important;
    }

    .pmu-top100 ol > li::before {
        top: 10px !important;
        left: 10px !important;
        width: 38px !important;
        height: 38px !important;
        font-size: 12px !important;
    }

    .pmu-top100 ol > li .post-title,
    .pmu-top100 ol > li .entry-title,
    .pmu-top100 ol > li .wp-block-post-title,
    .pmu-top100 ol > li .pvc-title,
    .pmu-top100 ol > li .title {
        margin: 12px 14px 5px !important;
        font-size: 1.03rem !important;
        line-height: 1.28 !important;
    }

    .pmu-top100 ol > li .author,
    .pmu-top100 ol > li .post-author,
    .pmu-top100 ol > li .pvc-author,
    .pmu-top100 ol > li .meta {
        margin: 0 14px !important;
        font-size: .78rem !important;
    }

    .pmu-top100 ol > li .count,
    .pmu-top100 ol > li .views,
    .pmu-top100 ol > li .post-views {
        margin: 9px 14px 0 !important;
        max-width: calc(100% - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pmu-top100,
    .pmu-top100 * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}


/* Fallback visual for posts without a featured image. */
.pmu-top100 ol > li .pmu-top100-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 150px;
    background: linear-gradient(135deg, #f0ebe7, #e4ddd7);
    color: rgba(120, 70, 76, .58);
    font-size: clamp(44px, 7vw, 82px);
    line-height: 1;
}
.pmu-top100-empty {
    padding: 16px 18px;
    border: 1px dashed rgba(45, 37, 40, .18);
    border-radius: 10px;
    background: rgba(255, 253, 251, .78);
    color: #716a6e;
    font-size: 13px;
    line-height: 1.65;
}
