:root {
  --paper: #f4f2ea;     /* Amodo Design cream */
  --grid: rgba(62, 78, 77, 0.035);
  --ink: #111;
  --text: #1f1f1f;
  --muted: #5c5c5c;
  --rule: rgba(0, 0, 0, 0.1);
  --line: rgba(0, 0, 0, 0.22);
  --logo: #3e4e4d;      /* Amodo Design teal-grey */
  --accent: #ca4f3e;    /* Amodo Design coral */

  --serif: "IBM Plex Serif", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --side: 15rem;      /* contents column */
  --gap: 4rem;        /* space between it and the text */
  --measure: 38rem;   /* text column */
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1f1f;
    --grid: rgba(228, 235, 234, 0.025);
    --ink: #f5f5f5;
    --text: #e6e6e6;
    --muted: #a6a6a6;
    --rule: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.26);
    --logo: #e6e6e6;
    --accent: #e27464;
  }
}

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background-color: var(--paper);
  /* Faint graph paper, like amododesign.com */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  color: var(--text);
  font: 400 1.125rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: underline 1px var(--line);
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-color: currentColor; }

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

/* Small uppercase mono labels */
.caps {
  font: 400 0.75rem/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.wrap {
  display: grid;
  grid-template-columns: var(--side) minmax(0, var(--measure));
  column-gap: var(--gap);
  max-width: calc(var(--side) + var(--gap) + var(--measure));
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header: the logo sits over the contents column and the title over the
   text column, on the same baseline */

.masthead {
  --logo-width: 8.25rem;
  align-items: baseline;
  padding-top: 1.25rem;
}

/* The rule under the header spans both columns */
.masthead::after {
  content: "";
  grid-column: 1 / -1;
  grid-row: 3;
  margin-top: 2.25rem;
  border-bottom: 1px solid var(--rule);
}

.brand,
.masthead h1 { grid-row: 2; }

/* Switch to the simple view, in its own row at the top right */
.views {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: end;
  display: flex;
  margin-bottom: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 400 0.6875rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.views > * {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
}
.views a {
  color: var(--muted);
  text-decoration: none;
}
.views a:hover { color: var(--ink); }
.views [aria-current] {
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: block;
  justify-self: start;
  width: var(--logo-width);
  color: var(--logo);
  transition: color 0.15s;
  /* Sized so its lowercase letters match the title's. Baseline alignment
     puts the logo's bottom edge (the end of the underline) on the title's
     baseline; move it down so the letters sit there instead. The letters
     end 20.6 units down the 26-unit-tall, 99-unit-wide logo. */
  transform: translateY(calc(var(--logo-width) * (26 - 20.6) / 99));
}
.brand:hover { color: var(--accent); }
.brand svg {
  display: block;
  width: 100%;
  height: auto;
}

h1 {
  margin: 0;
  font: 400 2.25rem/1.2 var(--serif);
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Quotes */

main { padding: 2.75rem 0 2rem; }

.entry {
  margin: 0 0 3rem;
  padding: 0 0 3rem;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 3.25rem;
}

.entry:last-child {
  margin-bottom: 0;
  border-bottom: 0;
}

.date {
  margin: 0 0 0.9rem;
  font: 400 0.75rem/1.6 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.date a { text-decoration: none; }
.date a:hover { color: var(--ink); }

.entry h2 {
  margin: 0;
  font: 500 1.5rem/1.3 var(--serif);
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* Pill tag, as on amododesign.com */
.date .kind {
  display: inline-block;
  margin-left: 0.75rem;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: var(--ink);
}

.byline {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}
.byline .who {
  font-weight: 500;
  color: var(--ink);
}
.byline .role::before {
  content: "·";
  margin: 0 0.5em;
}

blockquote {
  margin: 1.5rem 0 0;
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
  transition: border-color 0.25s;
}
.entry.current blockquote { border-left-color: var(--accent); }

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

strong {
  font-weight: 600;
  color: var(--ink);
}

.notes {
  margin: 1.25rem 0 0;
  font-size: 1rem;
  line-height: 1.65;
}
blockquote + .notes { margin-top: 1rem; }

ul.notes {
  padding: 0;
  list-style: none;
}
ul.notes li {
  position: relative;
  padding-left: 1.25rem;
}
ul.notes li + li { margin-top: 0.6rem; }
ul.notes li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--muted);
}

.time {
  font: 400 0.875em var(--mono);
  color: var(--ink);
  white-space: nowrap;
}

.source {
  margin: 1.5rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}
blockquote + .source { padding-left: calc(1.25rem + 1px); }   /* line up with the quote text */
.source .caps { margin-right: 0.75rem; }
.source a:hover { color: var(--accent); }

/* Groups: several statements under one heading. Each says who, then when
   and where (linked to the source), then the quote. */

.item {
  margin-top: 2.25rem;
  scroll-margin-top: 3.25rem;
}
h2 + .item { margin-top: 1rem; }

.byline .when::before {
  content: "·";
  margin: 0 0.5em;
}
.byline .when a:hover { color: var(--accent); }

.item blockquote { margin-top: 0.85rem; }

/* Footer */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--rule);
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* Contents */

#timeline {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-height: 100vh;
  max-height: 100dvh;
  padding: 2.75rem 0 2.5rem;
}

.side-label { margin: 0 0 1rem; }

.toc,
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.toc > li + li { margin-top: 1.25rem; }

.toc-year {
  display: block;
  margin-bottom: 0.35rem;
  font: 500 0.75rem/1.5 var(--mono);
  color: var(--ink);
}

.toc a {
  display: grid;
  grid-template-columns: auto 3.4rem minmax(0, 1fr);
  column-gap: 0.5rem;
  align-items: baseline;
  padding: 0.3rem 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.toc a::before {
  content: "└";
  font: 400 0.75rem/1 var(--mono);
}

.toc a:hover,
.toc a.active { color: var(--ink); }
.toc a.active::before { color: var(--accent); }

.toc-date {
  font: 400 0.75rem/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}

.toc-name {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
}

.toc-kind {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.toc a.active .toc-name { font-weight: 500; }
.toc a.active .toc-kind { font-weight: 400; }

/* Reading progress */

.progress {
  display: grid;
  grid-template-areas: "bar pct";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.75rem;
  margin-top: 1.75rem;
}

.now { display: none; }

.bar {
  grid-area: bar;
  height: 2px;
  background: var(--rule);
}

.bar-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
}

.pct {
  grid-area: pct;
  min-width: 2.25rem;
  font: 400 0.75rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted);
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.6875rem;
}

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.1em 0.2em;
  border: 1px solid var(--line);
  border-radius: 3px;
  font: inherit;
  text-align: center;
  color: var(--ink);
}

/* Narrower screens: a smaller contents column */

@media (max-width: 63.99rem) {
  :root {
    --side: 11rem;
    --gap: 2.5rem;
  }
  .wrap { padding: 0 1.5rem; }
  .toc a { grid-template-columns: auto minmax(0, 1fr); }
  .toc-date { display: none; }
  .hint { display: none; }
}

/* Phones: one column, with a bar along the top showing where you are */

@media (max-width: 47.99rem) {
  body { font-size: 1.0625rem; }

  .wrap {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 1.25rem;
  }
  /* The logo and the view switch share the top row; the title goes below */
  .masthead {
    --logo-width: 6.5rem;
    padding: 1.75rem 1.25rem 1.5rem;
  }
  /* The progress bar right below has its own border */
  .masthead::after { display: none; }
  .brand {
    grid-area: 1 / 1;
    transform: none;
  }
  .views {
    grid-area: 1 / 1;
    align-self: center;
    margin: 0;
  }
  .masthead h1 {
    grid-area: 2 / 1;
    margin-top: 1.25rem;
  }
  h1 { font-size: 1.75rem; }

  #timeline {
    z-index: 1;
    max-height: none;
    margin: 0 -1.25rem;
    padding: 0.7rem 1.25rem 0.8rem;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  .side-label, .toc, .hint { display: none; }

  .progress {
    grid-template-areas: "now pct" "bar bar";
    row-gap: 0.55rem;
    margin: 0;
  }

  .now {
    grid-area: now;
    display: flex;
    gap: 0.75rem;
    min-width: 0;
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.3;
    white-space: nowrap;
  }
  #now-date {
    font: 400 0.75rem/1.3 var(--mono);
    color: var(--muted);
    align-self: center;
  }
  #now-name {
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink);
  }

  main { padding-top: 2.25rem; }
  .entry {
    margin-bottom: 2.25rem;
    padding-bottom: 2.25rem;
    scroll-margin-top: 5rem;
  }

  blockquote { padding-left: 1rem; }
  blockquote + .source { padding-left: calc(1rem + 1px); }

  .item { scroll-margin-top: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media print {
  #timeline, .foot { display: none; }
  .wrap { display: block; }
}
