:root {
  --sky: #EDF2F6;
  --paper: #FFFFFF;
  --ink: #10233A;
  --ink-soft: #52637A;
  --rule: #D5DEE7;
  --board: #14263F;
  --board-rule: #223A5A;
  --flap: #F5B33B;
  --flap-dim: #B9C6D6;
  --go: #2FBF71;
  --go-ink: #0E5A33;
  --bad: #C8402F;
  --font: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
p { margin: 0.35rem 0 0; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.9rem; }
.hint { color: var(--ink-soft); font-weight: 400; font-size: 0.9rem; }
code { font-family: inherit; }

.wrap { max-width: 56rem; margin: 0 auto; padding: 1rem 16px 4rem; }

/* header */
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  max-width: 56rem; margin: 0 auto; padding: 0.9rem 16px 0;
}
.brand { font-weight: 600; font-size: 1.3rem; text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; }
.brand-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--flap); display: inline-block; }
.top nav { display: flex; gap: 1.1rem; align-items: center; }
.top nav a { text-decoration: none; color: var(--ink-soft); padding-bottom: 2px; border-bottom: 2px solid transparent; }
.top nav a[aria-current] { color: var(--ink); border-bottom-color: var(--flap); }
.top nav form { margin: 0; }

/* buttons */
button, .button {
  font: inherit; font-weight: 500; cursor: pointer;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--ink); border-radius: 4px;
  padding: 0.45rem 0.9rem; text-decoration: none; display: inline-block;
}
button.primary, .button.primary { background: var(--ink); color: var(--paper); }
button.linkish {
  background: none; border: 0; padding: 0; color: inherit; font-weight: 400;
  text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px;
}
button.linkish:hover { text-decoration-color: currentColor; }
button.danger { color: var(--bad); }
form.inline { display: inline; }
:focus-visible { outline: 3px solid var(--flap); outline-offset: 2px; }

/* flashes */
.flash { padding: 0.6rem 0.9rem; border-radius: 4px; margin: 0 0 1rem; background: var(--paper); border-left: 4px solid var(--go); }
.flash-error { border-left-color: var(--bad); }

/* board head */
.board-head { margin: 1.2rem 0 1rem; }
.crumb { color: var(--ink-soft); margin: 0 0 0.3rem; }
.crumb a { color: inherit; }

/* the departures board */
.board {
  background: var(--board);
  border-radius: 6px;
  padding: 0.3rem 0;
  box-shadow: inset 0 0 0 1px var(--board-rule);
}
.board .row {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto 5.5rem;
  grid-template-areas: "route when tag price" "route who tag price";
  column-gap: 1rem; row-gap: 0.1rem; align-items: center;
  padding: 0.55rem 1rem;
  color: var(--flap-dim); text-decoration: none;
  border-bottom: 1px solid var(--board-rule);
}
.board .row:last-child { border-bottom: 0; }
.board .row:hover { background: #1A3050; }
.board .route { grid-area: route; color: #FFFFFF; font-weight: 600; font-size: 1.15rem; letter-spacing: 0.02em; }
.board .arrow { color: var(--flap-dim); font-weight: 400; }
.board .when { grid-area: when; color: #FFFFFF; }
.board .who { grid-area: who; font-size: 0.92rem; }
.board .tag { grid-area: tag; color: var(--flap-dim); font-size: 0.9rem; text-align: right; }
.board .price { grid-area: price; color: var(--flap); font-weight: 600; font-size: 1.45rem; text-align: right; }
.board .row.under .price { color: var(--go); }
.board .row.under .tag { color: var(--go); font-weight: 500; }
.board .empty { color: var(--flap-dim); padding: 1rem; margin: 0; }

.empty { background: var(--paper); border: 1px dashed var(--rule); border-radius: 6px; padding: 1rem; color: var(--ink-soft); }

/* watches */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 2rem 0 0.7rem; }
.section-head h2 { margin: 0; }
.watch {
  background: var(--paper); border-radius: 6px; border: 1px solid var(--rule);
  padding: 0.9rem 1rem; margin-bottom: 0.6rem;
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
}
.watch.paused { opacity: 0.6; }
.watch h3 a { text-decoration: none; }
.watch-actions { display: flex; gap: 0.9rem; white-space: nowrap; color: var(--ink-soft); }
.watch-actions form { margin: 0; }

/* alerts */
.alerts { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.alerts li {
  display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.8rem; align-items: start;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px;
  padding: 0.7rem 0.9rem; margin-bottom: 0.5rem;
}
.alerts .price { font-weight: 600; font-size: 1.3rem; color: var(--go-ink); }

/* forms */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack label, fieldset label:not(.radio) { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 500; }
input, select {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: 4px; padding: 0.5rem 0.6rem; width: 100%;
}
input:focus, select:focus { border-color: var(--ink); outline: none; }
input.code { text-transform: uppercase; max-width: 8rem; font-weight: 600; letter-spacing: 0.06em; }
input.code-list { text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.4rem; }
fieldset { border: 1px solid var(--rule); border-radius: 6px; padding: 0.8rem 1rem 1rem; margin: 0; background: var(--paper); }
legend { font-weight: 600; padding: 0 0.3rem; }
label.radio { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 400; padding: 0.15rem 0; }
label.radio input { width: auto; margin: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-wide { background: transparent; }
.actions { display: flex; gap: 1.2rem; align-items: center; margin-top: 0.4rem; }
.danger-zone { margin-top: 3rem; }

/* login */
.login { max-width: 22rem; margin: 12vh auto 0; }
.login-title { font-size: 2.6rem; }
.login-title::after { content: ""; display: block; width: 2.2rem; height: 0.35rem; background: var(--flap); margin: 0.5rem 0 0.8rem; border-radius: 2px; }
.lede { color: var(--ink-soft); margin-bottom: 1.4rem; max-width: 40ch; }

/* settings */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.1rem 1.2rem; margin-bottom: 1rem; }
.panel h2 { margin-bottom: 0.5rem; }
.steps { padding-left: 1.2rem; margin: 0.5rem 0 0; }
.steps li { margin-bottom: 0.35rem; }
.link-code { background: var(--board); color: var(--flap); padding: 0.1rem 0.5rem; border-radius: 4px; font-weight: 600; letter-spacing: 0.15em; font-size: 1.1rem; }
.panel .actions form { margin: 0; }

@media (max-width: 640px) {
  html { font-size: 16px; }
  h1 { font-size: 1.7rem; }
  .top { flex-wrap: wrap; }
  .top nav { gap: 0.9rem; }
  .board .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "route price" "when price" "who tag";
    column-gap: 0.7rem;
  }
  .board .tag { text-align: right; }
  .watch { flex-direction: column; gap: 0.4rem; }
  .two { grid-template-columns: 1fr; }
  .alerts li { grid-template-columns: 3.8rem 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .board .row { transition: background 120ms ease; }
}
