/*
 * ASM's board: what Arena Broadcast does not have yet, and nothing else.
 *
 * Everything on the page is drawn with Arena Broadcast's own classes (vendor/arena-broadcast). This file
 * holds the ASM mark and the little layout the board needs around those parts. Its rules are Arena
 * Broadcast's: every color and size is a token, every corner is square, nothing glows, and lime and coral
 * appear only as a state.
 *
 * What is here because Arena Broadcast lacks it is proposed there, not kept here for good
 * (docs/PLAN.md, M2): a level pill for four levels, an uptime bar, a log view.
 */

/* ---- The mark ---------------------------------------------------------------------------------------- */

.asm-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ab-white);
  text-decoration: none;
}

/* As tall as the lockup's wordmark beside it. */
.asm-mark {
  flex-shrink: 0;
  width: var(--ab-fs-lockup);
  height: var(--ab-fs-lockup);
}

.asm-mark--hero {
  width: 72px;
  height: 72px;
}

.asm-mark__frame {
  fill: none;
  stroke: var(--ab-white);
  stroke-width: 2;
}

.asm-mark__line {
  fill: var(--ab-line);
}

/* The instruction being run, and the pointer at it: white until the state of production is known. */
.asm-mark__line--now,
.asm-mark__pointer {
  fill: var(--ab-white);
}

.asm-mark--ok .asm-mark__line--now,
.asm-mark--ok .asm-mark__pointer {
  fill: var(--ab-lime);
}

.asm-mark--down .asm-mark__line--now,
.asm-mark--down .asm-mark__pointer {
  fill: var(--ab-coral);
}

/* ---- The page ---------------------------------------------------------------------------------------- */

.asm-page {
  width: 100%;
  margin-inline: auto;
}

/* The words under the headline: when the board was judged. */
.asm-checked {
  margin: 6px 0 0;
}

/* Before signing in: the mark, the name and the one thing to do, in the middle of the page. */
.asm-door {
  display: grid;
  justify-items: start;
  gap: 18px;
  max-width: 560px;
  margin: 8vh 0 0;
}

/* ---- One engine -------------------------------------------------------------------------------------- */

/* The head's right end: the level, and since when. */
.asm-engine__standing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 12px;
  text-align: right;
}

.asm-engine__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding-top: 16px;
}

/* A day's bar is a day, so the bars sit close: ninety of them fit a phone. */
.asm-days {
  gap: var(--ab-edge-w);
}

/* The four signals, four across; two across on a narrow page. */
.asm-signals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--ab-space-gap-tile);
}

.asm-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

/* A table's level column is as wide as its widest pill, and no wider. */
.asm-level-cell {
  width: 1%;
  white-space: nowrap;
}

/* What was found, in the engine's own words: long, unbroken strings wrap instead of widening the page. */
.asm-words {
  overflow-wrap: anywhere;
}

/* ---- A signal over a day ------------------------------------------------------------------------------ */

.asm-trend {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  padding: 12px 0;
  border-top: var(--ab-edge-w) solid var(--ab-divider);
}

.asm-trend:first-child {
  border-top: 0;
}

.asm-trend__now {
  display: grid;
  gap: 2px;
}

/* ---- The log ----------------------------------------------------------------------------------------- */

.asm-log-ask {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: end;
  gap: 12px;
}

/* The lines, in a box of their own that scrolls: a long stretch of log does not push the page away. */
.asm-log {
  max-height: 560px;
  padding: 0 14px;
  overflow-y: auto;
  background: var(--ab-ink);
  border: var(--ab-edge-w) solid var(--ab-edge);
}

.asm-log .ab-lane__body {
  display: block;
  color: var(--ab-light);
  overflow-wrap: anywhere;
}

/* A line that tells of trouble: the whole line in the color the trouble has everywhere else. */
.asm-log__line--trouble .ab-lane__body {
  color: var(--ab-coral);
}

/* ---- Phone reference (D-09) --------------------------------------------------------------------------- */

@media (width < 768px) {
  /* The lockup is at its compact size on a phone, and the mark with it. */
  .asm-brand .asm-mark {
    width: var(--ab-fs-lockup-compact);
    height: var(--ab-fs-lockup-compact);
  }

  .asm-signals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asm-log-ask {
    grid-template-columns: minmax(0, 1fr);
  }

  .asm-trend {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .asm-door {
    margin-top: 4vh;
  }
}
