/* Crisp and precise: a career drawn as a timing diagram.
   Rules this sheet holds to: one typeface, one signal colour, no radii, no shadows
   for depth, no transitions or animation anywhere. Every vertical in the page sits
   on the same year grid. */

:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --ink: #0b0c0d;
  --mute: #55585c;
  --rule: #0b0c0d;
  --hair: #d3d5d7;
  --grid: #e6e7e8;
  --low: #8b8e92;
  --hatch: #a2a5a8;
  --hatch-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 8 8 0' stroke='%23a2a5a8' shape-rendering='crispEdges'/%3E%3C/svg%3E");
  --signal: #ffd400;
  --on-signal: #0b0c0d;
  --edge-on: #0b0c0d;
  --focus: #0b0c0d;
  --gutter: clamp(16px, 3.5vw, 64px);
  --sans: Bahnschrift, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: Bahnschrift, "DIN Alternate", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c0e0f;
    --ink: #f2f2ee;
    --mute: #b2b5b7;
    --rule: #7d8285;
    --hair: #2e3234;
    --grid: #272b2d;
    --low: #6d7275;
    --hatch: #5c6164;
    --hatch-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 8 8 0' stroke='%235c6164' shape-rendering='crispEdges'/%3E%3C/svg%3E");
    --edge-on: #ffd400;
    --focus: #ffd400;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 300 1rem/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}
b { font-weight: 400; }
h1, h2, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
[hidden] { display: none !important; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
a:hover { background: var(--signal); color: var(--on-signal); }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: -6rem; z-index: 10;
  padding: .5rem .75rem; background: var(--signal); color: var(--on-signal);
}
.skip:focus { top: .5rem; }

/* The year grid. --yr is one year in whole pixels, so every edge lands on a pixel. */
.page {
  container-type: inline-size;
  max-width: 1800px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.frame {
  --plot: 100cqw;
  --yr: calc(var(--plot) / 27);
  --cols: minmax(0, 1fr);
  --when: 6.5rem;
}
@supports (width: round(down, 10px, 1px)) {
  .frame { --yr: round(down, calc(var(--plot) / 27), 1px); }
}
@media (min-width: 52rem) {
  .frame {
    --label: clamp(25rem, 36cqw, 38rem);
    --plot: calc(100cqw - var(--label));
    --cols: minmax(0, 1fr) calc(27 * var(--yr));
  }
}

/* Masthead */
.bar {
  display: grid;
  grid-template-columns: var(--cols);
  gap: .25rem 0;
  padding-block: .625rem;
  border-bottom: 1px solid var(--rule);
}
.jump { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.back, .jump a { display: inline-block; padding-block: .125rem; }
.bar .back { justify-self: start; }
.back { font-weight: 400; }

.ident {
  display: grid;
  grid-template-columns: var(--cols);
  align-items: end;
  gap: 1.25rem 0;
  padding-block: 1.25rem 1rem;
}
h1 {
  font-family: var(--display);
  font-size: clamp(3.75rem, 21cqw, 5.75rem);
  font-weight: 300;
  line-height: .95;
  letter-spacing: -.02em;
  margin-left: -.05em; /* the stem of the R sits on the page's left rule */
  text-wrap: balance;
}
.block {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
}
.block > div { padding-block: .5rem; }
.block > div:first-child { grid-column: 1 / -1; }
.block dt, .note, .how, .minor { font-size: .875rem; color: var(--mute); font-weight: 400; }
.block dd { font-weight: 400; }

/* Career diagram */
.chart { --t: 26; scroll-margin-top: .5rem; }
.chart-head { display: contents; } /* lets the axis stick for the whole chart on narrow screens */
.chart-title { padding-block: .75rem; border-top: 1px solid var(--rule); }
h2 { font-size: 1.75rem; font-weight: 300; line-height: 1.1; letter-spacing: -.01em; }
.how { margin-top: .375rem; max-width: 34rem; }
.how-js { display: block; }

.scale {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 2.25rem;
  background: var(--paper);
  box-shadow: -.25rem 0 0 var(--paper); /* covers the highlight's overhang as rows scroll under */
}
.has-cursor .scale { height: 4.25rem; }
.axis {
  position: absolute;
  inset: auto 0 0 0;
  height: 2.25rem;
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(to right, var(--ink) 1px, transparent 1px) 0 0 / calc(5 * var(--yr)) 100% repeat-x,
    linear-gradient(to right, var(--ink) 1px, transparent 1px) 0 100% / var(--yr) .375rem repeat-x;
}
.axis span {
  position: absolute;
  z-index: 1;
  top: 0;
  left: calc(var(--y) * var(--yr) + 1px);
  padding-inline: 4px 2px;
  background: var(--paper);
  font-size: .8125rem;
  font-weight: 400;
  line-height: 1.25;
}
.scrubber { display: contents; }
.scale .scrub {
  --thumb: 1.5rem;
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: calc(var(--thumb) / -2);
  width: calc(26 * var(--yr) + var(--thumb));
  height: 100%;
  margin: 0;
  padding: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: ew-resize;
}
.scrub:focus { outline: none; }
.scrub::-webkit-slider-runnable-track { height: 100%; background: none; }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb);
  height: 100%;
  background: transparent;
  cursor: ew-resize;
}
.scrub::-moz-range-track { height: 100%; background: none; }
.scrub::-moz-range-thumb {
  width: var(--thumb);
  height: 100%;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: ew-resize;
}
.flag {
  position: absolute;
  top: 0;
  left: clamp(0px, calc(var(--t) * var(--yr) - 2.5rem), calc(100% - 5rem));
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 5rem;
  height: 1.75rem;
  padding-inline: .4375rem;
  background: var(--signal);
  color: var(--on-signal);
  border: 1px solid var(--edge-on);
  font-weight: 600;
}
.scrub:focus-visible ~ .flag { outline: 3px solid var(--focus); outline-offset: 2px; }
.has-cursor .scale::after {
  content: "";
  position: absolute;
  top: 1.75rem;
  bottom: 0;
  left: calc(var(--t) * var(--yr));
  width: 2px;
  background: var(--edge-on);
}

