/* Morning Board — sized for a living-room television seen from ten feet away.
   Everything scales off viewport units so it fills 720p, 1080p and 4K alike. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.82);
  --ink-faint: rgba(255, 255, 255, 0.55);
  --shadow: 0 0.4vh 2.4vh rgba(0, 0, 0, 0.28);
  /* TV overscan can eat the outer few percent of the picture. */
  --safe-x: 4vw;
  --safe-y: 3.5vh;
  --sky-a: #6fa8cf;
  --sky-b: #f4c98a;
  --sky-c: #ef8a6d;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 800;
  color: var(--ink);
  background: #24405c;
  background-image: linear-gradient(165deg, var(--sky-a) 0%, var(--sky-b) 55%, var(--sky-c) 100%);
  transition: background-image 1.2s ease;
  -webkit-font-smoothing: antialiased;
  text-shadow: var(--shadow);
  cursor: none;
}

body.state-warn {
  --sky-a: #b23a2e;
  --sky-b: #d9452f;
  --sky-c: #7d1f18;
}

body.state-go {
  --sky-a: #c62828;
  --sky-b: #8e0f0f;
  --sky-c: #4a0505;
  animation: go-pulse 1s steps(1, end) infinite;
}

@keyframes go-pulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.35); }
}

/* ---------- start gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #4a6f95 0%, #2c3f5a 100%);
  z-index: 50;
  cursor: pointer;
}

.gate-inner { text-align: center; padding: var(--safe-y) var(--safe-x); }
.gate-emoji { font-size: 12vh; line-height: 1; text-shadow: none; }
.gate-title { font-size: 7vh; margin: 2vh 0 1vh; letter-spacing: -0.02em; }
.gate-sub { font-size: 2.6vh; font-weight: 600; color: var(--ink-soft); }

.gate-btn {
  margin-top: 4vh;
  font: inherit;
  font-size: 3.4vh;
  font-weight: 800;
  color: #22364d;
  background: #fff;
  border: 0.5vh solid transparent;
  border-radius: 99px;
  padding: 1.6vh 7vw;
  cursor: pointer;
  text-shadow: none;
  box-shadow: var(--shadow);
}

/* Televisions navigate by focus ring, so make it unmissable. */
.gate-btn:focus { outline: none; border-color: #ffd54f; transform: scale(1.04); }

.gate-warn {
  margin-top: 4vh;
  font-size: 2.1vh;
  font-weight: 600;
  color: #ffe082;
}

/* ---------- board ---------- */

.board {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--safe-y) var(--safe-x) 0;
}

.clock-wrap { text-align: center; flex: 0 0 auto; }

.clock {
  font-size: 20vh;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.dateline {
  font-size: 2.4vh;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.6vh;
}

.panels {
  flex: 1 1 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 3vw;
  min-height: 0;
  padding: 6vh 0 0;
}

/* Both columns start at the top so the two headings share a baseline, the way
   they do on a departure board. */
.panel {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Titles sit at the top of each column; the body then centres itself in
   whatever height is left, so neither column looks top-heavy. */
.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.panel-title {
  font-size: 6.2vh;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

.panel-sub {
  font-size: 2.8vh;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 3vh;
}

.divider {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 0.45vh;
  height: 34vh;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.75);
}

.countdown {
  font-size: 21vh;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0.4vh 0;
}

/* The blink asked for below the danger threshold: hard on/off, not a fade,
   so it reads as an alarm rather than decoration. */
body.state-warn .countdown,
body.state-go .countdown {
  animation: blink 1s steps(1, end) infinite;
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0.15; }
}

body.state-idle .countdown { font-size: 14vh; color: var(--ink-soft); }

/* ---------- weather ---------- */

.wx-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2vw;
  margin: 1vh 0;
}

.wx-icon { font-size: 16vh; line-height: 1; text-shadow: none; }
.wx-temp { font-size: 14vh; line-height: 1; font-variant-numeric: tabular-nums; }
.wx-range { font-size: 3vh; font-weight: 700; color: var(--ink-soft); }
.wx-label { font-size: 3.8vh; font-weight: 700; }
.wx-advice {
  font-size: 2.9vh;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 99px;
  padding: 0.9vh 2vw;
  display: inline-block;
  margin-top: 1.4vh;
  text-shadow: none;
}

/* ---------- footer ---------- */

.progress {
  flex: 0 0 auto;
  height: 1.1vh;
  margin: 0 0 var(--safe-y);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: #fff;
  transition: width 0.9s linear;
}

body.state-warn .progress-bar, body.state-go .progress-bar { background: #ffd54f; }

/* Must stay in the render tree — a display:none video is not "playing" as far
   as the platform's power management is concerned. */
.awake-media {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 2px;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
}

.muted-flag {
  position: fixed;
  right: var(--safe-x);
  bottom: var(--safe-y);
  font-size: 1.9vh;
  font-weight: 700;
  color: var(--ink-faint);
}

/* A phone or laptop checking the board should still be readable. */
@media (max-aspect-ratio: 1/1) {
  .panels { flex-direction: column; gap: 3vh; }
  .divider { width: 40%; height: 0.4vh; }
  .clock { font-size: 12vh; }
  .countdown { font-size: 14vh; }
  .panel-title { font-size: 4vh; }
  .wx-icon { font-size: 9vh; }
  .wx-temp { font-size: 8vh; }
}
