/* =========================
   CONTENITORE
   ========================= */

.chart-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 30px;
}


/* =========================
   GRAFICO
   ========================= */

.pie-chart {

    width: 300px;
    height: 300px;

    position: relative;

    border-radius: 50%;

    /*
        Il valore viene modificato
        direttamente da JavaScript.
    */

    background:
        conic-gradient(
            var(--ast-global-color-4) 0deg 360deg
        );
}


/* =========================
   CENTRO DEL GRAFICO
   ========================= */

.pie-center {

    position: absolute;

    width: 155px;
    height: 155px;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    border-radius: 50%;

    background: var(--ast-global-color-5);

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    z-index: 3;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.08);
}

.pie-center strong {
    font-size: 1em;
    text-align: center;
    color: var(--ast-global-color-1);
}

.pie-center span {

    margin-top: 5px;

    font-size: 13px;

    color: #777;
}


/* =========================
   SPICCHIO EVIDENZIATO
   ========================= */

.pie-chart::after {

    content: "";

    position: absolute;

    width: 100%;
    height: 100%;

    border-radius: 50%;

    /*
        17,2% di 360° = 61,92°
    */

    background:
        conic-gradient(
            var(--ast-global-color-0) 0deg 61.92deg,
            transparent 61.92deg 360deg
        );

    /*
        Parte inizialmente invisibile.
    */

    clip-path: inset(0 0 100% 0);

    transform: rotate(-90deg);

    z-index: 2;

    transition:
        transform 0.6s cubic-bezier(.34, 1.56, .64, 1),
        filter 0.3s ease;
}


/*
    Quando l'animazione arriva alla fine,
    lo spicchio viene leggermente estratto.
*/

.pie-chart.highlight::after {

    clip-path: none;

    transform:
        rotate(-90deg)
        translate(12px, -12px);

    filter:
        drop-shadow(
            4px 4px 6px rgba(0, 0, 0, 0.18)
        );
}


/* =========================
   LEGENDA
   ========================= */

.legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {

    display: flex;
    align-items: center;

    gap: 8px;

    font-size: 15px;

    color: #444;
}

.legend-color {

    width: 14px;
    height: 14px;

    border-radius: 50%;
}

.legend-color.highlighted {

    background: var(--ast-global-color-0);
}

.legend-color.remaining {

    background: var(--ast-global-color-7);
}