:root {
  --green: #009c68;
  --green-dark: #006b54;
  --green-light: #e8f1f8;
  --blue: #006b54;

  --page: #f5f5f5;
  --white: #fff;

  --text: #1d2421;
  --text-secondary: #505a55;
  --text-muted: #68736d;

  --border: #d9dfdc;
  --border-dark: #b7c1bc;

  --success: #00703c;
  --warning: #a15c00;
  --error: #d4351c;

  --max-width: 1100px;
  --content-gutter: 20px;
  --mobile-gutter: 14px;

  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.14);
}


/* =========================================================
   Base
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;

  background: var(--page);
  color: var(--text);

  font-family: "Open Sans", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;

  /* Prevent accidental horizontal scrolling on mobile */
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--green-dark);
}

a:hover {
  color: #004f3e;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;
  clip: rect(0, 0, 0, 0);

  white-space: nowrap;
  border: 0;
}


/* =========================================================
   Shared layout
   ========================================================= */

.header-inner,
.site-main,
.site-footer-inner {
  width: min(
    calc(100% - (var(--content-gutter) * 2)),
    var(--max-width)
  );

  margin-inline: auto;
}


/* =========================================================
   Header
   ========================================================= */

.site-header {
  background: var(--green);
  color: #fff;
  border-bottom: 4px solid var(--green-dark);
}

.header-inner {
  min-height: 76px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;
}

