/* Layout and feel modelled on the LTG Link booking site, so it feels familiar. */
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("/static/fonts/figtree-latin-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f9f9f9;
  --header: #f0f0f0;
  --card: #fff;
  --text: #000;
  --muted: #8390a5;
  --line: #dce0e6;
  --red: #f8423a;
  --red-soft: #fff7f7;
  --green: #26d07c;
  --green-dark: #138a50;
  --shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* Header */
.site-header {
  background: var(--header);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.site-header .inner {
  max-width: 1200px; margin: 0 auto; padding: 0 40px; height: 84px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 24px; letter-spacing: -.02em; }
.brand .mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  background: var(--text); border-radius: 8px;
}
.brand .dot { color: var(--red); }
.header-note { color: #444; font-size: 14px; text-align: right; }
.header-note a { font-weight: 600; text-decoration: none; }
.header-note a:hover { text-decoration: underline; }

/* Page */
main { max-width: 1200px; margin: 0 auto; padding: 56px 40px 80px; }
h1 { font-size: 32px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
.lead { margin: 0 0 32px; color: #333; font-size: 18px; }
h2 { font-size: 22px; font-weight: 700; margin: 40px 0 14px; }

/* Segmented bars (LTG-style search bar) */
.bar {
  display: flex; align-items: stretch;
  background: var(--card); border-radius: 8px; box-shadow: var(--shadow);
  margin-bottom: 14px; min-height: 96px;
}
.bar > :first-child { border-radius: 8px 0 0 8px; }
.bar > :last-child { border-radius: 0 8px 8px 0; }
.cell {
  position: relative; flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 14px 24px; border-left: 1px solid var(--line);
}
.cell:first-child { border-left: 0; }
.cell.wide { flex-grow: 1.6; }
.cell.narrow { flex-grow: .7; }
.cell:focus-within { box-shadow: inset 0 0 0 2px var(--red); border-radius: 4px; }
.cell label, .cell .label {
  display: block; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  margin-bottom: 4px; color: #000;
}
.cell input, .cell select {
  width: 100%; border: 0; padding: 0; background: transparent; outline: none;
  font-size: 19px; font-weight: 700; min-height: 28px; appearance: none; -webkit-appearance: none;
  text-overflow: ellipsis;
}
.cell select { cursor: pointer; padding-right: 22px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right center; }
.cell select:invalid, .cell input::placeholder { color: var(--muted); font-weight: 400; }
.cell input[type="date"], .cell input[type="time"] { cursor: pointer; }
.cell .value { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.cell .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Station picker dropdown (like LTG's) */
.station-list {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 20;
  width: max(100%, 420px); max-height: 340px; overflow-y: auto;
  margin: 0; padding: 0; list-style: none;
  background: #fff; border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
}
.station-list li {
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 14px 24px; cursor: pointer; font-size: 16px;
}
.station-list li svg { flex: none; color: #000; }
.station-list li[aria-selected="true"] { background: var(--line); }
.station-list li.current { font-weight: 700; }
.station-list li.none { color: var(--muted); cursor: default; }

.swap {
  position: absolute; right: -19px; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.swap:hover { border-color: #000; }

.bar .action {
  flex: 0 0 240px; border: 0; background: #000; color: #fff; font-size: 22px; font-weight: 700;
  cursor: pointer; padding: 0 24px;
}
.bar .action:hover { background: #222; }

.section-label { font-size: 14px; font-weight: 600; margin: 26px 0 10px; color: #333; }

/* Notices */
.notice { padding: 14px 20px; border-radius: 8px; margin-bottom: 18px; font-weight: 500; }
.notice.error { background: var(--red-soft); color: #c4221b; box-shadow: inset 4px 0 0 var(--red); }
.notice.warn { background: #fff8eb; color: #8a4b00; box-shadow: inset 4px 0 0 #ff7f41; }
.notice.ok { background: var(--green); color: #fff; }
.notice.info { background: #fff; box-shadow: var(--shadow); }

/* Results list (LTG-style) */
.results { background: var(--card); box-shadow: var(--shadow); border-radius: 8px; overflow: hidden; }
.results-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 32px; border-bottom: 2px solid var(--red); font-size: 17px;
}
.results-head .date { color: var(--red); font-weight: 700; }
.results-head .muted { color: var(--muted); font-size: 14px; }
.journey {
  display: grid; grid-template-columns: minmax(220px, 1.3fr) 1fr auto; gap: 24px; align-items: start;
  padding: 24px 32px 20px;
}
.times { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; font-size: 19px; font-weight: 700; }
.meta { padding-top: 2px; }
.meta .duration { font-size: 17px; margin-bottom: 6px; }
.pill { display: inline-block; background: #000; color: #fff; font-weight: 700; font-size: 14px; padding: 3px 10px; border-radius: 4px; }
.tag { display: inline-block; margin-left: 6px; font-size: 13px; font-weight: 600; color: var(--green-dark); }
.prices { display: flex; flex-direction: column; gap: 10px; min-width: 190px; }
.price {
  border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; background: #fff;
}
.price .cls { font-size: 15px; text-transform: uppercase; }
.price .amount { font-size: 19px; font-weight: 700; margin: 2px 0; }
.price .seats { font-size: 13px; color: #555; }
.price.match { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.price.match .seats { color: var(--green-dark); font-weight: 600; }
.price.empty { background: #fafafa; color: var(--muted); }
.price.empty .amount { color: var(--muted); }
.soldout { color: var(--red); font-weight: 700; letter-spacing: .04em; padding-top: 4px; }
.route { background: var(--red-soft); padding: 9px 32px; font-size: 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.empty-state { padding: 32px; color: #333; }

.status { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 4px; }
.status.yes { background: var(--green); color: #fff; }
.status.no { background: #eef0f3; color: #555; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 26px; border-radius: 8px; border: 0;
  background: #000; color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #222; }
.btn.red { background: var(--red); }
.btn.red:hover { background: #e3342c; }
.btn.light { background: #fff; color: #000; box-shadow: var(--shadow); }
.btn.light:hover { background: #f4f4f4; }
.btn.danger { background: #fff; color: #c4221b; box-shadow: var(--shadow); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.actions form { margin: 0; }

/* Steps on the home page */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 48px; }
.step { background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 22px 24px; }
.step b { display: block; font-size: 17px; margin-bottom: 4px; }
.step .n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.step p { margin: 0; color: #444; font-size: 15px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--header); }
.site-footer .inner { max-width: 1200px; margin: 0 auto; padding: 28px 40px; color: #555; font-size: 14px; }

/* Passenger stepper (− 1 +) */
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper input { width: 2.4em; text-align: center; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: #fff;
  font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.step-btn:hover { border-color: #000; }
.step-btn:disabled { opacity: .35; cursor: default; }

/* Station picker: close button only used in the phone full-screen sheet */
.sheet-close { display: none; }

/* Sticky "Buy" bar, phones only */
.mobile-buy { display: none; }

/* Phones: LTG-style stacked card, short fields in pairs */
@media (max-width: 860px) {
  body { -webkit-tap-highlight-color: transparent; }
  button, a, input, select { touch-action: manipulation; }
  .site-header .inner {
    height: 60px; gap: 12px;
    padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  }
  .brand { font-size: 21px; gap: 8px; }
  .brand .mark { width: 32px; height: 32px; }
  .header-note { font-size: 14px; }
  .header-note .long, .header-note .desktop { display: none; }
  main { padding: 24px 16px 48px; }
  h1 { font-size: 25px; line-height: 1.2; }
  .lead { font-size: 16px; margin-bottom: 22px; }
  h2 { font-size: 19px; margin: 28px 0 12px; }
  .section-label { margin: 22px 0 8px; }
  .notice { font-size: 15px; padding: 12px 16px; }

  /* Bars become a 2-column grid; 1px gaps on a grey background draw the dividers */
  .bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px; min-height: 0;
    background: var(--line); overflow: hidden; margin-bottom: 12px;
  }
  .bar > :first-child, .bar > :last-child { border-radius: 0; }
  .cell { background: #fff; border: 0; padding: 12px 16px; min-height: 70px; min-width: 0; }
  .cell.wide, .cell.m-full, .bar .action { grid-column: 1 / -1; }
  .cell:focus-within { border-radius: 0; }
  .cell label, .cell .label { font-size: 11px; }
  .cell input, .cell select, .cell .value { font-size: 18px; }
  .cell .hint { font-size: 13px; }
  /* iOS renders empty date/time inputs collapsed and centered */
  .cell input[type="date"], .cell input[type="time"] { min-height: 28px; display: block; }
  .cell input::-webkit-date-and-time-value { text-align: left; }
  .swap { left: 50%; right: auto; top: auto; bottom: -19px; transform: translateX(-50%); }
  .bar .action { min-height: 60px; font-size: 19px; border-radius: 0; }
  .bar.summary .cell { min-height: 0; padding: 11px 16px; }
  .bar.summary .value { font-size: 16px; }

  /* Full-screen station search, so the keyboard never hides the list */
  body.sheet-open { overflow: hidden; }
  .station-picker.sheet {
    position: fixed; inset: 0; z-index: 100; background: #fff;
    display: flex; flex-direction: column; padding-top: env(safe-area-inset-top);
  }
  .station-picker.sheet label { padding: 18px 64px 4px 18px; font-size: 12px; }
  .station-picker.sheet .station-input { padding: 0 18px 14px; font-size: 22px; min-height: 44px; border-bottom: 2px solid var(--red); }
  .station-picker.sheet .station-list {
    position: static; flex: 1; width: 100%; max-height: none; border-radius: 0; box-shadow: none;
    overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom);
  }
  .station-picker.sheet .sheet-close {
    display: grid; place-items: center; position: absolute; right: 8px; top: calc(8px + env(safe-area-inset-top));
    width: 44px; height: 44px; border: 0; background: none; font-size: 22px; cursor: pointer;
  }
  .station-list li { padding: 12px 18px; min-height: 54px; }

  /* Results: compact cards */
  .results-head { flex-wrap: wrap; gap: 2px 12px; padding: 14px 16px; font-size: 15px; }
  .results-head .date { order: -1; width: 100%; }
  .journey { grid-template-columns: 1fr auto; gap: 12px 16px; padding: 16px; }
  .times { font-size: 17px; gap: 4px 14px; }
  .meta { text-align: right; padding-top: 0; }
  .meta .duration { font-size: 15px; margin-bottom: 4px; }
  .meta .status { margin-top: 8px; font-size: 10px; padding: 3px 8px; }
  .prices { grid-column: 1 / -1; flex-direction: row; gap: 8px; min-width: 0; }
  .price { flex: 1 1 0; padding: 8px 12px; }
  .price .cls { font-size: 13px; }
  .price .amount { font-size: 17px; }
  .route { padding: 8px 16px; font-size: 14px; }
  .empty-state { padding: 20px 16px; }

  .actions { flex-direction: column; gap: 10px; margin-top: 20px; }
  .actions .btn, .actions form, .actions form .btn { width: 100%; }

  .mobile-buy {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(249, 249, 249, .94); backdrop-filter: blur(8px);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .1);
  }
  .mobile-buy .btn { width: 100%; }
  body.has-mobile-buy { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.has-mobile-buy .actions .btn.red { display: none; }

  .steps { grid-template-columns: 1fr; gap: 10px; margin-top: 32px; }
  .step { display: grid; grid-template-columns: 28px 1fr; gap: 2px 14px; padding: 16px; }
  .step .n { grid-row: span 2; margin: 0; }
  .step b { font-size: 16px; margin: 0; }
  .step p { font-size: 14px; }

  .site-footer .inner { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); font-size: 13px; }
}
.status-wrap { margin-top: 10px; }
@media (max-width: 860px) { .status-wrap { margin-top: 8px; } .meta .status { margin-top: 0; } }
@media (max-width: 860px) { .step-btn { width: 28px; height: 28px; font-size: 18px; } }
.cell input.code-input { font-size: 26px; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.fine-print { margin-top: 18px; color: #555; font-size: 14px; }
