/* Leave By. One accent (amber, the colour of a departure board) and a large clock time as the hero. */

:root {
  color-scheme: light dark;
  --bg: #f4f2ee;
  --surface: #ffffff;
  --ink: #14181d;
  --muted: #5b6470;
  --line: #dcd8d0;
  --accent: #a85600;
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --ok: #1d6b3a;
  --radius: 14px;
  --gutter: 16px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --surface: #181e25;
    --ink: #eef1f4;
    --muted: #98a2ae;
    --line: #2a323c;
    --accent: #ffb020;
    --accent-ink: #101418;
    --danger: #ff7a6e;
    --danger-bg: #3a1c1a;
    --ok: #5fd08a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

.shell {
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) calc(env(safe-area-inset-bottom) + 32px);
}

header.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 16px;
}

header.top a {
  color: inherit;
  text-decoration: none;
}

h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin: 28px 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

p {
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.875rem;
}

a {
  color: var(--accent);
}

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.trip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.trip-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.trip-name a {
  color: inherit;
  text-decoration: none;
}

.trip-day {
  flex: none;
  color: var(--muted);
  font-size: 0.875rem;
}

.leave {
  margin: 14px 0 10px;
}

.leave-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.leave-time {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.leave-time .clock {
  font-size: clamp(3.5rem, 19vw, 5.25rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.leave-time .when {
  font-size: 1.05rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.late .leave-time .clock,
.late .leave-note {
  color: var(--danger);
}

.leave-note {
  margin: 6px 0 0;
  font-weight: 600;
}

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.925rem;
  font-variant-numeric: tabular-nums;
}

.facts strong {
  color: var(--ink);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--muted);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.danger {
  color: var(--danger);
}

.btn.block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Banners */

.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.card .banner {
  margin: 12px 0 0;
}

.error {
  color: var(--danger);
  font-weight: 600;
}

/* Forms */

label,
.label {
  display: block;
  margin: 16px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.hint {
  font-weight: 400;
  color: var(--muted);
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* stops iOS zooming in on focus */
}

input[type='checkbox'] {
  width: 22px;
  min-height: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 6px;
  font-weight: 600;
}

.row {
  display: flex;
  align-items: flex-end; /* keeps the boxes level when one label wraps */
  gap: 10px;
}

.row > * {
  flex: 1;
  min-width: 0;
}

.place {
  position: relative;
}

.place.chosen input {
  border-color: var(--ok);
}

.suggestions {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18);
}

.suggestions button {
  display: block;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover,
.suggestions button:focus-visible {
  background: var(--bg);
}

.suggestions .secondary {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.suggestions .attribution {
  padding: 6px 10px 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.stop {
  display: grid;
  grid-template-columns: 1fr 5.5rem 44px;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
}

.stop label {
  margin-top: 8px;
}

.stop .remove {
  min-height: 44px;
  padding: 0;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.segmented label {
  flex: 1;
  margin: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  width: 1px;
  min-height: 1px;
  height: 1px;
}

.segmented label:has(input:checked) {
  background: var(--accent);
  color: var(--accent-ink);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Detail */

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

.route li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.route li:first-child {
  border-top: 0;
}

.route .role {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 8px 10px 8px 0;
  text-align: left;
  border-top: 1px solid var(--line);
  white-space: nowrap;
}

th {
  border-top: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

details.ended summary {
  cursor: pointer;
  padding: 10px 0;
  color: var(--muted);
  font-weight: 600;
}

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

.ended-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

footer.foot {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.875rem;
}

footer.foot .actions {
  margin: 10px 0 16px;
}

.empty {
  text-align: center;
  padding: 28px 18px;
}

/* Login */

body.login main {
  max-width: 22rem;
  margin: 0 auto;
  padding: 18vh var(--gutter) 0;
}

body.login h1 {
  margin-bottom: 20px;
}

body.login button {
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  input {
    transition: border-color 0.15s;
  }
}
