/*
 * Stylesheet for the code coverage report generated by php-code-coverage.
 *
 * The --coverage-* custom properties are filled in from
 * SebastianBergmann\CodeCoverage\Report\Html\Colors and can be configured;
 * everything else is a plain, dependency-free stylesheet.
 */

:root {
    /* Automatic light/dark theme selection via https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/light-dark */
    color-scheme: light dark;

    /* Configurable coverage colors */
    --coverage-breadcrumbs: light-dark({{breadcrumbs}}, {{breadcrumbs-dark}});
    --coverage-success-bar: light-dark({{success-bar}}, {{success-bar-dark}});
    --coverage-success-high: light-dark({{success-high}}, {{success-high-dark}});
    --coverage-success-medium: light-dark({{success-medium}}, {{success-medium-dark}});
    --coverage-success-low: light-dark({{success-low}}, {{success-low-dark}});
    --coverage-warning: light-dark({{warning}}, {{warning-dark}});
    --coverage-warning-bar: light-dark({{warning-bar}}, {{warning-bar-dark}});
    --coverage-danger: light-dark({{danger}}, {{danger-dark}});
    --coverage-danger-bar: light-dark({{danger-bar}}, {{danger-bar-dark}});

    /* Surfaces, text and borders */
    --background: light-dark(#ffffff, #0d1117);
    --surface: light-dark(#f6f8fa, #161b22);
    --surface-raised: light-dark(#ffffff, #1c2128);
    --border: light-dark(#d8dee4, #30363d);
    --border-strong: light-dark(#b4bcc5, #484f58);
    --text: light-dark(#1f2328, #e6edf3);
    --text-muted: light-dark(#59636e, #9198a1);
    --link: light-dark(#0969da, #4493f8);
    --link-hover: light-dark(#0550ae, #6cb6ff);
    --accent: light-dark(#0969da, #4493f8);
    --shadow: light-dark(0 6px 20px rgb(31 35 40 / 20%), 0 6px 20px rgb(0 0 0 / 60%));
    --track: light-dark(rgb(31 35 40 / 12%), rgb(230 237 243 / 16%));

    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Source Code Pro", Menlo, Consolas, "Liberation Mono", monospace;

    --radius: 6px;
    --gutter: 1.25rem;
}

/* -------------------------------------------------------------- base */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    font-kerning: normal;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

abbr[title] {
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: help;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

h2 {
    font-size: 1.0625rem;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* -------------------------------------------------------------- layout */

.masthead,
main,
footer {
    padding-inline: var(--gutter);
}

.masthead {
    padding-block: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    background-color: var(--surface);
}

main {
    padding-block: 1.25rem;
}

footer {
    padding-block: 1rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

footer p {
    margin: 0.5rem 0 0;
}

/* -------------------------------------------------------------- breadcrumbs */

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
    margin: 0;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    background-color: var(--coverage-breadcrumbs);
    list-style: none;
    font-size: 0.9375rem;
}

.breadcrumbs li + li::before {
    content: "/";
    margin-right: 0.5rem;
    color: var(--text-muted);
}

.breadcrumbs .current {
    font-weight: 600;
}

.breadcrumbs .secondary {
    margin-left: auto;
    font-size: 0.875rem;
}

.breadcrumbs .secondary::before {
    content: none;
}

/* -------------------------------------------------------------- tabs */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0.75rem 0 -1px;
    padding: 0;
    list-style: none;
}

.tabs a {
    display: block;
    padding: 0.4375rem 0.875rem;
    border: 1px solid transparent;
    border-radius: var(--radius) var(--radius) 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.tabs a:hover {
    color: var(--text);
    text-decoration: none;
}

.tabs a[aria-current] {
    border-color: var(--border);
    border-bottom-color: var(--background);
    background-color: var(--background);
    color: var(--text);
    font-weight: 600;
}

main > .tabs {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* -------------------------------------------------------------- summary */

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.metric {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name  count"
        "value value"
        "bar   bar";
    gap: 0.25rem 0.75rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--surface-raised);
}

.metric-name {
    grid-area: name;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.metric-count {
    grid-area: count;
    align-self: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.metric-percentage {
    grid-area: value;
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.metric-bar {
    grid-area: bar;
    align-self: center;
}

/* The metric cards carry the coverage level as a tint of their border only. */
.metric[data-level] {
    background-color: var(--background);
}

.metric[data-level="success"] {
    border-color: var(--coverage-success-bar);
}

.metric[data-level="warning"] {
    border-color: var(--coverage-warning-bar);
}

.metric[data-level="danger"] {
    border-color: var(--coverage-danger-bar);
}

.metric [data-level] {
    background-color: transparent;
}

/* -------------------------------------------------------------- toolbar */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem 1.5rem;
    margin-bottom: 0.75rem;
}

.test-size-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.control-label {
    margin-right: 0.125rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.test-size-filter input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.test-size-filter label,
.test-size-filter button {
    padding: 0.25rem 0.6875rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background-color: var(--background);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.test-size-filter label:hover,
.test-size-filter button:hover {
    border-color: var(--border-strong);
    color: var(--text);
}

/* a test size that no test of the report has covered any code with */
.test-size-filter input:disabled + label,
.test-size-filter input:disabled + label:hover {
    border-color: var(--border);
    border-style: dashed;
    color: var(--text-muted);
    opacity: 0.55;
    cursor: not-allowed;
}

.test-size-filter input:checked + label,
.test-size-filter button[aria-pressed="true"] {
    border-color: var(--accent);
    background-color: var(--accent);
    color: light-dark(#ffffff, #0d1117);
}

.test-size-filter input:focus-visible + label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* -------------------------------------------------------------- coverage table */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.coverage {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table.coverage thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0.5rem 0.75rem;
    background-color: var(--surface);
    box-shadow: inset 0 -1px 0 var(--border);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

table.coverage thead th.name {
    text-align: left;
}

table.coverage tbody tr + tr th,
table.coverage tbody tr + tr td {
    border-top: 1px solid var(--border);
}

table.coverage th,
table.coverage td {
    padding: 0.3125rem 0.75rem;
}

table.coverage tbody th.name {
    width: 100%;
    font-weight: normal;
    text-align: left;
    white-space: nowrap;
}

table.coverage td.bar-cell {
    width: 7.5rem;
    min-width: 7.5rem;
    padding-inline: 0.75rem;
    border-left: 1px solid var(--border);
}

table.coverage td.percentage,
table.coverage td.count,
table.coverage td.crap {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

table.coverage td.count {
    color: var(--text-muted);
}

/* -------------------------------------------------------------- coverage level */

[data-level="success"] {
    background-color: var(--coverage-success-low);
    --bar-color: var(--coverage-success-bar);
}

[data-level="warning"] {
    background-color: var(--coverage-warning);
    --bar-color: var(--coverage-warning-bar);
}

[data-level="danger"] {
    background-color: var(--coverage-danger);
    --bar-color: var(--coverage-danger-bar);
}

.bar {
    display: block;
    overflow: hidden;
    height: 0.5rem;
    border-radius: 999px;
    background-color: var(--track);
}

.bar > span {
    display: block;
    height: 100%;
    background-color: var(--bar-color, var(--text-muted));
}

.metric .bar {
    height: 0.375rem;
}

/* -------------------------------------------------------------- source code */

table.source {
    width: 100%;
    margin-top: 1.5rem;
    border-block: 1px solid var(--border);
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    tab-size: 4;
}

table.source td {
    padding: 0 0.75rem;
    vertical-align: top;
}

table.source td.line-number {
    width: 1%;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
    user-select: none;
}

table.source td.line-number a {
    color: inherit;
}

table.source td.line-number a:hover {
    color: var(--link);
    text-decoration: none;
}

table.source td.hit-count {
    width: 1%;
    padding-inline: 0.5rem;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    white-space: nowrap;
}

table.source:not(.with-hit-counts) td.hit-count {
    display: none;
}

table.source td.code {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

table.source tr.popin {
    cursor: pointer;
}

table.source tr:has(> td > a:target) {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.code .comment,
.code .html {
    color: var(--text-muted);
}

.code .keyword {
    font-weight: 600;
}

.branch-hit {
    color: var(--coverage-success-bar);
    font-weight: bold;
}

.branch-miss {
    color: var(--coverage-danger-bar);
    font-weight: bold;
}

/* -------------------------------------------------------------- coverage of a source line */

.covered-by-small-tests {
    background-color: var(--coverage-success-high);
}

.covered-by-medium-tests {
    background-color: var(--coverage-success-medium);
}

.covered-by-large-tests,
tr.success,
td.success,
span.success,
li.success {
    background-color: var(--coverage-success-low);
}

.not-covered,
tr.danger,
td.danger,
span.danger,
li.danger {
    background-color: var(--coverage-danger);
}

.not-coverable,
tr.warning,
td.warning,
span.warning,
li.warning {
    background-color: var(--coverage-warning);
}

/* -------------------------------------------------------------- legend */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legend li {
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    color: var(--text);
    font-size: 0.75rem;
}

/* -------------------------------------------------------------- popover */

.popover {
    position: fixed;
    max-width: min(46rem, calc(100vw - 2rem));
    max-height: min(28rem, calc(100vh - 2rem));
    margin: 0;
    padding: 0;
    overflow: auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background-color: var(--surface-raised);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 0.8125rem;
}

.popover-title {
    position: sticky;
    top: 0;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--surface);
    font-size: 0.8125rem;
    font-weight: 600;
}

.popover ul {
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
}

.popover li {
    padding: 0.125rem 0.75rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* -------------------------------------------------------------- branch and path structure */

.structure {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.structure > p {
    max-width: 70ch;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.structure-heading {
    margin: 1.5rem 0 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
}

.structure-heading .badge {
    margin-left: 0.375rem;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
}

table.structure-table {
    border-collapse: collapse;
    font-size: 0.8125rem;
}

table.structure-table th,
table.structure-table td {
    padding: 0.1875rem 0.625rem;
    border: 1px solid var(--border);
    white-space: nowrap;
}

table.structure-table th {
    background-color: var(--surface);
    text-align: left;
}

.structure-table .popin {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: pointer;
}

.path-row {
    cursor: pointer;
}

.path-row.path-selected {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* -------------------------------------------------------------- control flow graph */

.cfg-graph {
    margin: 0.75rem 0 1.5rem;
    padding: 0.5rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--background);
}

.cfg-graph svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.cfg-graph text {
    fill: var(--text);
    font-family: var(--font-sans);
}

.cfg-graph .node polygon,
.cfg-graph .node ellipse {
    fill: var(--surface);
    stroke: var(--text-muted);
}

.cfg-graph .node.covered polygon {
    fill: var(--coverage-success-low);
    stroke: var(--coverage-success-bar);
}

.cfg-graph .node.uncovered polygon {
    fill: var(--coverage-danger);
    stroke: var(--coverage-danger-bar);
}

.cfg-graph .edge path {
    stroke: var(--text-muted);
}

.cfg-graph .edge polygon {
    fill: var(--text-muted);
    stroke: var(--text-muted);
}

.cfg-graph .edge.covered path {
    stroke: var(--coverage-success-bar);
}

.cfg-graph .edge.covered polygon {
    fill: var(--coverage-success-bar);
    stroke: var(--coverage-success-bar);
}

.cfg-graph .edge.uncovered path {
    stroke: var(--coverage-danger-bar);
}

.cfg-graph .edge.uncovered polygon {
    fill: var(--coverage-danger-bar);
    stroke: var(--coverage-danger-bar);
}

.cfg-graph .edge.highlighted path,
.cfg-graph .edge.highlighted polygon {
    fill: var(--accent);
    stroke: var(--accent);
    stroke-width: 3px;
}

.cfg-graph .node.highlighted polygon,
.cfg-graph .node.highlighted ellipse {
    stroke: var(--accent);
    stroke-width: 3px;
}

/* -------------------------------------------------------------- dashboard */

main.dashboard {
    display: grid;
    gap: 2.5rem;
    padding-bottom: 2rem;
}

main.dashboard .panel {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem 2rem;
    align-items: start;
    margin-top: 0.25rem;
}

main.dashboard .hint {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

main.dashboard .chart {
    /* Beyond this the bubbles gain no clarity, they just get further apart. */
    max-width: 60rem;
}

main.dashboard .chart svg {
    display: block;
    width: 100%;
    height: auto;
}

main.dashboard .scrollbox {
    max-width: 45rem;
    max-height: 30rem;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (max-width: 64rem) {
    main.dashboard .panel {
        grid-template-columns: minmax(0, 1fr);
    }
}

table.crap {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

table.crap th {
    position: sticky;
    top: 0;
    background-color: var(--surface);
    box-shadow: inset 0 -1px 0 var(--border);
    text-align: left;
    white-space: nowrap;
}

table.crap th,
table.crap td {
    padding: 0.25rem 0.75rem;
}

table.crap tbody tr + tr td {
    border-top: 1px solid var(--border);
}

table.crap .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- icons */

/* GitHub Octicons (MIT), inlined as masks so that they follow the text color */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.375em;
    vertical-align: -0.125em;
    background-color: currentColor;
    opacity: 0.6;
    mask: var(--icon) center / contain no-repeat;
}

.icon-file {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16'%3E%3Cpath d='M8.5 1H1c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h10c.55 0 1-.45 1-1V4.5L8.5 1zM11 14H1V2h7l3 3v9zM5 6.98L3.5 8.5 5 10l-.5 1L2 8.5 4.5 6l.5.98zM7.5 6L10 8.5 7.5 11l-.5-.98L8.5 8.5 7 7l.5-1z'/%3E%3C/svg%3E");
}

.icon-directory {
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M13 4H7V3c0-.66-.31-1-1-1H1c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zM6 4H1V3h5v1z'/%3E%3C/svg%3E");
}

/* -------------------------------------------------------------- back to the top */

.to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 50%;
    background-color: var(--surface-raised);
    color: var(--text-muted);
    box-shadow: var(--shadow);
}

.to-top[hidden] {
    display: none;
}

.to-top:hover {
    color: var(--text);
}

.to-top svg {
    fill: currentColor;
}

/* -------------------------------------------------------------- narrow viewports */

@media (max-width: 40rem) {
    :root {
        --gutter: 0.75rem;
    }

    .summary {
        grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
    }

    .metric-percentage {
        font-size: 1.25rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}
