@font-face {
  font-family: "Rail Alphabet 3";
  src: url("/fonts/RailAlphabet3Web-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Rail Alphabet 3";
  src: url("/fonts/RailAlphabet3Web-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --gbr-bright-blue: rgb(16 84 238);
  --gbr-deep-blue: rgb(0 30 97);
  --gbr-red: rgb(230 0 0);
  --gbr-light-blue: rgb(220 230 255);
  --gbr-grey-95: rgb(11 12 14);
  --gbr-grey-60: rgb(92 98 112);
  --gbr-grey-20: rgb(194 199 214);
  --gbr-grey-10: rgb(230 233 244);
  --gbr-grey-5: rgb(247 249 255);
  --gbr-white: rgb(255 255 255);
  --gbr-success-green: rgb(0 125 50);
  --gbr-success-green-tint-1: rgb(206 240 220);
  --gbr-warning-yellow: rgb(255 237 0);
  --gbr-alert-red-tint-1: rgb(255 219 219);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--gbr-grey-95);
  background: var(--gbr-grey-5);
  font-family: "Rail Alphabet 3", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 0 24px 24px;
}

/* This header reuses the approved GBR flag-device artwork already used by the
   QR Code scanner, so the departure board starts with the same brand signal
   before the denser operational controls begin. */
.gbr-live-header {
  position: relative;
  height: 90px;
  margin: 0 -24px 24px;
  overflow: hidden;
  background: var(--gbr-deep-blue);
}

.gbr-live-header img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gbr-live-header h1 {
  position: absolute;
  top: 50%;
  left: max(18px, calc((100vw - 1180px) / 2 + 18px));
  margin: 0;
  color: var(--gbr-white);
  font-size: clamp(1.7rem, 5vw, 2.55rem);
  font-weight: 500;
  line-height: 1;
  transform: translateY(-50%);
}

/* Top-level chrome uses confirmed GBR lead colours to make the product feel
   branded while keeping the operational content on high-contrast white panels. */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 auto 24px;
  max-width: 1180px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gbr-deep-blue);
  font-weight: 500;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--gbr-white);
  background: var(--gbr-deep-blue);
}

.brand-text {
  font-size: 1.12rem;
}

/* The search panel is the main trigger for station board requests. In the
   deployed prototype it drives local demo data; a server adapter can replace
   that path without changing the controls. */
.search-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(140px, 180px);
  gap: 14px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto 26px;
  padding: 18px;
  color: var(--gbr-white);
  background: var(--gbr-deep-blue);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgb(0 30 97 / 8%);
}

.field,
.day-picker {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.station-field {
  position: relative;
}

label,
legend {
  display: block;
  margin-bottom: 7px;
  color: inherit;
  font-weight: 500;
}

.input-with-icon {
  display: block;
  min-height: 48px;
  padding: 0 12px;
  color: var(--gbr-grey-95);
  background: var(--gbr-white);
  border: 2px solid transparent;
}

.input-with-icon:focus-within {
  border-color: var(--gbr-warning-yellow);
}

select,
input {
  width: 100%;
  min-height: 44px;
  border: 0;
  color: var(--gbr-grey-95);
  background: transparent;
  text-align: left;
}

select:focus,
input:focus {
  outline: 0;
}

.station-suggestions {
  position: absolute;
  z-index: 10;
  right: 0;
  left: 0;
  margin-top: 6px;
  color: var(--gbr-grey-95);
  background: var(--gbr-white);
  border: 2px solid var(--gbr-bright-blue);
  box-shadow: 0 12px 24px rgb(0 30 97 / 18%);
}

.station-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--gbr-grey-10);
  color: var(--gbr-grey-95);
  background: var(--gbr-white);
  text-align: left;
}

.station-option:hover,
.station-option:focus-visible {
  background: var(--gbr-light-blue);
}

.station-option strong {
  color: var(--gbr-deep-blue);
  text-align: right;
}

.station-empty {
  margin: 0;
  padding: 12px;
  color: var(--gbr-grey-60);
}

.segmented-group,
.mode-control {
  display: inline-flex;
  border: 2px solid var(--gbr-bright-blue);
  background: var(--gbr-white);
}

.segmented-button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-right: 2px solid var(--gbr-bright-blue);
  color: var(--gbr-deep-blue);
  background: var(--gbr-white);
}

.segmented-button:last-child {
  border-right: 0;
}

.segmented-button[aria-pressed="true"] {
  color: var(--gbr-white);
  background: var(--gbr-bright-blue);
}

.station-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto 18px;
}

.station-heading h1,
.detail-heading h2,
.operational-fields h3 {
  margin: 0;
  color: var(--gbr-deep-blue);
  font-weight: 500;
}

.station-heading h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
}

.eyebrow {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 6px;
  color: var(--gbr-bright-blue);
  font-weight: 500;
}

