@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Lake Ägeri on an overcast day: pale water, spruce, deep lake, lichen. */
  --paper: #edf2f0;
  --ink: #12312b;
  --muted: #4c655f;
  --rule: #c5d2cd;
  --lake: #2a6088;
  --lichen: #b59a1c;
  --spruce: #12312b;

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --text: "Source Serif 4", Georgia, "Times New Roman", serif;

  --total: 76; /* months from Sept 2020 to Jan 2027 */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e211d;
    --ink: #e3ece8;
    --muted: #9db3ac;
    --rule: #2a443d;
    --lake: #74aed6;
    --lichen: #d8bd45;
    --spruce: #e3ece8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
}

main, footer {
  max-width: 62rem;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

h1, h2 {
  font-family: var(--display);
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

/* Intro */

.intro {
  padding-block: clamp(3rem, 12vh, 8rem) clamp(3rem, 8vh, 5rem);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem clamp(2rem, 5vw, 4rem);
  align-items: end;
}
.intro > div { grid-column: 1; grid-row: 1; }

.portrait {
  grid-column: 2;
  grid-row: 1;
  display: block;
  width: 15rem;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  background: #fff;
  /* The photo has a white ground: on the light page it melts into the paper. */
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  .portrait { mix-blend-mode: normal; }
}

@media (max-width: 46rem) {
  .intro { grid-template-columns: 1fr; align-items: start; }
  .intro > div { grid-row: 2; }
  .portrait { grid-column: 1; grid-row: 1; width: 7rem; }
}

h1 {
  font-size: clamp(3.25rem, 10vw, 7.25rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.9;
  margin-left: -0.04em;
}

.lede {
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  line-height: 1.35;
  max-width: 32ch;
  margin: 2rem 0 0;
}

/* Sections */

section {
  border-top: 1px solid var(--rule);
  padding-block: clamp(2.5rem, 6vh, 4rem);
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.prose { max-width: 62ch; }

.note {
  color: var(--muted);
  max-width: 62ch;
}

/* Colour key */

.key {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  font-family: var(--display);
  font-size: 0.9rem;
  color: var(--muted);
}
.key li { display: flex; align-items: center; gap: 0.5rem; }
.swatch {
  width: 1.5rem;
  height: 0.6rem;
  border-radius: 0.3rem;
}

.study { background: var(--spruce); }
.research { background: var(--lake); }
.care { background: var(--lichen); }
.org {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--spruce);
}

/* Chart */

.chart {
  --label: 21rem;
  position: relative;
  margin-top: 1.5rem;
  padding-top: 1.75rem;
}

.ticks {
  position: absolute;
  inset: 0 0 0 var(--label);
  pointer-events: none;
}
.ticks span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--m) / var(--total) * 100%);
  border-left: 1px solid var(--rule);
  padding-left: 0.35rem;
  font-family: var(--display);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--muted);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: var(--label) 1fr;
  align-items: center;
  min-height: 3.5rem;
  border-top: 1px solid var(--rule);
}

.what {
  margin: 0;
  padding: 0.55rem 1rem 0.55rem 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.25;
}
.where {
  display: block;
  font-family: var(--text);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 0.15rem;
}

.track {
  position: relative;
  height: 0.9rem;
}
.bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--s) / var(--total) * 100%);
  width: calc((var(--e) - var(--s)) / var(--total) * 100%);
  border-radius: 0.45rem;
}
/* Still running: the bar runs off the right edge instead of ending. */
.bar.open {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

@media (max-width: 46rem) {
  .chart { --label: 0rem; }
  .row {
    grid-template-columns: 1fr;
    padding-block: 0.6rem 0.8rem;
    min-height: 0;
  }
  .what {
    padding: 0 0 0.5rem;
    /* Keep the label readable where a year line passes behind it. */
    background: var(--paper);
    width: fit-content;
    padding-right: 0.5rem;
    position: relative;
  }
}

/* Footer */

footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  font-family: var(--display);
  font-size: 0.9rem;
  color: var(--muted);
}

a {
  color: var(--lake);
  text-underline-offset: 0.18em;
}
:focus-visible {
  outline: 2px solid var(--lake);
  outline-offset: 3px;
  border-radius: 2px;
}
