/*
 * zivag/chart - a ring chart with a legend.
 *
 * This used to be an exported picture of a 3D pie, one file per language, so
 * the figures could not be read out, translated or corrected without the
 * drawing file. The ring is drawn from the numbers themselves: the shares are
 * computed in the template, so a changed count moves the segment with it.
 */

.section-chart {
    /* The two reds of the Zivag mark, plus two tints of the lighter one, so
       the ring stays in the brand's own colour instead of drifting brown. */
    --chart-tone-1: #f4cac6;
    --chart-tone-2: #ea958c;
    --chart-tone-3: #dc4f40;
    --chart-tone-4: #ac3d30;

    padding-top: 4vw;
    padding-bottom: 4vw;
}

.section-chart h2 {
    margin-bottom: 1rem;
}

.chart-subtitle {
    margin-bottom: 3.5rem;
    font-weight: 300;
}

.chart-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5rem;
}

.chart-ring {
    position: relative;
    flex: 0 0 auto;
    width: 15rem;
}

.chart-ring svg {
    display: block;
    width: 100%;
    height: auto;
}

.chart-track {
    fill: none;
    stroke: #f1f1f1;
    stroke-width: 5;
}

.chart-slice {
    fill: none;
    stroke-width: 5;
}

.chart-slice.tone-1 { stroke: var(--chart-tone-1); }
.chart-slice.tone-2 { stroke: var(--chart-tone-2); }
.chart-slice.tone-3 { stroke: var(--chart-tone-3); }
.chart-slice.tone-4 { stroke: var(--chart-tone-4); }

.chart-total {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1.2;
}

.chart-total-value {
    display: block;
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--black, #000);
}

.chart-total-label {
    display: block;
    margin-top: .2rem;
    font-size: .85rem;
    font-weight: 300;
    color: var(--black, #000);
}

.chart-legend {
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 20rem;
}

.chart-legend-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: baseline;
    column-gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid #ededed;
}

.chart-legend-item:last-child {
    border-bottom: 0;
}

.chart-swatch {
    width: 10px;
    height: 10px;
    /* Round, like the Fakten dot and the one in the client list: the three
       sections share one mark, so a reader takes them as one language. The
       size was already shared; only the corners were not. */
    border-radius: 50%;
    transform: translateY(-1px);
}

.chart-swatch.tone-1 { background: var(--chart-tone-1); }
.chart-swatch.tone-2 { background: var(--chart-tone-2); }
.chart-swatch.tone-3 { background: var(--chart-tone-3); }
.chart-swatch.tone-4 { background: var(--chart-tone-4); }

.chart-legend-label {
    font-weight: 300;
    color: var(--black, #000);
}

.chart-legend-value {
    font-weight: 700;
    color: var(--black, #000);
    font-variant-numeric: tabular-nums;
}

.chart-legend-share {
    min-width: 3.2rem;
    text-align: right;
    font-weight: 300;
    color: #767676;
    font-variant-numeric: tabular-nums;
}

@media screen and (max-width: 991.98px) {
    .chart-body {
        flex-direction: column;
        gap: 3rem;
    }

    .chart-legend {
        width: 100%;
        min-width: 0;
        max-width: 26rem;
    }
}

@media screen and (max-width: 575.9px) {
    .section-chart {
        padding-top: 15vw;
        padding-bottom: 15vw;
    }

    .section-chart.normal,
    .section-chart.bck-grey-set {
        padding-left: 15px;
        padding-right: 15px;
    }

    .chart-subtitle {
        margin-bottom: 2.5rem;
    }

    .chart-ring {
        width: 12rem;
    }

    .chart-total-value {
        font-size: 1.8rem;
    }
}
