/* root */
:root {

  /* prevent overscroll and pull-refresh */
  overscroll-behavior: none;

  /* base colors */
  --green: #00b600;
  --yellow: #e1e100;
  --orange: #ffa500;
  --red: #ff0000;
  --white: #ffffff;
  --black: #000000;

  /* context colors */
  --operational-color: var(--green);
  --degraded-color: var(--yellow);
  --non-operational-color: var(--red);
  --unknown-color: var(--orange);

  /* color assignments */
  --base-color: var(--green);
  --base-bg: var(--black);

}

/* reset */
*, *::before, *::after {
  box-sizing: border-box;
}
*:focus-visible, *:focus:focus-visible {
  outline: 6px solid #00b600 !important;
}
*:not(dialog) {
  margin: 0;
}
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}
html, body {
  font-size: 12px;
  font-family: monospace;
}
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}
input, button, textarea, select {
  font: inherit;
}
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}
p {
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}
#root, #__next {
  isolation: isolate;
}

/* elements */
h1, h2, h3, h4, h5, h6 {
  font-size: 1rem;
  font-weight: bold;
}
ul {
  list-style-type: none;
  padding-left: 0;
}
fieldset {
  border: 1px solid var(--base-color);
}
legend {
  line-height: 1;
  font-size: 1.75rem;
  font-variant: all-small-caps;
  font-weight: bold;
}
a {
  color: var(--base-color);
}

/* layout */
.wm__page {
  display: flex;
  flex-direction: column;
  color: var(--base-color);
  background-color: var(--base-bg);
  min-height: 100dvh;
  overflow-x: hidden;
}
.wm__page__top {
  /* placeholder */
}
.wm__page__middle {
  display: flex;
  flex-grow: 1;
}
.wm__page__bottom {
  margin: 0 1rem;
}
.wm__page__left {
  /* placeholder */
}
.wm__page__center {
  flex-grow: 1;
}
.wm__page__right {
  /* placeholder */
}

