/* The Post-Punch-Card Canon: a wall chart of software history. Page-only stylesheet. */

:root {
  --paper: #fcfcfa;
  --ink: #121212;
  --ink-soft: #4a4a48;
  --rule: #e4e1d8;
  --signal: #d7262e;
  --mention-rule: #9a9893;

  --face-sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --face-read: "Charter", "Bitstream Charter", Georgia, serif;

  --measure: 62ch;
  --page: min(1240px, 100% - 2 * var(--gutter));
  --gutter: clamp(16px, 4vw, 48px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

*,
*::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(--face-read);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}

::selection {
  background: var(--signal);
  color: #fff;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:focus-visible,
.chart-scroll:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  font: 600 0.8125rem/1 var(--face-sans);
  text-decoration: none;
}

.skip-link:focus-visible {
  top: 12px;
}

.canon {
  width: var(--page);
  margin: 0 auto;
  padding-bottom: clamp(64px, 10vw, 128px);
}

/* ---- masthead: the poster's header strip ---- */

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding-top: clamp(20px, 3vw, 32px);
  border-bottom: 3px solid var(--ink);
}

.back-link {
  justify-self: start;
  margin: -12px 0 clamp(28px, 5vw, 56px) -12px;
  padding: 12px;
  font: 600 0.75rem/1 var(--face-sans);
  font-stretch: 112%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.back-arrow {
  flex: none;
}

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

.title {
  margin: 0;
  font-family: var(--face-sans);
  font-weight: 860;
  font-stretch: 125%;
  font-size: clamp(2.5rem, 7.4vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 13ch;
}

.lede {
  margin: clamp(18px, 2.4vw, 28px) 0 clamp(24px, 3vw, 36px);
  max-width: 46ch;
  font-style: italic;
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.lede a {
  color: var(--ink);
}

/* ---- the chart ---- */

.chart {
  margin: 0;
  border-bottom: 1px solid var(--ink);
}

.chart-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-soft) transparent;
  padding: clamp(12px, 2vw, 24px) 0 0;
}

.chart-scroll::-webkit-scrollbar {
  height: 6px;
}

.chart-scroll::-webkit-scrollbar-thumb {
  background: var(--ink-soft);
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 980px;
  height: auto;
  font-family: var(--face-sans);
  overflow: visible;
}

.axis {
  stroke: var(--ink);
  stroke-width: 2;
}

.tick {
  stroke: var(--ink);
  stroke-width: 1.25;
}

.tick--minor {
  stroke: var(--ink-soft);
  stroke-width: 0.75;
}

.decade {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 700;
  font-stretch: 100%;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}

.leader {
  stroke: var(--ink);
  stroke-width: 0.75;
}

.leader--mention {
  stroke: var(--mention-rule);
  stroke-dasharray: 2 2;
}

.dot {
  fill: var(--ink);
}

.node rect {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.25;
  transition: fill 120ms var(--ease-out);
}

.node text {
  fill: var(--ink);
  font-size: 12.5px;
  font-weight: 640;
  font-stretch: 82%;
  transition: fill 120ms var(--ease-out);
}

.node-rank {
  font-weight: 860;
  font-variant-numeric: tabular-nums;
}

.node:focus-visible {
  outline: none;
}

.node:focus-visible rect {
  stroke: var(--signal);
  stroke-width: 3;
}

.mention-node text {
  fill: var(--ink-soft);
  paint-order: stroke;
  stroke: var(--paper);
  stroke-width: 4px;
  stroke-linejoin: round;
  font-size: 11.5px;
  font-weight: 560;
  font-stretch: 88%;
}

.mention-node:focus-visible {
  outline: none;
}

.mention-node:focus-visible text {
  text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
  .node:hover rect {
    fill: var(--signal);
    stroke: var(--signal);
  }

  .node:hover text {
    fill: #fff;
  }

  .mention-node:hover text {
    text-decoration: underline;
  }
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 14px 0 16px;
  font: 600 0.75rem/1.2 var(--face-sans);
  font-stretch: 100%;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

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

.key::before {
  content: "";
  flex: none;
}

.key--box::before {
  width: 18px;
  height: 11px;
  border: 1.25px solid var(--ink);
}

.key--mention::before {
  width: 18px;
  height: 0;
  border-top: 1.5px dashed var(--mention-rule);
}

/* ---- the reading list ---- */

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry {
  display: grid;
  grid-template-columns: clamp(3.5rem, 11vw, 9rem) minmax(0, 1fr);
  column-gap: clamp(16px, 3vw, 40px);
  padding: clamp(22px, 3vw, 34px) 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 24px;
}

.entry-rank {
  font-family: var(--face-sans);
  font-weight: 860;
  font-stretch: 125%;
  font-size: clamp(2.25rem, 6vw, 4.75rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.entry-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  align-items: baseline;
}

.entry-name {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--face-sans);
  font-weight: 760;
  font-stretch: 92%;
  font-size: clamp(1.375rem, 2.6vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.entry-icon {
  flex: none;
  width: 28px;
  height: 28px;
  opacity: 0.88;
}

.entry-year {
  margin: 0;
  font: 700 0.9375rem/1 var(--face-sans);
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-soft);
}

.entry-desc,
.entry-note {
  grid-column: 1 / -1;
  max-width: var(--measure);
}

.entry-desc {
  margin: 10px 0 0 40px;
  font-size: 1.0625rem;
  text-wrap: pretty;
}

.entry-note {
  margin: 8px 0 0 40px;
  font: 500 0.875rem/1.4 var(--face-sans);
  font-stretch: 96%;
  color: var(--ink-soft);
}

.dagger {
  color: var(--signal);
  font-family: var(--face-read);
  font-weight: 700;
  margin-left: 0.15em;
}

.entry-name .dagger {
  align-self: flex-start;
  font-size: 0.6em;
}

.entry:target {
  animation: target-flash 1600ms var(--ease-out);
}

@keyframes target-flash {
  from {
    background: rgb(215 38 46 / 0.1);
  }
}

/* Hover: a quiet acknowledgement, not an invitation to click. Pointer
   devices only so a tap never leaves a row stuck; exits run faster than
   entries so the list settles quickly when the mouse moves on. */
.entry-rank,
.entry-name,
.entry-icon,
.mention-text strong,
.mention-icon {
  transition:
    color 120ms var(--ease-out),
    opacity 120ms var(--ease-out),
    transform 120ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .entry:hover .entry-rank {
    color: var(--signal);
    transition-duration: 180ms;
  }

  .entry:hover .entry-name {
    transform: translateX(3px);
    transition-duration: 180ms;
  }

  .entry:hover .entry-icon {
    opacity: 1;
    transform: scale(1.06);
    transition-duration: 180ms;
  }

  .mention:hover .mention-text strong {
    transform: translateX(2px);
    transition-duration: 180ms;
  }

  .mention:hover .mention-icon {
    opacity: 1;
    transition-duration: 180ms;
  }

  .mention-text strong {
    display: inline-block;
  }
}

/* ---- honourable mentions ---- */

.mentions {
  margin-top: clamp(56px, 8vw, 96px);
}

.mentions-heading {
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 3px solid var(--ink);
  font-family: var(--face-sans);
  font-weight: 820;
  font-stretch: 118%;
  font-size: clamp(1.5rem, 3.2vw, 2.25rem);
  letter-spacing: -0.025em;
  line-height: 1;
}

.mentions-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2 22rem;
  column-gap: clamp(24px, 4vw, 56px);
}

.mention {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  break-inside: avoid;
  scroll-margin-top: 24px;
}

.mention-icon {
  align-self: center;
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.mention-text {
  font-size: 0.9375rem;
  line-height: 1.4;
}

.mention-text strong {
  font: 700 0.9375rem/1.4 var(--face-sans);
  font-stretch: 92%;
  color: var(--ink);
}

.mention-note {
  font-style: italic;
  color: var(--ink-soft);
}

.mention-year {
  font: 700 0.8125rem/1 var(--face-sans);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

.mention:target {
  animation: target-flash 1600ms var(--ease-out);
}

@media (max-width: 640px) {
  .chart-svg {
    min-width: 1160px;
  }

  .chart-scroll.has-right {
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent);
    mask-image: linear-gradient(to right, #000 88%, transparent);
  }

  .chart-scroll.has-left {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%);
    mask-image: linear-gradient(to right, transparent, #000 8%);
  }

  .chart-scroll.has-left.has-right {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 8%, #000 88%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 8%, #000 88%, transparent);
  }

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

  .entry-desc,
  .entry-note {
    margin-left: 0;
  }

  .entry-name {
    gap: 10px;
  }

  .entry-icon {
    width: 24px;
    height: 24px;
  }
}

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

  .entry:hover .entry-name,
  .entry:hover .entry-icon,
  .mention:hover .mention-text strong {
    transform: none;
  }

  .entry:target,
  .mention:target {
    animation: none;
    background: rgb(215 38 46 / 0.08);
  }
}

@media print {
  .chart-scroll {
    overflow: visible;
  }

  .chart-svg {
    min-width: 0;
  }

  .skip-link,
  .back-link {
    display: none;
  }
}
