/* V8 validator monitoring. Plain CSS, no build. Greycliff CF is served from
   this site (fonts/). The four state colours are checked for colour-blind
   separation; a state is never shown by colour alone. */

@font-face {
  font-family: 'Greycliff CF';
  src: url('fonts/greycliff-cf-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Greycliff CF';
  src: url('fonts/greycliff-cf-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Greycliff CF';
  src: url('fonts/greycliff-cf-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --yellow: #ffd200;
  --ink: #17191f;
  --muted: #586070;
  --surface: #ffffff;
  --wash: #f3f4f6;
  --rule: #dcdfe5;

  --connected: #008a17;
  --not-connected: #e59a00;
  --never-connected: #6a4ce2;
  --no-validator: #a9afba;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem/1.5 'Greycliff CF', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 82rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Masthead: the one loud thing ------------------------------------------ */

.masthead {
  background: var(--yellow);
}
.masthead-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  padding-top: 1.1rem;
  padding-bottom: 1rem;
}
h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.freshness {
  margin: 0;
  font-size: 0.95rem;
}

/* --- Messages ---------------------------------------------------------------- */

.notice {
  padding: 4rem 0;
}
.notice-title {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  font-weight: 800;
}
.notice p:last-child {
  margin: 0;
  color: var(--muted);
}
.stale {
  margin: 1.5rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 0.4rem solid var(--ink);
  background: var(--wash);
  font-weight: 600;
}

/* --- Sections ---------------------------------------------------------------- */

section {
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type {
  border-bottom: 0;
}
/* A short stroke of the masthead yellow, like a lane marking, opens each part. */
.section-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}
.section-title::before {
  content: '';
  display: block;
  width: 2.25rem;
  height: 0.35rem;
  margin-bottom: 0.6rem;
  background: var(--yellow);
}
.section-note {
  margin: 0.4rem 0 0;
  max-width: 68ch;
  color: var(--muted);
}

/* --- Overview: the pie, the sentence, the four counts --------------------- */

.overview {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 1fr;
  gap: 1.5rem 3rem;
  align-items: center;
}
.pie {
  width: 100%;
  height: auto;
}
.pie path,
.pie circle {
  stroke: var(--surface);
  stroke-width: 2;
  stroke-linejoin: round;
}
.pie text {
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.headline {
  margin: 0;
  max-width: 24ch;
  font-size: clamp(1.65rem, 1.1rem + 2.2vw, 2.6rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.015em;
}
.definition {
  margin: 0.75rem 0 0;
  max-width: 62ch;
  color: var(--muted);
}
.states {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.75rem 0 0;
  border-top: 1px solid var(--rule);
}
.states > div {
  padding: 0.9rem 1rem 0 0;
}
.states > div + div {
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
}
.states dt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  line-height: 1.25;
}
.states dd {
  margin: 0.2rem 0 0;
}
.states .value {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.05;
}
.states .share {
  margin-left: 0.4rem;
  color: var(--muted);
}
.aside {
  margin: 1rem 0 0;
  color: var(--muted);
}

/* --- State marks: a swatch always sits beside its name --------------------- */

.swatch {
  flex: none;
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}
.is-connected {
  background: var(--connected);
  fill: var(--connected);
}
.is-notConnected {
  background: var(--not-connected);
  fill: var(--not-connected);
}
.is-neverConnected {
  background: var(--never-connected);
  fill: var(--never-connected);
}
.is-noValidator {
  background: var(--no-validator);
  fill: var(--no-validator);
}
.is-retired {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--muted);
}
.pie text.on-dark {
  fill: #ffffff;
}
.pie text.on-light {
  fill: var(--ink);
}

/* --- Bars by operator and depot ------------------------------------------------ */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.9rem 0 0;
  font-size: 0.92rem;
}
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.legend .legend-note {
  color: var(--muted);
}
.groups {
  margin-top: 1.1rem;
}
.group {
  display: grid;
  grid-template-columns: minmax(9rem, 17rem) minmax(0, 1fr) 4.5rem;
  align-items: center;
  gap: 0 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule);
}
.group-name {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.group-name .operator {
  font-weight: 600;
}
.group-name .depot {
  color: var(--muted);
  font-size: 0.92rem;
}
.bar {
  display: flex;
  gap: 2px;
  height: 18px;
  min-width: 6px;
}
.bar .seg {
  flex-basis: 0;
  min-width: 3px;
}
.bar .seg:last-child {
  border-radius: 0 4px 4px 0;
}
.group-value {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* --- Tables ------------------------------------------------------------------ */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1.5rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-left: auto;
}
.filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}
select {
  max-width: 16rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--muted);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
.count {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
}
.table-scroll {
  margin-top: 0.9rem;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  padding: 0.5rem 0.7rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
th {
  border-bottom-color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
}
/* One line per vehicle; only a remark may wrap. On a narrow screen the table
   scrolls sideways in its box. */
td {
  white-space: nowrap;
}
td.wrap-cell {
  min-width: 10rem;
  white-space: normal;
}
.num {
  text-align: right;
}
td.empty {
  color: var(--muted);
}
.state {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
tbody tr:hover {
  background: var(--wash);
}
.no-rows td {
  padding: 1.5rem 0;
  color: var(--muted);
  white-space: normal;
}

/* --- Footer, tooltip, focus ---------------------------------------------------- */

.footer {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer p {
  margin: 0;
  max-width: 80ch;
}
.tooltip {
  position: fixed;
  z-index: 10;
  max-width: 18rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.88rem;
  line-height: 1.35;
  pointer-events: none;
}
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* --- Narrow screens ------------------------------------------------------------ */

@media (max-width: 46rem) {
  .overview {
    grid-template-columns: 1fr;
  }
  .pie {
    max-width: 11rem;
  }
  .states {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .states > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .states > div:nth-child(n + 3) {
    margin-top: 0.9rem;
    border-top: 1px solid var(--rule);
  }
  .group {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.35rem;
  }
  .group .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .filters {
    margin-left: 0;
  }
}

/* --- Paper ------------------------------------------------------------------- */

@media print {
  .masthead {
    background: none;
    border-bottom: 2px solid #000;
  }
  .filters,
  .tooltip {
    display: none;
  }
  .table-scroll {
    overflow: visible;
  }
  table {
    font-size: 0.72rem;
  }
  th,
  td {
    white-space: normal;
  }
  section {
    break-inside: auto;
  }
  tr {
    break-inside: avoid;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
