:root {
  --paper: #f2eee4;
  --ink: #17150f;
  --ink-soft: #4f4a3e;
  --art: #c93e26;
  --film: #2446a8;
  --food: #a66b00;
  --literature: #2c7a55;
  --music: #7b3fa0;
  --outdoors: #11736f;
  --walks: #b23a73;
  --display: "Franklin Gothic Medium", "Franklin Gothic URW", "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --text: "Franklin Gothic Book", "Franklin Gothic URW", "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
}

.cat-art { --route: var(--art); }
.cat-film { --route: var(--film); }
.cat-food { --route: var(--food); }
.cat-literature { --route: var(--literature); }
.cat-music { --route: var(--music); }
.cat-outdoors { --route: var(--outdoors); }
.cat-walks { --route: var(--walks); }

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scrollbar-color: var(--ink) var(--paper);
}

body {
  margin: 0;
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  top: 16px;
}

/* Masthead */

.masthead {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(16px, 4vw, 40px) 32px;
  border-bottom: 3px solid var(--ink);
}

.wordmark {
  font-size: clamp(3.5rem, 11vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 38rem;
  margin: 20px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  color: var(--ink-soft);
}

.route-key {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.95rem;
}

.route-key li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-key li::before {
  content: "";
  width: 22px;
  height: 8px;
  background: var(--route);
}

/* Layout */

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 40px) 96px;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.controls {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 0.95rem;
}

input[type="text"],
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
}

input[type="text"]::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

select {
  appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1 1l7 7 7-7' fill='none' stroke='%2317150F' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}

input[type="text"] {
  caret-color: var(--ink);
}

.button {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: background-color 160ms ease-out, color 160ms ease-out;
}

.button:hover {
  background: var(--ink);
  color: var(--paper);
}

.button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

.button[aria-pressed="true"]:hover {
  background: transparent;
  color: var(--ink);
}

.saved-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.count {
  display: inline-block;
  min-width: 1.8em;
  margin-left: 8px;
  padding: 0 6px;
  border: 1.5px solid currentColor;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.result-count {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Day groups and stops */

.day + .day {
  margin-top: 56px;
}

.day h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  padding-bottom: 14px;
  border-bottom: 3px solid var(--ink);
}

.stop-list {
  --time-col: 92px;
  --gap: 18px;
  --dot: 18px;
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The transit line that every stop sits on. */
.stop-list::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--time-col) + var(--gap) + var(--dot) / 2 - 1.5px);
  width: 3px;
  background: var(--ink);
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: var(--time-col) var(--dot) minmax(0, 1fr);
  column-gap: var(--gap);
  padding: 22px 0 28px;
}

.time {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.time time {
  display: block;
}

.time time + time {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.dot {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  position: relative;
  width: var(--dot);
  height: var(--dot);
  margin-top: 7px;
  border: 4px solid var(--route);
  border-radius: 50%;
  background: var(--paper);
}

.stop.is-saved .dot {
  background: var(--route);
}

.stop-body h3 {
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
}

.stop:hover .stop-body h3 {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.meta {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.summary {
  max-width: 62ch;
  margin: 8px 0 0;
}

.stop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.saved-tag {
  padding: 4px 10px;
  font-size: 0.85rem;
  background: var(--ink);
  color: var(--paper);
}

.notice {
  padding: 24px 0;
  color: var(--ink-soft);
}

/* Empty state */

.empty {
  padding: 48px 0;
  border-top: 3px solid var(--ink);
}

.empty h2 {
  font-size: 1.8rem;
}

.empty p {
  max-width: 40ch;
  margin: 10px 0 20px;
  color: var(--ink-soft);
}

/* Detail sheet */

.sheet {
  width: min(100%, 680px);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}

.sheet::backdrop {
  background: rgba(23, 21, 15, 0.55);
}

.sheet-inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100%;
  padding: clamp(20px, 4vw, 40px);
}

.sheet[open] .sheet-inner {
  animation: sheet-in 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sheet-head {
  display: flex;
  justify-content: flex-end;
}

.sheet h2 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  margin: 0;
}

.fact dt {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.fact dd {
  margin: 2px 0 0;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.sheet-actions {
  display: flex;
}

.sheet-body h3 {
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.sheet-body p {
  max-width: 62ch;
  margin: 0 0 14px;
}

/* Footer */

.colophon {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px) 48px;
  border-top: 1px solid rgba(23, 21, 15, 0.22);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Responsive */

@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .controls {
    position: static;
  }

  .stop-list {
    --time-col: 64px;
    --gap: 12px;
    --dot: 16px;
  }
}

@media (max-width: 560px) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] .sheet-inner {
    animation: none;
  }

  .button {
    transition: none;
  }
}