.generation-note,
.detail-heading p,
.calling-point small,
.operational-fields dt {
  color: var(--gbr-grey-60);
}

.board-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  max-width: 1180px;
  margin: -8px auto 14px;
}

.board-tools label {
  margin: 0;
  color: var(--gbr-grey-60);
}

.board-tools select {
  width: auto;
  min-width: 220px;
  min-height: 42px;
  border: 1px solid var(--gbr-grey-20);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--gbr-grey-95);
  background: var(--gbr-white);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

/* Departure rows are buttons so keyboard users can select a train and update
   the details panel with the same action model as pointer users. */
.departure-board,
.service-detail {
  border: 1px solid var(--gbr-grey-10);
  border-radius: 8px;
  background: var(--gbr-white);
  box-shadow: 0 10px 24px rgb(0 30 97 / 8%);
  overflow: hidden;
}

.board-header,
.service-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
}

.departure-board.is-simple .board-header,
.departure-board.is-simple .service-row {
  grid-template-columns: 74px minmax(130px, 1fr) 74px 94px;
}

.departure-board.is-detailed .board-header,
.departure-board.is-detailed .service-row {
  grid-template-columns: 72px 84px minmax(140px, 1fr) 72px 74px 88px 94px;
}

.board-header {
  color: var(--gbr-white);
  background: var(--gbr-deep-blue);
  font-weight: 500;
}

.service-row {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid var(--gbr-grey-10);
  text-align: left;
  color: var(--gbr-grey-95);
  background: var(--gbr-white);
}

.service-row:hover,
.service-row:focus-visible {
  background: var(--gbr-light-blue);
}

.service-row[aria-pressed="true"] {
  box-shadow: inset 6px 0 0 var(--gbr-bright-blue);
  background: var(--gbr-light-blue);
}

.time-cell,
.headcode-cell,
.destination-cell {
  font-weight: 500;
}

.headcode-cell,
.headcode-badge span,
.operational-fields dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  font-weight: 500;
  white-space: nowrap;
}

.status-success {
  color: var(--gbr-success-green);
  background: var(--gbr-success-green-tint-1);
}

.status-warning {
  color: var(--gbr-grey-95);
  background: var(--gbr-warning-yellow);
}

.status-alert {
  color: var(--gbr-grey-95);
  background: var(--gbr-alert-red-tint-1);
}

.service-detail {
  padding: 18px;
  border-top: 6px solid var(--gbr-bright-blue);
}

.detail-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  border-bottom: 1px solid var(--gbr-grey-10);
  padding-bottom: 14px;
}

.headcode-badge {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.headcode-badge span {
  padding: 7px 10px;
  color: var(--gbr-white);
  background: var(--gbr-deep-blue);
  font-weight: 500;
}

.headcode-badge small {
  color: var(--gbr-grey-60);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.summary-grid div {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gbr-grey-10);
}

dt {
  margin-bottom: 4px;
  color: var(--gbr-grey-60);
}

dd {
  margin: 0;
  font-weight: 500;
}

.disruption-note {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0 0 16px;
  padding: 12px;
  color: var(--gbr-grey-95);
  background: var(--gbr-warning-yellow);
}

.calling-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.calling-point {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 60px;
  gap: 10px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--gbr-grey-10);
}

.calling-point.is-origin {
  padding-left: 10px;
  background: var(--gbr-light-blue);
}

.calling-time,
.calling-platform {
  font-weight: 500;
}

.calling-platform {
  text-align: right;
}

.calling-point strong,
.calling-point small {
  display: block;
}

/* Detailed mode contains identifiers and provenance that are useful to staff
   or debugging workflows but too noisy for a default passenger-facing board. */
.operational-fields {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gbr-grey-10);
}

.operational-fields dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 0;
}

.operational-fields div {
  min-width: 0;
}

@media (max-width: 900px) {
  .top-bar,
  .station-heading,
  .board-tools,
  .layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .mode-control,
  .segmented-group {
    width: 100%;
  }

  .board-tools {
    justify-content: stretch;
  }

  .board-tools select {
    width: 100%;
  }

  .segmented-button {
    flex: 1 1 auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 0 14px 14px;
  }

  .gbr-live-header {
    margin-right: -14px;
    margin-left: -14px;
  }

  .departure-board.is-simple .board-header,
  .departure-board.is-detailed .board-header {
    display: none;
  }

  .departure-board.is-simple .service-row,
  .departure-board.is-detailed .service-row {
    grid-template-columns: 60px minmax(0, 1fr) 82px;
  }

  .departure-board.is-detailed .service-row span:nth-child(2),
  .departure-board.is-detailed .service-row span:nth-child(4),
  .departure-board.is-detailed .service-row span:nth-child(6) {
    display: none;
  }

  .departure-board.is-simple .service-row span:nth-child(3) {
    display: none;
  }

  .summary-grid,
  .operational-fields dl {
    grid-template-columns: 1fr;
  }
}