.rows { margin: 0; }
.row {
  display: grid;
  grid-template-columns: var(--when) minmax(0, 1fr);
  border-bottom: 1px solid var(--hair);
  padding-top: .5rem;
  font-size: .9375rem;
  line-height: 1.2;
}
.row:has(+ .cont) { border-bottom-color: transparent; }
.when { color: var(--mute); font-weight: 400; }
.when > span { display: inline-block; }
.what { text-wrap: balance; }
@media screen {
  /* Bahnschrift keeps the same widths at every weight, so this does not reflow. */
  .row.on .what, .row.on .what b { font-weight: 600; }
  .row.on .when { color: var(--on-signal); font-weight: 600; }
  .row.on .when > span { background: var(--signal); box-shadow: 0 0 0 2px var(--signal); }
  .row.on .plot i { background: var(--signal); border-color: var(--edge-on); }
}

/* One trace: a low baseline with a square pulse standing on it. */
.plot {
  --pad: .5rem;
  position: relative;
  display: block;
  grid-column: 1 / -1;
  height: 2.5rem;
  background: linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / calc(5 * var(--yr)) 100% repeat-x;
}
.plot::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--pad);
  height: 1px;
  background: var(--low);
}
.plot i {
  position: absolute;
  z-index: 1;
  top: var(--pad);
  bottom: var(--pad);
  left: calc(var(--a) * var(--yr));
  width: calc((var(--b) - var(--a)) * var(--yr) + 2px);
  background: var(--paper);
  border: solid var(--ink);
  border-width: 2px 2px 0;
}
.open .plot i { right: 0; width: auto; border-right: 0; }
.has-cursor .plot::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  bottom: -1px;
  left: calc(var(--t) * var(--yr));
  width: 2px;
  background: var(--edge-on);
}

