/* Modern CSS Reset
 * Sources:
 * - https://www.joshwcomeau.com/css/custom-css-reset/
 * - https://piccalil.li/blog/a-more-modern-css-reset/
 */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { text-size-adjust: none; }
body { min-height: 100vh; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { line-height: 1.1; text-wrap: balance; }
p { text-wrap: pretty; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol, li { list-style: none; padding: 0; margin: 0; }
:target { scroll-margin-block: 5ex; }

/* Plaintext-inspired styling */
:root {
  --bg: white;
  --fg: black;
  --link: #0000ee;
  --link-visited: #551a8b;
  --muted: #666;
  --border: #ccc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101010;
    --fg: #e0e0e0;
    --link: #6699ff;
    --link-visited: #b399ff;
    --muted: #888;
    --border: #333;
  }
}

html {
  font-family: Courier, "Courier New", monospace;
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
}

body {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

a {
  color: var(--fg);
  font-weight: bold;
}

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

nav {
  margin-bottom: 1rem;
}

nav a {
  margin-right: 0.5rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

h1 {
  font-size: 1.25rem;
  font-weight: bold;
  margin: 0 0 1rem 0;
}

h2 {
  font-size: 1rem;
  font-weight: bold;
  margin: 1.5rem 0 0.5rem 0;
}

p {
  margin: 0.5rem 0;
}

dl {
  margin: 0.5rem 0;
}

dt {
  font-weight: bold;
  margin-top: 0.5rem;
}

dd {
  margin-left: 1rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

th, td {
  text-align: left;
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: bold;
}

form {
  margin: 1rem 0;
}

input[type="text"],
input[type="search"] {
  font-family: inherit;
  font-size: inherit;
  padding: 0.25rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

input[type="submit"],
button {
  font-family: inherit;
  font-size: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

input[type="submit"]:hover,
button:hover {
  background: var(--fg);
  color: var(--bg);
}

strong {
  font-weight: bold;
}

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

.plain {
  list-style: none;
  padding-left: 0;
}

.route-group {
  margin-bottom: 1rem;
}

.route-group a {
  margin-right: 0.75rem;
}

.map-container {
  position: relative;
  max-width: 100%;
  margin: 1rem 0;
}

.map-image {
  width: 100%;
  display: block;
}

.map-stop {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  text-decoration: none;
  color: white;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
  z-index: 1;
}

.map-stop:hover {
  z-index: 10;
}

.map-stop::after {
  content: attr(data-name);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  padding: 0.25rem 0.5rem;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.75rem;
  white-space: nowrap;
  text-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.map-stop:hover::after {
  opacity: 1;
}

/* Northbound: popover below */
.map-stop[data-direction="N"]::after,
.map-stop[data-direction="NE"]::after,
.map-stop[data-direction="NW"]::after {
  bottom: auto;
  top: 100%;
}

/* Eastbound: popover right */
.map-stop[data-direction="E"]::after {
  left: 100%;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

/* Westbound: popover left */
.map-stop[data-direction="W"]::after {
  left: auto;
  right: 100%;
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}

.map-you {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: bold;
  color: #c00;
}
