/* Nick Walker — subtlepath.com
   Palette borrows from nautical-chart symbology: navy ink on water-white,
   with chart magenta reserved for the route and for things you can act on. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-next-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #f5f7f7;
  --shoal: #e3ecef;
  --ink: #0f1d2e;
  --slate: #4c6275;
  --rule: #c9d6dc;
  --route: #a8196f;
  --route-hover: #86105a;
  --on-route: #ffffff;
  --marker-fill: var(--paper);
  --mark-filter: none;

  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.3125rem;
  --step-2: 1.5rem;
  --step-3: 2.25rem;
  --step-4: clamp(3rem, 1.6rem + 5.6vw, 5.5rem);
  --lede: clamp(1.5rem, 1.15rem + 1.3vw, 2.125rem);

  --gutter: clamp(1rem, 0.4rem + 3vw, 3rem);
  --page: 72rem;

  /* Route grid: date, rail, body, sources */
  --col-when: 10rem;
  --col-rail: 2.5rem;
  --col-body: 38rem;
  --col-sources: 13rem;
  --col-gap: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1826;
    --shoal: #102338;
    --ink: #e2eaf0;
    --slate: #98adbd;
    --rule: #233a50;
    --route: #f07cbf;
    --route-hover: #f7a6d4;
    --on-route: #0b1826;
    --marker-fill: var(--paper);
    --mark-filter: invert(1);
  }
}

:root[data-theme="dark"] {
  --paper: #0b1826;
  --shoal: #102338;
  --ink: #e2eaf0;
  --slate: #98adbd;
  --rule: #233a50;
  --route: #f07cbf;
  --route-hover: #f7a6d4;
  --on-route: #0b1826;
  --marker-fill: var(--paper);
  --mark-filter: invert(1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--route);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--route-hover);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--route);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}

.skip:focus {
  top: 1rem;
}

.page {
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.brand img {
  width: 2.5rem;
  height: 2.5rem;
  filter: var(--mark-filter);
}

.brand:hover {
  color: var(--ink);
}

.masthead nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 1rem;
}

.masthead nav a {
  color: var(--ink);
  text-decoration: none;
}

.masthead nav a:hover {
  color: var(--route);
  text-decoration: underline;
}

/* Introduction */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 17rem);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: clamp(3rem, 8vw, 6.5rem) clamp(3.5rem, 8vw, 6rem);
}

.intro h1 {
  font-size: var(--step-4);
  font-weight: 750;
  line-height: 0.95;
  letter-spacing: -0.035em;
}

.tagline {
  margin-top: 0.75rem;
  font-size: var(--step-1);
  color: var(--slate);
  font-weight: 500;
}

.lede {
  margin-top: clamp(2rem, 4vw, 3rem);
  max-width: 24em;
  font-size: var(--lede);
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.summary {
  margin-top: 1.5rem;
  max-width: 36em;
  color: var(--ink);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 2.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.7rem 1.25rem;
  border-radius: 6px;
  background: var(--route);
  color: var(--on-route);
  font-weight: 650;
  text-decoration: none;
}

.button:hover {
  background: var(--route-hover);
  color: var(--on-route);
}

.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 3px;
  background: var(--shoal);
}

.portrait figcaption {
  margin-top: 0.625rem;
  font-size: var(--step--1);
  color: var(--slate);
}

/* The route */

.journey {
  position: relative;
  padding-block: clamp(3rem, 6vw, 5rem) 1rem;
  border-top: 1px solid var(--rule);
}

.route-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  clip-path: inset(0 0 0 0);
}

.route-line path {
  fill: none;
  stroke: var(--route);
  stroke-width: 2;
  stroke-linecap: round;
}

.route-line .is-undated {
  stroke-dasharray: 2 7;
}

.journey.is-drawing .route-line {
  clip-path: inset(0 0 100% 0);
}

.journey.is-drawn .route-line {
  transition: clip-path 2.2s cubic-bezier(0.45, 0, 0.2, 1);
}

