/* ==========================================================================
   PMC Brands — indice marchi
     [pmc_brands_index]  -> nav A-Z (header, costruito a mano)
     [pmc_brands]        -> struttura pagina (gruppi lettera + card)
   Figma: desktop 681-16618, mobile 681-16654. Header/footer = tema Impreza.

   Desktop  : ogni gruppo = lettera a sinistra + card sempre visibili a destra.
   Mobile   : ogni gruppo = accordion (riga lettera + chevron, tap per aprire);
              indice A-Z a scroll orizzontale; card su 2 colonne.

   Token Figma:
     Hero bg      linear-gradient(168.69deg, #5B618B 0%, #373B56 100%)
     Titolo       Lora SemiBold Italic 48px #FFF
     Lettera gr.  Lora SemiBold Italic 40px #080707
     Pill A-Z     38px, radius 31px, bg rgba(255,255,255,.2), Helvetica Neue Bold 16px #FFF
     Pill attiva  bg rgba(255,255,255,.5)
     Card         bg rgba(255,255,255,.2), bordo 1px #FFF, radius 16px,
                  shadow 0 6px 12px rgba(182,160,120,.3), pad 16px 8px
     Card hover   bg rgba(255,255,255,.5), bordo #DCD4CD, shadow 0 2px 12px rgba(182,160,120,.4)
     Nome card    Helvetica Neue Medium 16px #080707, centrato, ellipsis
     Separatore   border-top 1px #766F67 tra i gruppi
   ========================================================================== */

.pmc-brands {
    --pmc-brands-pad: 78px;
    --pmc-brands-shadow-s: 0 6px 12px rgba(182, 160, 120, .3);
    --pmc-brands-shadow-xs: 0 2px 12px rgba(182, 160, 120, .4);
}

/* ---- Hero opzionale (se avvolgi l'indice a mano nell'header) ---- */
.pmc-brands__hero {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 40px var(--pmc-brands-pad);
    background: linear-gradient(168.69deg, #5B618B 0%, #373B56 100%);
    overflow: hidden;
}

.pmc-brands__title {
    margin: 0;
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: 48px;
    line-height: 1.2;
    text-align: center;
    color: #fff;
}

/* ---- Indice A-Z ---- */
.pmc-brands__az {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pmc-brands__az-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 8px;
    border-radius: 31px;
    background: rgba(255, 255, 255, .2);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
    color: #fff;
    text-decoration: none;
    transition: background-color .15s ease;
}

a.pmc-brands__az-letter:hover,
a.pmc-brands__az-letter:focus-visible {
    background: rgba(255, 255, 255, .5);
    color: #fff;
    text-decoration: none;
    text-shadow: 0 2px 12px rgba(182, 160, 120, .4);
}

.pmc-brands__az-letter.is-disabled {
    opacity: .35;
    cursor: default;
}

/* ---- Gruppo lettera + card (desktop: riga, card sempre visibili) ---- */
.pmc-brands__group {
    display: flex;
    gap: 117px;
    align-items: flex-start;
    padding: 32px var(--pmc-brands-pad);
    border-top: 1px solid #766F67;
    scroll-margin-top: var(--header-height, 96px);
}

/* la "testa" gruppo è un button: su desktop = sola colonna lettera (42px) */
.pmc-brands__group-head {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: inherit;
    cursor: default;
}

.pmc-brands__group-letter {
    margin: 0;
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-style: italic;
    font-size: 40px;
    line-height: 1.2;
    text-align: center;
    color: #080707;
}

/* chevron: solo mobile */
.pmc-brands__chevron {
    display: none;
    flex: 0 0 auto;
    color: #080707;
    transition: transform .2s ease;
}

.pmc-brands__cards {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 16px 56px;
    flex: 1 1 0;
    min-width: 0;
}

.pmc-brands__card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 239px;
    padding: 16px 8px;
    border: 1px solid #fff;
    border-radius: 16px;
    background: rgba(255, 255, 255, .2);
    box-shadow: var(--pmc-brands-shadow-s);
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.pmc-brands__card-name {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
    color: #080707;
}

.pmc-brands__card:hover,
.pmc-brands__card:focus-visible {
    background: rgba(255, 255, 255, .5);
    border-color: #DCD4CD;
    box-shadow: var(--pmc-brands-shadow-xs);
    text-decoration: none;
}

/* ---- Tablet ---- */
@media (max-width: 1024px) {
    .pmc-brands {
        --pmc-brands-pad: 32px;
    }

    .pmc-brands__group {
        gap: 48px;
    }

    .pmc-brands__cards {
        gap: 16px 24px;
    }

    .pmc-brands__card {
        width: calc(50% - 12px);
    }
}

/* ---- Mobile: indice a scroll orizzontale + gruppi accordion ---- */
@media (max-width: 640px) {
    .pmc-brands {
        --pmc-brands-pad: 16px;
    }

    .pmc-brands__title {
        font-size: 48px;
    }

    /* indice: riga unica scorrevole, niente wrap */
    .pmc-brands__az {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .pmc-brands__az::-webkit-scrollbar {
        display: none;
    }

    /* gruppo = colonna; testa = riga toggle a piena larghezza */
    .pmc-brands__group {
        flex-direction: column;
        gap: 16px;
        padding: 24px var(--pmc-brands-pad);
    }

    .pmc-brands__group-head {
        display: flex;
        flex: 0 0 auto;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        cursor: pointer;
    }

    .pmc-brands__chevron {
        display: block;
    }

    .pmc-brands__group.is-open .pmc-brands__chevron {
        transform: rotate(180deg);
    }

    /* card nascoste finché il gruppo non è aperto */
    .pmc-brands__cards {
        display: none;
        width: 100%;
        grid-template-columns: 1fr 1fr;
        gap: 12px 24px;
    }

    .pmc-brands__group.is-open .pmc-brands__cards {
        display: grid;
    }

    .pmc-brands__card {
        width: auto;
    }
}
