/* The roadmap: one vertical rail of 2 px ink down the left of the page, three stations on it. The mark of each
   station is cut at 45 degrees. The station that comes next stands on a band of ultramarine, the band of the
   charter, with its text in paper; what is only evaluated hangs on a dashed stretch of the rail. The layout is the
   same on every screen: on a wide one the list sits beside the title, in two columns. */

.roadmap {
  --band: var(--color-accent);
  --on-band: #f2f4f6;
  --faint: color-mix(in srgb, var(--color-text) 50%, transparent);
  padding-block: clamp(48px, 6vw, 80px) clamp(64px, 8vw, 112px);
}

/* On ink, the band takes the lighter ultramarine and ink text: paper on the dark accent would read under 4.5:1. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .roadmap {
    --band: var(--color-accent-ink);
    --on-band: #0c1016;
  }
}

:root[data-theme="dark"] .roadmap {
  --band: var(--color-accent-ink);
  --on-band: #0c1016;
}

.rail {
  --mark: 20px;
  --rail-gap: clamp(28px, 4vw, 48px);
  position: relative;
  max-width: 1120px;
  margin: 0;
  padding: 0 0 0 var(--rail-gap);
  list-style: none;
  border-left: 2px solid var(--color-text);
}

.station {
  position: relative;
  padding: 4px 0 clamp(40px, 5vw, 64px);
}

.station:last-child {
  padding-bottom: 8px;
}

/* The mark, centred on the rail. */
.station-mark {
  position: absolute;
  top: 6px;
  left: calc(-1 * var(--rail-gap) - 1px - var(--mark) / 2);
  z-index: 1;
  width: var(--mark);
  height: var(--mark);
  box-sizing: border-box;
  background: var(--color-text);
  clip-path: polygon(5px 0, calc(100% - 5px) 0, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px), 0 5px);
}

.station-next .station-mark {
  background: var(--color-accent);
}

.station-exploring .station-mark {
  background: var(--color-bg);
  border: 2px dashed var(--faint);
  clip-path: none;
}

/* The stretch of the rail along what is only evaluated: dashed, over the solid rule. */
.station-exploring::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * var(--rail-gap) - 2px);
  width: 2px;
  background: repeating-linear-gradient(to bottom, var(--faint) 0 6px, var(--color-bg) 6px 12px);
}

.station-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.2fr);
  gap: 16px clamp(32px, 4vw, 48px);
}

.station-next .station-body {
  padding: clamp(22px, 3vw, 32px) clamp(20px, 3vw, 32px) 20px;
  background: var(--band);
  color: var(--on-band);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

/* The label: the square of the charter, the index and the state in words. */
.station-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
}

.station-label::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--color-accent);
}

.station-exploring .station-label {
  color: var(--color-quiet);
}

.station-exploring .station-label::before {
  background: var(--color-text);
}

.station-next .station-label,
.station-next h2,
.station-next .station-note {
  color: var(--on-band);
}

.station-next .station-label::before {
  background: var(--on-band);
}

.station h2 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.1;
}

.station-note {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-quiet);
}

.station-items {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 40px;
  border-top: 2px solid var(--color-divider);
}

.station-items li {
  padding: 12px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
  font-size: 0.9375rem;
  line-height: 1.5;
  break-inside: avoid;
}

.station-items strong {
  display: block;
  margin-bottom: 2px;
  font-weight: 600;
}

.station-items strong a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--color-text) 40%, transparent);
}

.station-items strong a:hover {
  color: var(--color-accent-ink);
}

.station-items span {
  color: var(--color-muted);
}

.station-exploring .station-items strong {
  font-weight: 500;
}

/* On the band, everything is in the colour of the band's text; the rules are that colour, faded. */
.station-next .station-items {
  border-top-color: color-mix(in srgb, var(--on-band) 40%, transparent);
}

.station-next .station-items li {
  border-bottom-color: color-mix(in srgb, var(--on-band) 25%, transparent);
}

.station-next .station-items span,
.station-next .station-items strong a,
.station-next .station-items strong a:hover {
  color: var(--on-band);
}

.station-next .station-items strong a {
  text-decoration-color: color-mix(in srgb, var(--on-band) 50%, transparent);
}

.station-next .station-items strong a:hover {
  text-decoration-color: var(--on-band);
}

/* The focus ring is ultramarine on the site: on the band it takes the colour of the band's text. */
.station-next a:focus-visible {
  outline-color: var(--on-band);
}

.roadmap-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px clamp(32px, 5vw, 72px);
  max-width: 1040px;
  margin-top: clamp(56px, 7vw, 88px);
  padding-top: clamp(32px, 4vw, 48px);
  border-top: 2px solid var(--color-divider);
}

.roadmap-notes h2 {
  margin: 0 0 12px;
  font-size: 1.375rem;
}

.roadmap-notes p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-muted);
}

.roadmap-notes a {
  color: var(--color-accent-ink);
}

/* On a narrow screen the list goes under the title, in one column, and the rail comes closer. */
@media (max-width: 860px) {
  .rail {
    --rail-gap: 24px;
  }

  .station-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px 0;
  }

  .station-next .station-body {
    padding: 22px 20px 16px;
  }

  .station-items {
    columns: 1;
  }

  .roadmap-notes {
    grid-template-columns: minmax(0, 1fr);
  }
}