.route-head,
.stop {
  display: grid;
  grid-template-columns: var(--col-when) var(--col-rail) minmax(0, var(--col-body)) minmax(0, var(--col-sources));
  column-gap: var(--col-gap);
  grid-template-areas: "when rail body sources";
}

.route-head {
  padding-bottom: 2.5rem;
}

.route-head > * {
  grid-column: body / sources-end;
}

.route-head h2 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.route-head p {
  margin-top: 0.75rem;
  max-width: 34em;
  color: var(--slate);
}

.route-head--earlier {
  padding-top: 1.5rem;
}

.stop {
  padding-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.stop-when {
  grid-area: when;
  text-align: right;
  font-size: 1rem;
  line-height: 1.8rem;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stop-field {
  display: block;
  font-size: var(--step--1);
}

.stop-rail {
  grid-area: rail;
  position: relative;
}

/* Straight fallback line until the script draws the path */
.stop-rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--route);
}

.route--earlier .stop-rail::before {
  background: repeating-linear-gradient(var(--route) 0 2px, transparent 2px 9px);
}

.has-route .stop-rail::before {
  display: none;
}

.stop-marker {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(0.9rem - 7px);
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  border: 2px solid var(--route);
  background: var(--marker-fill);
}

.route--earlier .stop-marker {
  width: 11px;
  height: 11px;
  margin-left: -5.5px;
  top: calc(0.9rem - 5.5px);
}

/* Current position: the walker from the Subtle Path mark */
.is-current .stop-marker {
  width: 18px;
  height: 18px;
  margin-left: -9px;
  top: calc(0.9rem - 9px);
  background: var(--route);
  border-color: var(--route);
  box-shadow: 0 0 0 5px var(--paper);
}

.stop-walker {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: calc(0.9rem - 9px - 36px);
  width: 21px;
  height: 36px;
  margin-left: -11px;
  color: var(--ink);
}

.stop-body {
  grid-area: body;
  max-width: 38rem;
}

.stop-body h3 {
  font-size: var(--step-2);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.stop-role {
  margin-top: 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate);
}

.stop-body h3 + p {
  margin-top: 0.5rem;
}

.stop-body p + p {
  margin-top: 0.75rem;
}

.stop-body .stop-role + p {
  margin-top: 0.875rem;
}

.stop-sources {
  grid-area: sources;
  padding-top: 0.35rem;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--slate);
}

.stop-sources p {
  font-weight: 600;
  color: var(--slate);
}

.stop-sources ul {
  margin-top: 0.375rem;
  display: grid;
  gap: 0.5rem;
  padding-left: 0.875rem;
  border-left: 1px solid var(--rule);
}

.stop-sources li span {
  display: block;
}

/* Also: service and education */

.also {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--rule);
}

.also h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--slate);
}

.also h3 {
  margin-top: 0.5rem;
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1.25;
}

.also p {
  margin-top: 0.375rem;
  max-width: 28em;
}

.also .meta {
  color: var(--slate);
  font-size: 1rem;
}

/* Contact */

.contact {
  padding-block: clamp(3.5rem, 8vw, 6rem);
  border-top: 1px solid var(--rule);
}

.contact h2 {
  font-size: var(--step-3);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.contact p {
  margin-top: 1rem;
  max-width: 34em;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--slate);
}

/* Error page */

.lost {
  padding-block: clamp(4rem, 12vw, 9rem);
  max-width: 34rem;
}

.lost h1 {
  font-size: var(--step-3);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lost p {
  margin-top: 1rem;
}

/* Medium screens: sources move under each entry */

@media (max-width: 68rem) {
  .route-head,
  .stop {
    grid-template-columns: var(--col-when) var(--col-rail) minmax(0, 1fr);
    grid-template-areas:
      "when rail body"
      "when rail sources";
  }

  .route-head > * {
    grid-column: body;
  }

  .stop-sources {
    padding-top: 1rem;
    max-width: 38rem;
  }

  .stop-sources ul {
    border-left: 0;
    padding-left: 0;
  }
}

@media (max-width: 52rem) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }

  .portrait {
    grid-row: 1;
    width: 7.5rem;
  }

  .portrait figcaption {
    display: none;
  }

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

