/* The reading shell, shared by every long-read page (the Prospectus, the essays). Builds on /styles.css.
   A club-red band at the top (top bar, title or banner) fades into the reading page.
   Reading themes, set on <html data-theme> by /reading.js: "ink" (default, dark maroon), "paper" (warm parchment),
   "red" (the site's red). Everything on these pages, graphics included, draws from these variables. */
:root {
  color-scheme: dark;
  --paper: #231212;
  --ink: #f2ddcd;
  --muted: rgba(242, 221, 205, .7);
  --rule: rgba(242, 221, 205, .3);
  --annotation: #e6cf84;   /* the one accent: gold */
  --band: #873b3b;         /* the club's red title block */
  --mark-bg: rgba(220, 197, 126, .88); /* highlighter: the site's gold behind dark text */
  --mark-fg: #231212;
}
:root[data-theme="paper"] {
  color-scheme: light;
  --paper: #f3e4c7;
  --ink: #2b1b10;
  --muted: rgba(43, 27, 16, .7);
  --rule: rgba(43, 27, 16, .28);
  --annotation: #8e3a2a;   /* brick oxblood: gold does not read on parchment */
  --mark-bg: rgba(214, 178, 72, .55); /* a deeper gold on parchment */
  --mark-fg: #2b1b10;
}
:root[data-theme="red"] {
  --paper: #873b3b;
  --muted: #e1c3b6;
  --rule: #b77d73;
  --annotation: #dcc57e;
  --mark-fg: #3a1514;
}

/* The red title block keeps the club's colours in every theme, then fades into the page. */
.band {
  --ink: #f2ddcd;
  --muted: rgba(242, 221, 205, .74);
  --rule: rgba(242, 221, 205, .3);
  --annotation: #e6cf84;
  --paper: var(--band);
  background: var(--band) url('/paper-grain.svg') repeat;
  color: var(--ink);
  padding-bottom: 8px; /* keeps the fade's negative margin from collapsing through the band */
}
.band::after {
  content: ''; display: block; height: 180px; margin-bottom: -180px; position: relative; pointer-events: none;
  background:
    url('/paper-grain.svg') repeat,
    linear-gradient(to bottom,
      var(--band) 0%,
      color-mix(in srgb, var(--band) 72%, transparent) 25%,
      color-mix(in srgb, var(--band) 38%, transparent) 55%,
      color-mix(in srgb, var(--band) 12%, transparent) 80%,
      transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 100%);
}
:root[data-theme="red"] .band { background: transparent; }
:root[data-theme="red"] .band::after { display: none; }
.band .site-shell { min-height: 0; }
.band .running-head { margin-bottom: 0; border-bottom: 1px solid var(--rule); padding-bottom: 14px; align-items: center; }
/* Three slots: home on the left, the page name centred on the page, the theme selector on the right.
   Equal outer columns keep the centre on the page's own centre line, under the centred title or banner. */
.band .running-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; }
.band .running-head .home-mark { justify-self: start; }
.band .running-head .page-label { justify-self: center; }
.band .running-head .page-label a { text-decoration: none; }
.band .running-head .page-label a:hover { text-decoration: underline; }
.band .running-head .theme-switch { justify-self: end; }
/* Theme selector: a small track of page-colour swatches; the thumb slides to the chosen one. */
.theme-switch { --w: 24px; --i: 0; position: relative; display: inline-flex; padding: 2px; border: 1px solid var(--rule); }
.theme-switch button { position: relative; z-index: 1; display: grid; place-items: center; width: var(--w); height: 20px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; }
.theme-switch .swatch { width: 12px; height: 12px; border: 1px solid rgba(242, 221, 205, .7); }
.theme-switch .swatch-ink { background: #231212; }
.theme-switch .swatch-paper { background: #f3e4c7; }
.theme-switch .swatch-red { background: #873b3b; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: var(--w); height: 20px; border: 1px solid var(--ink); transform: translateX(calc(var(--i) * var(--w))); transition: transform .18s ease; }
.theme-switch button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .theme-thumb { transition: none; } }
.title-block { text-align: center; padding: 64px 0 60px; }
.title-block h1 { font: 300 clamp(40px, 8vw, 76px)/1.04 var(--mono); letter-spacing: -.045em; margin: 0; }
.title-block .dek { font: italic 400 clamp(18px, 2.4vw, 22px)/1.45 var(--serif); color: var(--muted); max-width: 520px; margin: 20px auto 0; letter-spacing: 0; }
.title-block .post-date { font: 13px/1.6 var(--mono); color: var(--muted); margin: 22px 0 0; letter-spacing: .02em; }
.band + .site-shell { position: relative; padding-top: 110px; }
.reading { max-width: 700px; margin: 0 auto; padding: 0 0 50px; }
.reading .loading { text-align: center; color: var(--muted); }

/* Text */
.reading h2 { text-align: left; font: 400 22px/1.35 var(--mono); letter-spacing: -.02em; text-decoration: none; margin: 46px 0 16px; }
.reading h3 { font: 400 16px/1.4 var(--mono); margin: 28px 0 10px; }
.reading p, .reading li { font: 17px/1.72 var(--serif); letter-spacing: 0; hyphens: manual; }
.reading p { margin: 0 0 16px; }
.reading ul, .reading ol { margin: 0 0 18px; padding-left: 1.4em; }
.reading li { margin: 0 0 8px; }
.reading strong { font-weight: 600; }
.reading code { font: 15px var(--mono); background: color-mix(in srgb, var(--ink) 9%, transparent); padding: 1px 5px; letter-spacing: 0; }
.reading hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0 0; }
.reading blockquote { margin: 0 0 26px; padding: 12px 18px; border-left: 2px solid var(--annotation); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.reading blockquote p { margin: 0; font-size: 16px; }
.reading a { text-decoration-color: var(--rule); }
.table-wrap { overflow-x: auto; margin: 4px 0 20px; }
.reading table { border-collapse: collapse; font: 15px/1.4 var(--mono); letter-spacing: 0; min-width: 60%; }
.reading th, .reading td { text-align: left; padding: 7px 14px 7px 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.reading th { font-weight: 400; color: var(--muted); }


/* Highlighter marks: ==like this== in the Markdown source. */
.reading mark {
  background: var(--mark-bg);
  color: var(--mark-fg);
  padding: .04em .22em;
  border-radius: 1px;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
}

@media (max-width: 600px) {
  .reading p, .reading li { font-size: 16px; }
  .reading h2 { font-size: 19px; margin-top: 38px; }
  .reading table { font-size: 13px; }
  .band + .site-shell { padding-top: 96px; }
}
