/*
 * assets.css — an asset's readings over time, a value past its limit, a corrected reading
 * (Patterns/Anlagen).
 *
 * <figure class="app-asset-chart" role="img" aria-label="Hochdruck von Dez. bis Nov.: …">
 *   <div class="app-asset-chart-axis" aria-hidden="true"><span>22</span><span>19</span><span>16</span></div>
 *   <div class="app-asset-chart-plot" aria-hidden="true">
 *     <div class="app-asset-chart-area">
 *       <svg class="app-asset-chart-canvas" viewBox="0 0 120 100" preserveAspectRatio="none">
 *         <line class="app-asset-chart-grid" vector-effect="non-scaling-stroke" />   (one per tick)
 *         <polyline class="app-asset-chart-line" vector-effect="non-scaling-stroke" />
 *       </svg>
 *       <span class="app-asset-chart-last" style="inset-inline-start: …%; inset-block-start: …%"></span>
 *     </div>
 *   </div>
 *   <ol class="app-asset-chart-months" role="list" aria-hidden="true"><li>Dez.</li>…</ol>
 * </figure>
 *
 * The chart repeats the table under it for the eye: the table is what is read out. The line is
 * drawn in the plot's own units and stretched to its width; its stroke does not scale, and the
 * ticks and months are text beside and under it, so they keep their size on every width. The
 * line is grey; the latest point is the accent, as "here". Under a region of 560 every other
 * month is left out so the names keep their room.
 *
 * In the reading dialog a value past the limit its definition sets says so under its field in
 * the warning text; it can still be saved:
 *   <div class="app-asset-limit">[number field with its hint: Über 45 bar]</div>
 *
 * A corrected reading says so in its row, in muted text (what it replaced is in the history):
 *   <span class="app-asset-corrected">korrigiert</span>
 *
 * The readings' menu column has a header for assistive technology only:
 *   <th class="app-table-header" …><span class="app-asset-hidden">Aktionen</span></th>
 */
@layer components {
    .app-asset-chart {
        display: grid;
        grid-template-rows: calc(3 * var(--app-control-height-regular)) auto;
        grid-template-columns: var(--app-control-height-compact) minmax(0, 1fr);
        gap: var(--app-space-inline);
        margin: 0;
        color: var(--app-color-text-subtle);
        font-size: var(--app-text-help-size);
        line-height: var(--app-text-help-leading);
        font-variant-numeric: tabular-nums;
    }

    .app-asset-chart-axis {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        text-align: end;
    }

    .app-asset-chart-plot {
        padding-block: var(--app-space-inline);
    }

    .app-asset-chart-area {
        position: relative;
        block-size: 100%;
    }

    .app-asset-chart-canvas {
        position: absolute;
        inset: 0;
        display: block;
        inline-size: 100%;
        block-size: 100%;
        overflow: visible;
    }

    .app-asset-chart-grid {
        stroke: var(--app-color-line);
    }

    .app-asset-chart-line {
        fill: none;
        stroke: var(--app-color-text-muted);
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .app-asset-chart-last {
        position: absolute;
        inline-size: var(--app-space-inline);
        block-size: var(--app-space-inline);
        border-radius: var(--app-radius-round);
        background: var(--app-color-accent);
        box-shadow: 0 0 0 var(--app-border-width) var(--app-color-surface);
        translate: -50% -50%;
    }

    .app-asset-chart-months {
        display: grid;
        grid-column: 2;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        padding: 0;
        margin: 0;
        list-style: none;
        text-align: center;
        white-space: nowrap;
    }

    @container app-region (width < 560px) {
        .app-asset-chart-months > :nth-child(even) {
            visibility: hidden;
        }
    }

    .app-asset-limit .app-field-hint {
        color: var(--app-color-warning-text);
        font-weight: var(--app-text-label-weight);
    }

    .app-asset-corrected {
        color: var(--app-color-text-muted);
    }

    /* The header of the readings' menu column, read out only: the "…" says what it holds. */
    .app-asset-hidden {
        position: absolute;
        inline-size: var(--app-border-width);
        block-size: var(--app-border-width);
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    @media (forced-colors: active) {
        .app-asset-chart-line {
            stroke: var(--app-color-forced-line);
        }

        .app-asset-chart-last {
            background: var(--app-color-forced-current);
        }
    }
}