/* Small screens: the date joins the entry, the rail hugs the edge */

@media (max-width: 40rem) {
  :root {
    --col-rail: 1.5rem;
    --col-gap: 0.875rem;
  }

  .route-head,
  .stop {
    grid-template-columns: var(--col-rail) minmax(0, 1fr);
    grid-template-areas:
      "rail when"
      "rail body"
      "rail sources";
  }

  .stop-when {
    text-align: left;
    line-height: 1.5rem;
  }

  .stop-marker {
    top: calc(0.75rem - 7px);
  }

  .is-current .stop-marker {
    top: calc(0.75rem - 9px);
  }

  .stop-walker {
    top: calc(0.75rem - 9px - 36px);
  }

  .route--earlier .stop-marker {
    top: calc(0.75rem - 5.5px);
  }

  .stop-body h3 {
    margin-top: 0.125rem;
  }

  .masthead .brand span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .journey.is-drawn .route-line {
    transition: none;
  }
}

/* Print: a compact one-column résumé */

@media print {
  :root {
    --paper: #fff;
    --ink: #000;
    --slate: #3a3a3a;
    --route: #000;
    --rule: #bbb;
    --mark-filter: none;
  }

  @page {
    margin: 0.6in 0.7in;
  }

  body {
    font-size: 9.5pt;
    line-height: 1.4;
  }

  .skip,
  .masthead,
  .actions,
  .route-line,
  .stop-rail,
  .route-head p,
  .stop-sources > p,
  .contact,
  .portrait {
    display: none !important;
  }

  .page {
    padding: 0;
    max-width: none;
  }

  .intro,
  .route-head,
  .stop {
    display: block;
    padding: 0;
  }

  .intro h1 {
    font-size: 22pt;
  }

  .tagline {
    margin-top: 2pt;
    font-size: 11pt;
  }

  .lede {
    margin-top: 8pt;
    max-width: none;
    font-size: 11.5pt;
  }

  .summary {
    margin-top: 6pt;
    max-width: none;
  }

  .journey {
    padding: 10pt 0 0;
  }

  .route-head h2 {
    font-size: 13pt;
    margin-bottom: 6pt;
  }

  .route-head--earlier {
    padding-top: 4pt;
  }

  .route-head {
    break-after: avoid;
  }

  .stop {
    padding-bottom: 9pt;
    break-inside: avoid;
  }

  .stop-when {
    text-align: left;
    line-height: 1.3;
    font-size: 8.5pt;
  }

  .stop-body {
    max-width: none;
  }

  .stop-body h3 {
    display: inline;
    font-size: 11pt;
  }

  .stop-role {
    display: inline;
    margin-left: 6pt;
    font-size: 9.5pt;
  }

  .stop-body h3 + p,
  .stop-body .stop-role + p,
  .stop-body p + p {
    margin-top: 3pt;
  }

  .stop-sources {
    padding-top: 3pt;
    font-size: 8pt;
  }

  .stop-sources ul {
    display: block;
    margin: 0;
    border: 0;
    padding: 0;
  }

  .stop-sources li,
  .stop-sources li span {
    display: inline;
  }

  .stop-sources li + li::before {
    content: "; ";
  }

  .stop-sources li span::before {
    content: ", ";
  }

  .stop-sources a::after {
    content: " (" attr(href) ")";
    word-break: break-all;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .also {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8pt 0;
    gap: 8pt 18pt;
  }

  .also h3 {
    font-size: 10.5pt;
    margin-top: 2pt;
  }

  .also h2,
  .also .meta {
    font-size: 9pt;
  }

  .site-foot {
    padding: 6pt 0 0;
    font-size: 8pt;
  }
}