/* components */
.wm__header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem 1rem;   /* room above the splash for the < Back link */
}
.wm__header__top {
  width: 100%;
  display: flex;
}
.wm__header__top__left {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.wm__header__top__right {
  padding: 0;
  flex-grow: 1;
}
.wm__header__bottom {

}
.wm__header pre {
  width: fit-content;
}
.wm__splash--lg {
  display: block;
}
.wm__splash--md {
    padding-top: 1.25rem;
  display: none;
}
.wm__splash--sm {
  display: none;
}
.wm__title {
    text-align: center;
    margin-top: 0.5rem;
}
.wm__subtitle {
    text-align: center;
  font-weight: normal;
  font-size: 0.75rem;
}
.wm__status {
  width: 100%;
  text-align: center;
  text-transform: uppercase;
}
.wm__status--header {
  margin-top: 0.5rem;
}
.wm__status--device {
  display: inline-block;
  margin: 0.25rem 0 0.25rem 0;
  padding: 0 0.5rem;
  width: fit-content;
  font-weight: bold;
}
.wm__status--footer {
  padding: 0 0.5rem;
}
.wm__status--operational {
  color: var(--black);
  background-color: var(--operational-color);
}
.wm__status--degraded {
  color: var(--black);
  background-color: var(--degraded-color);
}
.wm__status--non-operational {
  color: var(--white);
  background-color: var(--non-operational-color);
}
.wm__status--unknown {
  color: var(--black);
  background-color: #00b60050;
}
.wm__main-container {
  display: flex;
  gap: 1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
.wm__about-container {
  line-height: 1;
  margin: 1rem 1rem 0;
  padding: 1rem;
  border: 1px solid var(--base-color);
}
.wm__map-container {
  display: flex;
  width: 400px;
  height: 500px;
  min-width: 400px;
  position: relative;
}
.wm__map {
  width: 100%;
}
.wm__map svg {
  /* placeholder */
}
.wm__map-container svg {
  width: 100%;
  height: 100%;
}
.wm__guidance-strip {
  display: none;
  padding-left: 1rem;
}
.wm__guidance-strip svg {
  color: rgba(0,255,0,0.15);
  width: fit-content;
  min-width: fit-content;
}
.wm__info-container {
  position: relative;
  flex-grow: 1;
}
.wm__device-categories {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}
.wm__device-category-vert-cont {
  width: 25%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.wm__device-category-vert-cont .wm__device-category,
.wm__device-category-vert-cont .wm__station-category {
  width: 100%;
}
.wm__device-category {
  width: 25%;
}
.wm__device-categories > * {
  flex: 1 1 0;              /* four equal columns: 25% each with the gaps taken out evenly */
  min-width: 0;
}
.wm__device-categories fieldset {
  min-width: 0;             /* a fieldset is never narrower than its content by default */
  overflow-wrap: anywhere;
}
.wm__device__status {
  flex-wrap: wrap;          /* status pill and time stack when the column is narrow */
  row-gap: 0;
}
.wm__device-category fieldset {
  padding-bottom: 1rem;
}
.wm__devices {
  display: flex;
  flex-direction: column;
  gap: 1rem
}
.wm__device {
  /* placeholder*/
}
.wm__device__name,
.wm__commands__name {
  font-size: 1.25rem;
  font-weight: bold;
  line-height: 1.1;
}
.wm__device__data-list {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 0 1rem;
}
.wm__device__data-item {

}
.wm__device__kvp {
    font-size: 10px;
}
.wm__device__kvp span:first-of-type{
    font-weight: bold;
}
.wm__device__kvp span:first-of-type span{
    padding-right: 0.25rem;
}
.wm__device__kvp span:last-of-type{
    font-weight: normal;
}
.wm__device__status {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.wm__device__status__dtg {
  font-size: 0.75rem;
  white-space: nowrap;
}
.wm__station-categories,
.wm__commands-categories {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.wm__commands__groups {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
.wm__commands__group {

}
.wm__commands__buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.wm__button {
    background: transparent;
    border: none;
    color: var(--green);
    border: 2px solid var(--green);
    font-size: 10px;
}
.wm__footer {
  display: flex;
  justify-content: space-between;
  margin: 0.5rem 0 0.5rem;
}
.wm__footer__left {
  /* placeholder */
}
.wm__footer__center {
  /* placeholder */
}
.wm__footer__right {
  /* placeholder */
}

/* media queries */
@media (max-width: 1024px) {
  .wm__splash--lg {
    display: none;
  }
  .wm__splash--md {
    display: block;
  }
  .wm__splash--sm {
    display: none;
  }
  .wm__main-container {
    flex-direction: column-reverse;
  }
  .wm__map-container {
    width: 100%;
    min-width: unset;
    height: 400px;
  }
  .wm__map {
    border: 1px solid var(--base-color);
  }
  .wm__guidance-strip {
    display: block;
  }
}
@media (max-width: 576px) {
  .wm__splash--lg {
    display: none;
  }
  .wm__splash--md {
    display: none;
  }
  .wm__splash--sm {
    display: block;
  }
  .wm__header__top {
    flex-direction: column;
  }
  .wm__header__top__right {
    height: 12rem;
  }
  .wm__device-categories {
    flex-direction: column;
  }
  .wm__station-category fieldset {
    width: 100%;
  }
  .wm__device-category-vert-cont {
    width: 100%;
  }
  .wm__device-category {
    width: 100%;
  }
  .wm__device-categories > * {
    flex: none;             /* stacked, each 100% wide */
  }
}

/* activity chart (chart.js): fills the header's right side; 1H / 1D / 7D at its top right */
.wm__chart {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 10rem;
}
.wm__chart__svg {
  /* out of the layout: the chart fills the header's height instead of setting it (an SVG in the flow
     keeps its last drawn shape, which held the header tall after a resize) */
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.wm__chart__ranges {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.25rem;
}
.wm__chart__ranges button {
  padding: 0 0.25rem;
  color: var(--base-color);
  background: none;
  border: none;
  font-size: 10px;
  opacity: 0.5;
  cursor: pointer;
}
.wm__chart__ranges button:hover,
.wm__chart__ranges button[aria-pressed="true"] {
  opacity: 1;
}
.wm__chart__ranges button[aria-pressed="true"] {
  text-decoration: underline;
}
.wm__chart__series {
  cursor: pointer;
  transition: opacity 0.15s;
}
.wm__chart__hit {
  pointer-events: stroke;      /* a wide invisible stroke, so a 1px line is easy to point at */
}
.wm__chart__svg--focus .wm__chart__series:not(.wm__chart__series--focus) {
  opacity: 0.2;
}

/* utility classes */
.whitespace-nowrap {
  white-space: nowrap;
}
.d-none {display: none;}
.d-flex {
  display: flex;
}
.flex-column {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
 gap: 1rem;
}
.denote-success {
    color: var(--green);
    border-color: var(--green);
}
.denote-warning {
    color: var(--yellow);
    border-color: var(--yellow);
}
.denote-danger {
    color: var(--red);
    border-color: var(--red);
}

/* corner links between the station pages */
.wm__corner {
  position: absolute;
  top: 0.5rem;
  z-index: 1;
}
.wm__corner--left {
  left: 0.75rem;
}
.wm__corner--right {
  right: 0.75rem;
}

/* map pan and zoom (main.js, panzoom): +, -, [ ] buttons in the corner, "ctrl + scroll" hint on top */
.wm__map {
  position: relative;
  overflow: hidden;
}
.wm__map svg {
  cursor: grab;
  touch-action: none;
}
.wm__map svg:active {
  cursor: grabbing;
}
.wm__map path {
  vector-effect: non-scaling-stroke;   /* outlines stay 1px at any zoom */
}
.wm__map-controls {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  display: flex;
  gap: 0.25rem;
}
.wm__map-controls button {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--base-color);
  background-color: var(--base-bg);
  border: 1px solid var(--base-color);
  font-weight: bold;
  cursor: pointer;
}
.wm__map-controls button:hover,
.wm__map-controls button:focus-visible {
  color: var(--base-bg);
  background-color: var(--base-color);
  outline: none;
}
.wm__map-hint {
  position: absolute;
  left: 50%;
  top: 0.5rem;
  transform: translateX(-50%);
  padding: 0 0.5rem;
  color: var(--base-bg);
  background-color: var(--base-color);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.wm__map-hint--visible {
  opacity: 1;
}

/* log box: events newest first, scrolls inside the box (full width with the others on small screens) */
.wm__log {
  list-style: none;
  padding: 0;
  max-height: 40rem;
  overflow-y: auto;
  font-size: 10px;          /* as the devices' key/value pairs */
}
.wm__log__entry {
  padding: 0.15rem 0;
}
.wm__log__time {
  display: block;
  font-weight: bold;
}
.wm__map-city {
  fill: var(--base-color);
  fill-opacity: 0.35;
  stroke: var(--base-color);
}
.wm__map-labels text {
  fill: var(--base-color);
  stroke: var(--base-bg);           /* a dark edge keeps names readable over county lines */
  paint-order: stroke;
  dominant-baseline: middle;
  font-family: monospace;
  pointer-events: none;
}
