@layer components {
    /* the /footprint charts: footprint.js renders them into the panel body, so the scope owns that markup outright */
    @scope (.footprint) {
        :scope {
            --footprint-swatch: 14px;
        }

        svg {
            display: block;
            overflow: visible;
        }

        /* the server draws the charts at the desktop width; this fits them on smaller screens until the script redraws them */
        svg[role="img"] {
            max-width: 100%;
            height: auto;
        }

        text {
            font-size: 10px;
            fill: var(--muted);
        }

        .footprint-defs {
            position: absolute;
        }

        .footprint-value {
            fill: var(--fg);
        }

        /* chart marks */

        .footprint-box {
            stroke: var(--fg);
        }

        .footprint-gridline {
            stroke: var(--line);
            stroke-dasharray: 1 3;
        }

        .footprint-baseline {
            stroke: var(--fg);
        }

        .footprint-avg {
            stroke: var(--fg);
            stroke-dasharray: 4 3;
            mix-blend-mode: difference;
        }

        .footprint-hover {
            fill: var(--tint);
            pointer-events: none;
        }

        .footprint-swatch {
            width: var(--footprint-swatch);
            height: var(--footprint-swatch);
            flex: none;
        }

        /* charts and their keys */

        .footprint-legend li {
            display: grid;
            grid-template-columns: var(--footprint-swatch) 1fr auto 40px;
            align-items: center;
            gap: 10px;
            padding-block: 8px;
            border-block-start: var(--border);

            > :last-child {
                text-align: end;
            }
        }

        .footprint-history svg {
            touch-action: pan-y;
            cursor: crosshair;
        }

        .footprint-chart {
            display: grid;
            gap: 6px;
        }

        .footprint-chart-head {
            display: flex;
            justify-content: space-between;
            font-size: var(--text-xs);
        }

        .footprint-key {
            display: flex;
            flex-wrap: wrap;
            gap: 6px 18px;
            font-size: var(--text-xs);

            li {
                display: flex;
                align-items: center;
                gap: 8px;
            }
        }
    }
}