.brand {
  min-width: 0;

  display: inline-flex;
  flex-direction: column;

  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand-name {
  font-size: 23px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tagline {
  margin-top: 2px;

  color: rgba(255, 255, 255, 0.88);

  font-size: 12px;
  line-height: 1.3;
}

.status-pill {
  flex: 0 0 auto;

  padding: 5px 10px;

  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.08);

  color: #fff;

  font-size: 12px;
  font-weight: 600;

  white-space: nowrap;
}


/* =========================================================
   Main
   ========================================================= */

.site-main {
  min-height: 620px;
  padding: 48px 0 64px;
}


/* =========================================================
   Search
   ========================================================= */

.search-page {
  min-height: 560px;

  display: flex;
  align-items: center;
  justify-content: center;
}

.search-card {
  width: 100%;
  max-width: 650px;

  padding: 42px;

  background: var(--white);
  border: 1px solid var(--border);

  box-shadow: var(--shadow-sm);
}

.section-label {
  display: block;

  margin-bottom: 8px;

  color: var(--green-dark);

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.search-intro {
  margin-bottom: 30px;
}

.search-intro h1 {
  margin: 0 0 12px;

  color: var(--text);

  font-size: 32px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.search-intro p {
  max-width: 560px;

  margin: 0;

  color: var(--text-secondary);

  font-size: 16px;
  line-height: 1.6;
}

.search-wrapper {
  position: relative;
}

.search-box {
  min-height: 58px;

  display: flex;
  align-items: center;

  background: #fff;
  border: 2px solid #333;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--green-dark);

  box-shadow:
    0 0 0 3px rgba(0, 156, 104, 0.18);
}

.search-icon {
  width: 52px;
  flex: 0 0 52px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--green-dark);

  font-size: 20px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-width: 0;

  padding: 14px 14px 14px 0;

  border: 0;
  outline: 0;

  background: transparent;
  color: var(--text);

  font-size: 17px;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-hint {
  margin: 10px 0 0;

  color: var(--text-muted);

  font-size: 13px;
}


/* =========================================================
   Suggestions
   ========================================================= */

.suggestions {
  position: absolute;
  z-index: 50;

  top: calc(100% + 6px);
  left: 0;
  right: 0;

  overflow: hidden;

  background: #fff;
  border: 1px solid var(--border-dark);

  box-shadow: var(--shadow-md);
}

.suggestion {
  width: 100%;
  min-height: 52px;

  padding: 13px 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 12px;

  border: 0;
  border-bottom: 1px solid var(--border);

  background: #fff;
  color: var(--text);

  text-align: left;

  font-size: 15px;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion:focus {
  background: #f0f7f4;
  color: var(--green-dark);
  outline: 0;
}

.suggestion-arrow {
  flex: 0 0 auto;

  color: var(--green);
  font-size: 18px;
}

.suggestion-empty {
  padding: 16px;

  color: var(--text-secondary);
  font-size: 14px;
}


/* =========================================================
   Station heading
   ========================================================= */

.board-page {
  width: 100%;
  min-width: 0;
}

.station-heading {
  margin-bottom: 24px;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 24px;
}

.station-heading > * {
  min-width: 0;
}

.eyebrow {
  display: block;

  margin-bottom: 5px;

  color: var(--text-muted);

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.station-name {
  max-width: 100%;

  margin: 0;

  color: var(--text);

  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;

  overflow-wrap: anywhere;
}

.change-button {
  flex: 0 0 auto;

  padding: 8px 14px;

  background: #fff;
  border: 2px solid var(--green-dark);

  color: var(--green-dark);

  font-size: 14px;
  font-weight: 600;
}

.change-button:hover {
  background: #f0f7f4;
}


/* =========================================================
   Board
   ========================================================= */

.board {
  width: 100%;
  min-width: 0;

  overflow: hidden;

  background: #fff;
  border: 1px solid var(--border);

  box-shadow: var(--shadow-sm);
}

.board-header {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    150px;

  gap: 16px;

  padding: 13px 20px;

  background: #f0f3f1;
  border-bottom: 1px solid var(--border);

  color: var(--text-secondary);

  font-size: 12px;
  font-weight: 700;

  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.board-header span {
  min-width: 0;
}

.board-header span:last-child {
  text-align: right;
}


/* =========================================================
   Platform sections
   ========================================================= */

.platform-section {
  border-bottom: 1px solid var(--border);
}

.platform-section:last-child {
  border-bottom: 0;
}

.platform-heading {
  min-height: 50px;

  padding: 12px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  background: #fafbfa;
  border-bottom: 1px solid var(--border);
}

.platform-heading-main {
  min-width: 0;

  display: flex;
  align-items: baseline;
  flex-wrap: wrap;

  gap: 9px;
}

.platform-label {
  color: var(--text-muted);

  font-size: 12px;
  font-weight: 600;
}

.platform-number {
  color: var(--text);

  font-size: 15px;
  font-weight: 700;
}

.platform-count {
  flex: 0 0 auto;

  color: var(--text-muted);

  font-size: 12px;
}


/* =========================================================
   Arrival rows
   ========================================================= */

.arrival-row {
  position: relative;

  width: 100%;
  min-width: 0;

  display: grid;

  grid-template-columns:
    5px
    minmax(0, 1fr)
    150px;

  gap: 16px;

  padding: 18px 20px;

  border: 0;
  border-bottom: 1px solid #edf0ee;

  background: #fff;
  color: inherit;

  text-align: left;

  transition: background-color 0.12s ease;
}

.arrival-row:last-child {
  border-bottom: 0;
}

.arrival-row:hover {
  background: #f5f9f7;
}

.arrival-row:focus-visible {
  outline: 3px solid rgba(0, 156, 104, 0.35);
  outline-offset: -3px;
}

.line-marker {
  width: 5px;
  min-height: 48px;

  border-radius: 2px;

  background: var(--line-colour);
}

.arrival-main {
  min-width: 0;
}

.destination {
  max-width: 100%;

  color: var(--text);

  font-size: 16px;
  line-height: 1.35;
  font-weight: 600;

  /*
   * Desktop:
   * keep long destinations tidy.
   */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.destination-next {
  font-weight: 700;
}

.line-info {
  min-width: 0;

  margin-top: 5px;

  display: flex;
  align-items: center;

  gap: 7px;

  color: var(--text-muted);

  font-size: 12px;
}

.line-info > * {
  min-width: 0;
}

.line-colour {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;

  border-radius: 50%;
}

.arrival-time {
  min-width: 0;

  text-align: right;
}

.countdown-main {
  color: var(--green-dark);

  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;

  white-space: nowrap;

  font-variant-numeric: tabular-nums;
}

.countdown-next {
  color: var(--green-dark);

  font-size: 17px;
}

.countdown-ms {
  margin-top: 3px;

  color: #8a938e;

  font-size: 10px;

  white-space: nowrap;

  font-variant-numeric: tabular-nums;
}


/* =========================================================
   Live controls
   ========================================================= */

.board-controls {
  min-height: 44px;

  margin-top: 12px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;
}

.live-status {
  min-width: 0;

  display: flex;
  align-items: center;

  gap: 7px;
}

.live-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;

  display: inline-block;

  border-radius: 50%;

  background: #7a8580;
}

.live-dot.live {
  background: var(--success);
}

.live-dot.updating {
  background: var(--warning);
}

.live-dot.offline {
  background: var(--error);
}

.live-text {
  color: var(--text-secondary);

  font-size: 13px;
  font-weight: 600;
}

.live-text.live {
  color: var(--success);
}

.live-text.offline {
  color: var(--error);
}

.last-updated {
  color: var(--text-muted);

  font-size: 12px;
}

.refresh-button {
  flex: 0 0 auto;

  padding: 7px 12px;

  background: transparent;
  border: 2px solid var(--green-dark);

  color: var(--green-dark);

  font-size: 13px;
  font-weight: 600;
}

.refresh-button:hover {
  background: #f0f7f4;
}


/* =========================================================
   Loading / errors
   ========================================================= */

.loading-state {
  padding: 45px 20px;

  color: var(--text-muted);

  font-size: 14px;
  text-align: center;
}

.error-state {
  color: var(--error);
}

.error-state span {
  display: inline-block;

  margin-top: 5px;

  color: var(--text-muted);
}


/* =========================================================
   Modal
   ========================================================= */

.modal {
  position: fixed;
  z-index: 100;

  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;

  background: rgba(29, 36, 33, 0.55);
}

.modal-panel {
  position: relative;
  z-index: 1;

  width: 100%;
  max-width: 650px;
  max-height: calc(100vh - 40px);

  overflow: auto;

  background: #fff;
  border: 1px solid var(--border);

  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 24px;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 20px;

  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  min-width: 0;

  margin: 0;

  color: var(--text);

  font-size: 24px;
  line-height: 1.25;
}

.modal-close {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;

  border: 0;

  background: #f0f3f1;
  color: var(--text);

  font-size: 25px;
  line-height: 1;
}

.modal-close:hover {
  background: #e1e6e3;
}

.modal-content {
  padding: 24px;
}

.info-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.info-item {
  min-width: 0;

  padding: 15px;

  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.info-label {
  display: block;

  margin-bottom: 4px;

  color: var(--text-muted);

  font-size: 12px;
  font-weight: 600;
}

.info-value {
  color: var(--text);

  font-size: 15px;
  font-weight: 600;

  overflow-wrap: anywhere;
}

.service-note {
  margin-top: 20px;
  padding: 15px;

  background: #f0f7f4;
  border-left: 4px solid var(--green);

  color: var(--text-secondary);

  font-size: 14px;
}

.vehicle-location {
  margin-top: 20px;
  padding: 18px;

  background: #f7f8f7;
  border: 1px solid var(--border);
}

.vehicle-location h3 {
  margin: 0 0 8px;

  font-size: 16px;
}

.vehicle-location p {
  margin: 0;

  color: var(--text-secondary);

  font-size: 14px;
}


/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  background: #f2f3f4;
  color: #505a5f;

  border-top: 1px solid #d8dde0;
}

.site-footer-inner {
  padding: 32px 0 24px;
}

.site-footer-brand {
  margin-bottom: 12px;

  color: #1d2730;

  font-size: 20px;
  font-weight: 700;
}

.site-footer-description {
  max-width: 650px;

  margin: 0 0 24px;

  color: #505a5f;

  font-size: 14px;
  line-height: 1.6;
}

.site-footer-links {
  margin: 0;
  padding: 18px 0;

  display: flex;
  flex-wrap: wrap;

  gap: 8px 24px;

  border-top: 1px solid #d8dde0;
  border-bottom: 1px solid #d8dde0;

  list-style: none;
}

.site-footer-links a {
  color: #006b54;
  font-size: 14px;
}

.site-footer-meta {
  padding-top: 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  color: #68736d;

  font-size: 12px;
}

.site-footer-meta p {
  margin: 0;
}

.site-footer-meta strong {
  color: #1d2730;
}


/* =========================================================
   Tablet / mobile
   ========================================================= */

@media (max-width: 700px) {

  :root {
    --content-gutter: var(--mobile-gutter);
  }

  .site-main {
    min-height: 0;
    padding-top: 30px;
    padding-bottom: 40px;
  }

  .header-inner {
    min-height: 68px;
    gap: 12px;
  }

  .brand-name {
    font-size: 20px;
  }

  .brand-tagline {
    font-size: 11px;
  }

  .search-page {
    min-height: 500px;
  }

  .search-card {
    padding: 28px 22px;
  }

  .search-intro h1 {
    font-size: 28px;
  }

  .station-heading {
    align-items: flex-start;
    flex-direction: column;

    gap: 14px;
  }

  .change-button {
    align-self: flex-start;
  }

  .board-header {
    grid-template-columns:
      minmax(0, 1fr)
      95px;

    gap: 10px;

    padding: 11px 12px;
  }

  .arrival-row {
    grid-template-columns:
      4px
      minmax(0, 1fr)
      95px;

    gap: 10px;

    padding: 15px 12px;
  }

  .platform-heading {
    padding: 11px 12px;
  }

  /*
   * Mobile:
   * allow destinations to wrap instead of overflowing.
   */
  .destination {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;

    overflow-wrap: anywhere;
  }

  .line-info {
    font-size: 11px;
  }

  .countdown-main {
    font-size: 13px;
  }

  .countdown-next {
    font-size: 14px;
  }

  .countdown-ms,
  .last-updated {
    display: none;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .site-footer-meta {
    align-items: flex-start;
    flex-direction: column;

    gap: 7px;
  }
}


/* =========================================================
   Small phones
   ========================================================= */

@media (max-width: 420px) {

  :root {
    --content-gutter: 12px;
  }

  .header-inner {
    min-height: 64px;
  }

  .brand-name {
    font-size: 19px;
  }

  .search-card {
    padding: 24px 16px;
  }

  .search-intro h1 {
    font-size: 26px;
  }

  .board-header {
    grid-template-columns:
      minmax(0, 1fr)
      78px;

    gap: 8px;

    padding: 10px;
  }

  .arrival-row {
    grid-template-columns:
      4px
      minmax(0, 1fr)
      78px;

    gap: 8px;

    padding: 14px 10px;
  }

  .platform-heading {
    padding: 10px;
  }

  .platform-heading-main {
    gap: 6px;
  }

  .platform-number {
    font-size: 14px;
  }

  .destination {
    font-size: 13px;
    line-height: 1.35;

    /*
     * Keep extremely long names from creating huge rows.
     * Normal wrapping is preferred, but long unbroken strings
     * can still break safely.
     */
    overflow-wrap: anywhere;
  }

  .line-info {
    gap: 5px;
    font-size: 10px;
  }

  .countdown-main {
    font-size: 12px;
  }

  .countdown-next {
    font-size: 13px;
  }

  .status-pill {
    display: none;
  }

  .board-controls {
    gap: 10px;
  }

  .refresh-button {
    padding-inline: 10px;
  }
}


/* =========================================================
   Very small phones
   ========================================================= */

@media (max-width: 360px) {

  .site-main {
    padding-top: 24px;
  }

  .search-card {
    padding: 20px 14px;
  }

  .arrival-row {
    grid-template-columns:
      4px
      minmax(0, 1fr)
      72px;

    gap: 7px;

    padding-inline: 8px;
  }

  .board-header {
    grid-template-columns:
      minmax(0, 1fr)
      72px;

    padding-inline: 8px;
  }

  .destination {
    font-size: 12px;
  }

  .countdown-main {
    font-size: 11px;
  }

  .countdown-next {
    font-size: 12px;
  }
}


/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
