:root {
    color-scheme: light dark;
    font-family: system-ui, sans-serif;
}

body {
    margin: 0;
    padding: clamp(1rem, 4vw, 3rem);
    background: #f6f7fb;
    color: #172033;
}

main {
    max-width: 1100px;
    margin: auto;
}

h1 {
    margin-bottom: .25rem;
}

p {
    color: #536078;
    margin-top: 0;
}

.chart {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 30px #17203314;
    padding: 1rem;
}

svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.grid {
    stroke: #dce1ea;
    stroke-width: 1;
}

.axis {
    fill: #536078;
    font-size: 12px;
}

nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 14px;
}

nav a {
    color: #536078;
}

nav a[aria-current="page"] {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.legend {
    display: flex;
    justify-content: center;
    margin-top: .75rem;
    font-size: 14px;
}

.legend th, .legend td {
    padding: .2rem .6rem;
    text-align: center;
    font-weight: normal;
}

.legend tr > th:first-child {
    max-width: 14rem;
    text-align: left;
    color: #536078;
}

/* A legend grouped by what it keys sets each group off from the one above, led by its first row's name. */
.legend table {
    border-collapse: collapse;
}

.legend tbody + tbody > tr:first-child > * {
    border-top: 1px solid #d5dbe5;
    padding-top: .5rem;
}

.legend tbody > tr:first-child > th:first-child {
    font-weight: 600;
}

/* An explanation rather than a key, so it reads as a sentence. */
.legend td.note {
    max-width: 32rem;
    text-align: left;
}

/* The overview's tables: a name down the left, numbers to its right, so the digits line up. */
.summary table {
    border-collapse: collapse;
    font-size: 14px;
}

.summary th, .summary td {
    padding: .3rem .8rem;
    text-align: right;
    font-weight: normal;
}

.summary tr > th:first-child {
    text-align: left;
    color: #536078;
}

/* A heading links to the page that says more, and reads as a heading rather than as a visited link. */
.summary h2 a {
    color: inherit;
}

.summary tr:first-child > th {
    font-weight: 600;
}

/* A state above its WIP limit, in the red the history runs its line on there. */
.summary .over-limit {
    color: #b91c1c;
    font-weight: 600;
}

.key::before {
    content: '';
    display: inline-block;
    width: .8rem;
    height: .8rem;
    background: var(--color);
}

.key:not(.line)::before {
    opacity: .55;
}

.key.line::before {
    width: 1.5rem;
    height: 2px;
    vertical-align: middle;
}

/* A dashed key carries its line's dash: the gradient repeats the same on/off run the stroke-dasharray draws. */
.key.line.dashed::before {
    background: repeating-linear-gradient(90deg, var(--color) 0 4px, transparent 4px, transparent 8px);
}

.key.line.dotted::before {
    background: repeating-linear-gradient(90deg, var(--color) 0 2px, transparent 2px, transparent 7px);
    border-radius: 1px;
}

/* The red a line runs on while its state is above its limit: as wide as it is drawn behind the line. */
.key.line.over-limit::before {
    height: 9px;
    border-radius: 4.5px;
}

/* The age band is context behind a panel's line, so it stays faint. */
.age {
    fill-opacity: .3;
    stroke-opacity: .3;
}

/* The lines are the finding, so they lift off the grid and the age band behind them. */
.deviation, .state-wip, .forecast {
    filter: drop-shadow(0 0 1.5px white);
}

.state-wip, .forecast {
    stroke-width: 2.5;
}

/* Round caps are what make the shortest dash read as a dot rather than as a very short dash. */
.forecast.dotted {
    stroke-linecap: round;
}

/* The cycle time difference shares a panel with the state's own line, and stays thinner than it. */
.deviation {
    stroke-width: 1.5;
}

.hover {
    pointer-events: none;
}

.hover line {
    stroke: currentColor;
    stroke-dasharray: 4 4;
}

.hover text {
    fill: currentColor;
    font-size: 13px;
    paint-order: stroke;
    stroke: white;
    stroke-width: 4px;
    stroke-linejoin: round;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #111827;
        color: #f3f4f6;
    }

    p, .axis, .legend tr > th:first-child, .summary tr > th:first-child, nav a {
        color: #cbd5e1;
        fill: #cbd5e1;
    }

    .summary .over-limit {
        color: #f87171;
    }

    .chart {
        background: #1f2937;
    }

    .grid {
        stroke: #475569;
    }

    .legend tbody + tbody > tr:first-child > * {
        border-top-color: #475569;
    }

    .hover text {
        stroke: #1f2937;
    }

    .deviation, .state-wip, .forecast {
        filter: drop-shadow(0 0 1.5px #1f2937);
    }
}
