/* The display's look: its tan screen, LVGL's dark grey text, Montserrat. */

@font-face { font-family: Montserrat; font-weight: 500; src: url(/fonts/montserrat-latin-500-normal.woff2) format("woff2"); }
@font-face {
  font-family: Montserrat; font-weight: 500; src: url(/fonts/montserrat-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: Montserrat; font-weight: 700; src: url(/fonts/montserrat-latin-700-normal.woff2) format("woff2"); }
@font-face {
  font-family: Montserrat; font-weight: 700; src: url(/fonts/montserrat-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: #F1D0A2;
  color: #212121;
  font: 500 16px/1.4 Montserrat, system-ui, sans-serif;
}

/* The title stays centred: equal columns either side, the button in the right
   one. On a narrow screen the title gives up width, and is cut short. */
.banner {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(0, auto) minmax(max-content, 1fr);
  align-items: center;
  column-gap: 12px;
  min-height: 52px;
  padding: 8px 16px;
  background: #2196F3;
  color: #fff;
  border-bottom: 2px solid #000;
  text-align: center;
}
.banner button {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  padding: 4px 12px;
  background: #fff;
  color: #212121;
  border: 1px solid #000;
  font-size: 13px;
  white-space: nowrap;
}
.banner h1 {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 22px;
  font-weight: 700;
}
.heading { margin: 4px 0 8px; font-size: 18px; text-align: center; }

#status {
  margin: 0;
  padding: 8px 16px;
  background: #E3FF57;
  border-bottom: 1px solid #000;
  text-align: center;
}

#signedOut { padding: 48px 16px; text-align: center; }

button {
  font: inherit;
  padding: 8px 20px;
  border: 0;
  border-radius: 8px;
  background: #2196F3;
  color: #fff;
  cursor: pointer;
}

.display { padding: 8px; }
.empty { text-align: center; padding: 32px 16px; }

.offline {
  max-width: 1440px;
  margin: 0 auto 8px;
  padding: 10px 16px;
  background: #212121;
  color: #fff;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
}
.isOffline .grid { filter: grayscale(1); opacity: 0.6; }

/* Three across, two down, as large as fits the window's width and height. */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 1440px, max(480px, calc((100vh - 80px) * 480 / 300)));
  margin: 0 auto;
}

/* A free slot keeps its place, as on the display. */
.cell { aspect-ratio: 160 / 150; }
/* The panel isn't just made invisible: the parts it shows and hides for itself
   set their own visibility, which would show through. */
.cell.unused > .panel { display: none; }

.panel { display: block; width: 100%; height: 100%; overflow: hidden; }
.panel text { fill: #212121; font-family: Montserrat, system-ui, sans-serif; white-space: pre; }
.panel .body { font-size: 14px; font-weight: 500; }
.panel .temperature { font-size: 40px; font-weight: 700; text-anchor: end; }
.panel .unit { font-size: 18px; font-weight: 700; text-anchor: end; }
.panel .warning { font-size: 14px; font-weight: 700; text-anchor: middle; }

/* Phones: one column of six, free slots left out. */
@media (max-width: 599px) {
  .grid { grid-template-columns: 1fr; width: min(100%, 420px); gap: 6px; }
  .cell.unused { display: none; }
}
