@import url('https://cdnjs.cloudflare.com/ajax/libs/ibm-plex/6.3.0/css/ibm-plex-mono.min.css');

:root {
  --bg: #04070f;
  --panel: #0a1024;
  --row-alt: #0d1430;
  --navy: #003882;
  --gold: #c9a227;
  --text: #eef2ff;
  --muted: #7c8bb0;
  --scheduled: #7c8bb0;
  --boarding: #f2b705;
  --departed: #2ecc71;
  --delayed: #ff5a5f;
  --cancelled: #6b6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  height: 100%;
  overflow: hidden;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, var(--navy), #002a63);
  border-bottom: 3px solid var(--gold);
  padding: 18px 32px;
}

.brand { display: flex; align-items: center; gap: 16px; }

.brand-badge {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #ffd700;
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
  border: 3px solid white;
}

.brand-badge-img {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: contain;
  background: white;
  border: 3px solid white;
  flex: none;
}

.brand-title { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.brand-sub { font-size: 14px; color: #d9e2ff; margin-top: 2px; }

.header-right { display: flex; align-items: center; gap: 22px; }

.partner-logo {
  max-height: 52px;
  max-width: 160px;
  object-fit: contain;
  background: white;
  padding: 4px 8px;
  border-radius: 6px;
}

.clock-wrap { text-align: right; }
.clock { font-size: 36px; font-weight: 700; color: #ffd700; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.clock-label { font-size: 11px; color: #d9e2ff; text-transform: uppercase; letter-spacing: 1.5px; }

.mute-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  font-size: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.mute-btn.muted { opacity: 0.5; }

/* --- tannoy announcement banner --- */
.announcement-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, #3a2e04, #4a3a08, #3a2e04);
  color: #ffd700;
  padding: 14px 32px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gold);
  animation: bannerGlow 1.2s ease-in-out infinite;
}
.announcement-banner.hidden { display: none; }
.announcement-icon { font-size: 24px; animation: iconWiggle 0.6s ease-in-out infinite; }
@keyframes bannerGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
@keyframes iconWiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

/* --- sound unlock overlay (first-load gesture required by browsers) --- */
.sound-unlock {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  cursor: pointer;
}
.sound-unlock.hidden { display: none; }
.sound-unlock-card {
  text-align: center;
  max-width: 520px;
  padding: 40px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: #0a1024;
}
.sound-unlock-title { font-size: 26px; font-weight: 700; color: #ffd700; margin-bottom: 14px; }
.sound-unlock-sub { font-size: 15px; color: var(--muted); line-height: 1.5; }

.board-columns {
  display: grid;
  grid-template-columns: 148px 90px 130px 110px 1.3fr 1.9fr 220px;
  grid-template-areas: "time type code mode dest groups status";
  gap: 8px;
  padding: 14px 32px;
  background: #060a18;
  border-bottom: 1px solid #1c2646;
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 1.5px;
  font-weight: 700;
}

.board-rows {
  overflow: hidden;
  height: calc(100vh - 172px);
  position: relative;
}

.board-rows.page-turn .row { animation: pageFade 0.4s ease; }
@keyframes pageFade {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

.row {
  display: grid;
  grid-template-columns: 148px 90px 130px 110px 1.3fr 1.9fr 220px;
  grid-template-areas: "time type code mode dest groups status";
  gap: 8px;
  padding: 14px 32px;
  align-items: start;
  border-bottom: 1px solid #131c38;
  font-size: 17px;
  transition: background 0.3s ease;
}

.col-time { grid-area: time; }
.col-type { grid-area: type; }
.col-code { grid-area: code; }
.col-mode { grid-area: mode; }
.col-dest { grid-area: dest; }
.col-groups { grid-area: groups; }
.col-status { grid-area: status; }

/* Mobile-only expand control + detail wrapper — invisible on the TV
   layout, which shows every column at once already. */
.row-expand-btn { display: none; }

/* Columns that stay single-line even though the row itself can now grow
   to fit a wrapped groups list — nudge them down slightly so they still
   look vertically centered against the first line of wrapped text. */
.row .col-time,
.row .col-type,
.row .col-code,
.row .col-mode,
.row .col-dest,
.row .col-status {
  padding-top: 3px;
}

.row:nth-child(even) { background: var(--row-alt); }
.row.imminent { background: #201a06; }

/* --- split-flap tiles (Solari-board style) --- */
.flap-row { display: flex; gap: 3px; }

.flap-tile {
  position: relative;
  width: 20px;
  height: 28px;
  background: #14181f;
  color: #ffd700;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px #05070c, 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
  flex: none;
}
.flap-tile::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: calc(50% - 0.5px);
  height: 1px;
  background: rgba(0,0,0,0.65);
}
.flap-tile.flipping { animation: flapFlip 0.11s linear; }
@keyframes flapFlip {
  0%   { transform: rotateX(0deg);   filter: brightness(1); }
  45%  { transform: rotateX(85deg);  filter: brightness(1.6); }
  55%  { transform: rotateX(85deg);  filter: brightness(1.6); }
  100% { transform: rotateX(0deg);   filter: brightness(1); }
}

.flap-row.time .flap-tile { width: 24px; height: 34px; font-size: 20px; color: #ffd700; }
.flap-row.status .flap-tile { width: 16px; height: 24px; font-size: 12px; }
.flap-row.status.status-tone-SCHEDULED .flap-tile { color: var(--scheduled); }
.flap-row.status.status-tone-BOARDING .flap-tile { color: var(--boarding); }
.flap-row.status.status-tone-DEPARTED .flap-tile { color: var(--departed); }
.flap-row.status.status-tone-DELAYED .flap-tile { color: var(--delayed); }
.flap-row.status.status-tone-CANCELLED .flap-tile { color: var(--cancelled); }

.status-wrap { display: flex; align-items: center; gap: 8px; }
.status-dot-lg { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.status-dot-lg.status-tone-SCHEDULED { background: var(--scheduled); }
.status-dot-lg.status-tone-BOARDING { background: var(--boarding); animation: pulse 1.6s infinite; }
.status-dot-lg.status-tone-DEPARTED { background: var(--departed); }
.status-dot-lg.status-tone-DELAYED { background: var(--delayed); animation: pulse 1.6s infinite; }
.status-dot-lg.status-tone-CANCELLED { background: var(--cancelled); }

.col-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.tag-international { background: #1c2f6b; color: #9db4ff; }
.tag-scottish { background: #3a1c1c; color: #ffb199; }

.col-code { font-weight: 700; color: #fff; }
.col-mode { color: var(--muted); font-size: 14px; }
.col-dest { font-size: 15px; }
.col-groups {
  font-size: 13px;
  color: #b9c3e8;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.4;
}
.split-flag { color: var(--delayed); font-weight: 700; margin-right: 6px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.board-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 32px;
  background: #060a18;
  border-top: 1px solid #1c2646;
  font-size: 12px;
  color: var(--muted);
}

.page-indicator { letter-spacing: 1px; }
.page-indicator .dot { opacity: 0.35; }
.page-indicator .dot.active { opacity: 1; color: var(--gold); }

.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 16px; }

/* --- Mobile / narrow screens ------------------------------------------------
   Primary aim is still a big TV, but the board should stay usable on a
   phone: condensed rows (time, code, destination, status) by default, tap
   "More info" to reveal type/mode/groups/pax. No auto-pagination here —
   board.js just renders every row into a normal scrollable list instead of
   flipping fixed-height pages, since there's no fixed viewport to paginate
   against once the page can scroll. */
@media (max-width: 800px) {
  html, body { overflow: auto; height: auto; }

  .board-header { flex-wrap: wrap; gap: 10px; padding: 14px 16px; }
  .brand-title { font-size: 16px; }
  .brand-sub { font-size: 12px; }
  .clock { font-size: 26px; }
  .partner-logo { max-height: 36px; }

  .board-columns { display: none; }

  .board-rows {
    overflow-y: auto;
    height: auto;
    max-height: none;
  }

  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time status"
      "code code"
      "dest dest"
      "type type"
      "mode mode"
      "groups groups";
    padding: 12px 16px;
  }

  .col-type, .col-mode, .col-groups { display: none; }
  .row.expanded .col-type,
  .row.expanded .col-mode,
  .row.expanded .col-groups { display: block; }

  .row-expand-btn {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--gold);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 6px;
  }

  .col-dest { font-size: 16px; }
  .col-code { font-size: 18px; }
  .page-indicator { display: none; }
}
