/* gmdw: one small stylesheet for every page. */

:root {
  color-scheme: light dark;
  --muted: #666;
  --rule: #d4d4d4;
}
@media (prefers-color-scheme: dark) {
  :root { --muted: #9a9a9a; --rule: #3a3a3a; }
}

body {
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  max-width: 64ch;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1 { font-size: 2.25rem; line-height: 1.1; margin: 2rem 0 .75rem; }
/* Every page's content starts at the same height, whatever comes first */
main > :first-child { margin-top: 0; }

/* Eras */
h2 {
  font-size: 1.2rem;
  margin: 3.5rem 0 0;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
}

/* Roles */
h3 { font-size: 1.15rem; margin: 2.25rem 0 0; }

/* Role · dates · place, right under each company */
h3 + p { margin-top: .1rem; color: var(--muted); font-size: .95rem; }
h3 + p strong { color: CanvasText; font-weight: 600; }

ul { padding-left: 1.2em; }
li { margin: .3em 0; }
li::marker { color: var(--muted); }

/* Header on every page: the gmdw wordmark, then Work, Lab and Play, evenly spaced.
   The current page is marked with color and an underline, never weight, so
   nothing beside it shifts. */
.site { display: flex; gap: 1.25rem; align-items: baseline; margin-bottom: 2.5rem; }
.site nav { display: contents; }
.site a { color: var(--muted); text-decoration: none; text-underline-offset: .35em; }
.site a:hover { color: CanvasText; text-decoration: underline; }
.site > a:first-child { color: CanvasText; font-weight: 600; }
.site a[aria-current] { color: CanvasText; text-decoration: underline; text-decoration-thickness: 2px; }

/* Epigraphs, like the quote at the top of Play */
blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); }
blockquote p { margin: .25rem 0; }
blockquote p:last-child { color: var(--muted); font-size: .95rem; }

hr { border: 0; border-top: 1px solid var(--rule); margin: 3.5rem 0 1rem; }
hr ~ p { color: var(--muted); font-size: .9rem; }

/* Contents menu (pages built from Markdown).
   Small screens: a compact list after the intro. Wide screens: fixed on the left. */
html { scroll-behavior: smooth; }
/* Reserve the scrollbar's space on every page, so long pages (Work) and short
   ones (the homepage) center on the same width and line up exactly. */
html { scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
h2, h3 { scroll-margin-top: 1.5rem; }

.toc { font-size: .9rem; line-height: 1.4; margin-top: 2rem; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0; }
.toc a { color: inherit; text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.toc .era { display: block; font-weight: 600; margin-top: .9rem; }
.toc > ul > li:first-child > .era { margin-top: 0; }
.toc li li { display: inline; color: var(--muted); }
.toc li li:not(:last-child)::after { content: " · "; }
.toc span { display: none; }

@media (min-width: 960px) {
  /* One layout for every page, so nothing moves between pages: a 38rem text
     column + 3rem gap + a 13rem right column (the contents menu, Work only),
     centered together. The header and the text start at the same left edge,
     --edge, on every page, menu or not. */
  :root { --edge: max(1.25rem, calc(50% - 27rem)); }
  body { max-width: 38rem; margin: 0 0 0 var(--edge); padding: 6.5rem 0 4rem; }
  /* Header: pinned across the top, outside the scroll, with a background so
     text scrolls under it rather than through it. */
  .site {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1;
    padding: 2rem 0 1rem var(--edge);
    margin: 0;
    background: Canvas;
  }
  .has-toc .toc {
    position: fixed;
    top: 6.5rem;
    left: calc(var(--edge) + 41rem); /* text column + gap */
    width: 13.75rem;
    max-height: calc(100vh - 8.5rem);
    overflow-y: auto;
    margin: 0;
  }
  h2, h3 { scroll-margin-top: 6rem; } /* clear the pinned header */
  .has-toc .toc .era { margin-top: 1.25rem; }
  .has-toc .toc > ul > li:first-child > .era { margin-top: 0; }
  .has-toc .toc li li { display: block; margin: .3rem 0 0 .75rem; color: inherit; }
  .has-toc .toc li li::after { content: none; }
  /* Current era: a bar beside the whole group (toc.js sets aria-current) */
  .has-toc .toc > ul > li { position: relative; padding-left: .75rem; }
  .has-toc .toc > ul > li:has(> .era[aria-current])::before {
    content: ""; position: absolute; left: 0; top: .15rem; bottom: .15rem;
    width: 2px; border-radius: 1px; background: CanvasText;
  }
  .has-toc .toc span { display: inline; color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
}
