:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #555;
  --rule: #bdbdbd;
  --paper: #fff;
  --shade: #f3f3f3;
}

* {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 1rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem);
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.25rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.035em;
}

h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -0.02em;
}

h3 {
  margin: 2rem 0 0.75rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

h3[id] {
  scroll-margin-top: 1rem;
}

p,
ul,
ol {
  max-width: 65ch;
  margin: 0 0 1.25rem;
}

ul,
ol {
  padding-left: 1.5em;
}

li + li {
  margin-top: 0.75rem;
}

li::marker {
  color: var(--muted);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
main:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

header p,
footer {
  color: var(--muted);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin: 1.5rem 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  font-size: 1rem;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0;
}

main > p:first-child {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--ink);
  background: var(--shade);
}

section {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
}

section > :last-child {
  margin-bottom: 0;
}

/* Keep the timetable full-width, with tabular figures for scanning times. */
table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

th,
td {
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

thead th {
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--ink);
  font-size: 1rem;
}

tbody th {
  font-size: 1rem;
}

small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.875em;
}

/* Booking links stay inline so they do not interrupt the reading rhythm. */
.button {
  font-weight: 650;
}

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 1rem;
}

footer p {
  margin-bottom: 0;
}

footer p + p {
  margin-top: 1rem;
}

figure {
  min-width: 0;
  margin: 0 0 1.25rem;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 1rem;
}

.photo-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: start;
  margin-top: 2rem;
}

.map-legend {
  font-size: 1rem;
}

@media screen and (max-width: 32rem) {
  .photo-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.skip {
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  transform: translateY(calc(-100% - 1rem));
}

.skip:focus {
  z-index: 1;
  transform: none;
}

@media screen and (max-width: 44rem) {
  /* Preserve the column headings for assistive technology when rows reflow. */
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  table,
  tbody {
    display: block;
  }

  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem 1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--rule);
  }

  tbody tr:first-child {
    padding-top: 0;
  }

  tbody th,
  tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  tbody th,
  tbody td:nth-child(2) {
    grid-column: 1 / -1;
  }

  tbody th {
    color: var(--muted);
  }

  td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.25rem;
    color: var(--muted);
    font-size: 1rem;
  }
}

@media print {
  body {
    max-width: none;
    padding: 0;
    font-size: 11pt;
  }

  nav,
  .skip {
    display: none;
  }

  h1 {
    font-size: 24pt;
  }

  h2 {
    font-size: 16pt;
  }

  h3 {
    font-size: 12pt;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  figure {
    break-inside: avoid;
  }

  figcaption,
  .map-legend {
    font-size: 10pt;
  }

  section {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }

  tr,
  li {
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  th,
  td {
    padding: 0.5rem;
  }

  thead th,
  tbody th,
  footer {
    font-size: 10pt;
  }

  a {
    text-decoration-thickness: 0.5pt;
  }
}
