.diagram-placements {
    display: flex;
    flex-direction: column;
    gap: 0;

    .h2 {
        font-size: 2.5rem;
        color: var(--c-secondary);
        line-height: 1;
    }

    .h3 {
        line-height: 1;
    }
}

/* ── Treemap ─────────────────────────────────────────────────── */

/* Mobile: panels stacked full-width, height = ratio */
.placement-treemap {
    display: flex;
    flex-direction: column;
    width: 100%;
    /* Container for cqw units used in panel height */
    container-type: inline-size;
}

.placement-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 1.5rem;
}

.placement-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    /* cqw references .placement-treemap width — gives proportional heights */
    height: calc(var(--panel-ratio) * 3cqw);
    cursor: pointer;
    /* container-type here only affects cqi for font sizing inside the panel */
    container-type: inline-size;
}

/* Desktop: CSS grid — panels in row 1, active content spans full width in row 2 */
@media (width >=768px) {
    .placement-treemap {
        display: grid;
        grid-template-columns: 44.1fr 30.4fr 24.5fr;
        align-items: end;
        container-type: normal;
    }

    /* display: contents flattens items into direct grid children */
    .placement-item {
        display: contents;
        margin-bottom: 0;
    }

    /* Each panel auto-places into the next column of row 1 */
    .placement-panel {
        grid-row: 1;
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }

    /* Active content spans all columns in row 2 */
    .placement-content {
        grid-row: 2;
        grid-column: 1 / -1;
        padding: 1.5rem;
    }
}

/* ── Panel internals ─────────────────────────────────────────── */

.placement-panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--panel-color, #ccc);
    padding: 1rem;
    min-height: 0;
}

.placement-label {
    font-size: 1.5625rem;
    line-height: 1.3;
}

.placement-percentage {
    font-family: 'proxima-nova', sans-serif;
    font-size: 38cqi;
    font-weight: 700;
    line-height: 1;

    sup {
        font-size: 0.4em;
        vertical-align: top;
        position: relative;
        top: 0.25em;
        line-height: 1;

        @media (width >=768px) {
            font-size: 0.25em;
            top: 0.5em;
        }
    }
}

.placement-toggle {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 1em;
    background-color: var(--panel-color, #ccc);
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;

    .toggle-arrow-circle {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 32px;
        height: 32px;
        background-color: white;
        border-radius: 50%;
        transition: transform 0.2s ease;
    }

    .toggle-arrow {
        width: 16px;
        height: 16px;
        filter: invert(1);
    }
}

.placement-item .toggle-label-less {
    display: none;
}

.placement-item .toggle-label-more {
    display: inline;
}

.placement-item.is-active .toggle-label-less {
    display: inline;
}

.placement-item.is-active .toggle-label-more {
    display: none;
}

.placement-item.is-active .toggle-arrow-circle {
    transform: rotate(180deg);
    border: 1px solid var(--c-secondary);
}

/* ── Accordion content ───────────────────────────────────────── */

.placement-content {
    display: none;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 3em;
    background-color: #f6f6f6;
    font-size: 1em;
}

.placement-item.is-active .placement-content {
    display: flex;
}

.placement-content-header {
    display: flex;
    flex-direction: column;

    .h3 {
        font-weight: normal;
        font-size: 2.375rem;
    }

    .text-info {
        font-size: 1em;
        margin-bottom: 0;
    }
}

.placement-examples {
    display: grid;
    gap: 1.5rem;

    @media (width >=768px) {
        grid-template-columns: repeat(4, 1fr);
    }
}

.placement-example {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 1em;
    line-height: 1.4;

    p {
        margin-bottom: 0;
        line-height: 1;
    }

    strong {
        font-weight: bold;
    }
}