/* Placeholders. Hatching is the timing-diagram mark for an undefined state. */
.ph {
  display: flex;
  align-items: flex-start;
  padding: .5rem;
  border: 1px solid var(--hatch);
  background: var(--hatch-tile);
  font-size: .875rem;
  line-height: 1.25;
}
.ph > span { padding: .25rem .5rem; background: var(--paper); color: var(--ink); }
.ph b { display: block; font-weight: 600; }
.ph > span { font-weight: 400; }
.ph-row { margin-top: -1px; }
.ph-row b { display: inline; margin-right: .5em; }
.ph-photo { min-height: 7rem; margin-top: 1rem; }
.ph-cell { min-height: 8rem; }
.ph-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }

.chart-foot { padding-block: .75rem 2.5rem; }
.note { max-width: 44rem; }

/* Sections below the diagram keep its two columns. */
.sec {
  display: grid;
  grid-template-columns: var(--cols);
  gap: 1rem 0;
  padding-block: 1rem 3rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: .5rem;
}
.prose { font-size: 1.0625rem; line-height: 1.5; max-width: 40rem; }
.prose p + p { margin-top: .875em; }

.spec > div {
  display: grid;
  grid-template-columns: max(calc(5 * var(--yr)), 5.5rem) minmax(0, 1fr);
  padding-block: .5rem;
  border-top: 1px solid var(--hair);
}
.spec > div:first-child { border-top: 0; padding-top: .125rem; }
.spec dt { color: var(--mute); font-weight: 400; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15.5rem), 1fr)); gap: .25rem 1rem; max-width: 33rem; }
.people a { display: inline-block; padding-block: .125rem; }
.goes-by { color: var(--mute); font-weight: 400; }
.minor { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--hair); }
.minor a { display: inline-block; padding-block: .125rem; }
.to-family { margin-top: 1rem; font-weight: 400; }
.to-family a { display: inline-block; padding-block: .125rem; }

.outbound li { border-top: 1px solid var(--hair); }
.outbound li:first-child { border-top: 0; }
.outbound a { display: block; padding-block: .5rem; }
.outbound li:first-child a { padding-top: .125rem; }
.arrow { display: inline-block; margin-left: .25em; }

.foot { padding-block: 1rem 3rem; border-top: 1px solid var(--rule); }

/* Wide: one row per role, labels left, trace right, all on the year grid. */
@media (min-width: 52rem) {
  .bar { align-items: baseline; }
  .block {
    grid-template-columns:
      calc(10 * var(--yr)) calc(5 * var(--yr)) calc(5 * var(--yr)) minmax(0, 1fr);
  }
  .block > div { padding-right: .5rem; }
  .block > div:first-child { grid-column: auto; }

  .chart-head {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: var(--cols);
    align-items: end;
    background: var(--paper);
    border-block: 1px solid var(--rule);
    box-shadow: -.25rem 0 0 var(--paper);
  }
  .chart-title { border-top: 0; padding-block: .625rem; padding-right: 1.5rem; }
  .scale { position: relative; top: auto; box-shadow: none; }
  .axis { border-bottom: 0; }

  .row {
    grid-template-columns: var(--when) minmax(0, 1fr) calc(27 * var(--yr));
    align-items: center;
    padding-top: 0;
    min-height: 2.75rem;
  }
  .what { padding-right: 1rem; padding-block: .25rem; }
  .plot { grid-column: auto; align-self: stretch; height: auto; min-height: 2.75rem; --pad: .6875rem; }

  .chart-foot { display: grid; grid-template-columns: var(--cols); }
  .note { grid-column: 2; }
  .ph-photo { width: min(100%, 15rem); aspect-ratio: 1; }
}

@media (forced-colors: active) {
  .row.on .plot i, .flag { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: CanvasText; }
  .plot::before, .scale::after, .plot::after { background: CanvasText !important; forced-color-adjust: none; }
}

@media print {
  :root {
    --paper: #fff; --ink: #000; --mute: #444; --rule: #000; --hair: #bbb;
    --grid: #ddd; --low: #777; --hatch: #999; --edge-on: #000;
  }
  .skip, .jump, .scrubber, .how-js, .plot::before, .scale::after { display: none !important; }
  .chart-head { position: static; }
  .has-cursor .scale { position: relative; height: 2.25rem; }
  .row { break-inside: avoid; }
}
