/*
 * The Rastral posts' own look: one reading column on Rastral's paper colour, opened by
 * five ruled lines. Figures may run wider than the text, so that a scan of a score can be read.
 *
 * Plain CSS on purpose: GitHub Pages' Sass compiler would trip over max(), min() and clamp().
 */

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/eb-garamond.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("fonts/eb-garamond-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-italic-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-sans-3.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-sans-3-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #F7F2E6;
  --ink: #24211B;
  --ink-soft: #6A6355;
  --rule: #24211B;
  --accent: #285AA6;
  --quiet-ground: #EDE6D5;
  /* The same in both themes: a transparent image is black ink, and needs paper behind it. */
  --figure-paper: #FFFFFF;
  /* The image overlay is dark in both themes, so the paper of the image stands out. */
  --overlay: rgba(18, 17, 15, 0.97);
  --overlay-ink: #E9E3D4;
  /* Dark with a light rim, so the close button shows over the dark backdrop and over white paper alike. */
  --overlay-control: rgba(18, 17, 15, 0.78);
  --overlay-control-hover: rgba(18, 17, 15, 0.95);
  --overlay-control-rim: rgba(233, 227, 212, 0.45);
  --display: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --utility: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-width: 36rem;
  --wide-width: 60rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1B18;
    --ink: #E9E3D4;
    --ink-soft: #A69F8F;
    --rule: #E9E3D4;
    --accent: #8DB4F0;
    --quiet-ground: #2B2925;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.1875rem;
  line-height: 1.62;
  padding-block: clamp(40px, 8vw, 88px) clamp(32px, 6vw, 64px);
  padding-inline: clamp(16px, 5vw, 32px);
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The text column sits in the middle; only a wide figure uses the outer columns. */
.page,
.post {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--text-width)) minmax(0, 1fr);
}
.page { row-gap: 2.5rem; }
.page > *,
.post > * { grid-column: 2; min-width: 0; }
.page > .post { grid-column: 1 / -1; }

.post { row-gap: 1.15rem; }
.post > * { margin: 0; }

.masthead { display: grid; gap: 0.9rem; }

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  font-family: var(--utility);
  font-size: 0.875rem;
  color: var(--ink-soft);
}
.eyebrow a { color: inherit; }

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.25rem, 11vw, 5rem);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

/* One stroke of the pen: five lines, four equal spaces. */
.staff {
  height: 33px;
  background-image: repeating-linear-gradient(
    to bottom,
    var(--rule) 0,
    var(--rule) 1px,
    transparent 1px,
    transparent 8px
  );
}

.lede { margin: 0.35rem 0 0; color: var(--ink-soft); }

.post h2,
.post h3 {
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.15;
  text-wrap: balance;
  margin-top: 1.25rem;
}
.post h2 { font-size: 2rem; }
.post h3 { font-size: 1.5rem; }

.post ul,
.post ol { padding-left: 1.4rem; }
.post li + li { margin-top: 0.35rem; }

.post blockquote {
  padding-left: 1.1rem;
  border-left: 1px solid var(--ink-soft);
  color: var(--ink-soft);
}

.post hr { width: 100%; border: 0; border-top: 1px solid var(--ink-soft); }

.post code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--quiet-ground);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}
.post pre {
  overflow-x: auto;
  background: var(--quiet-ground);
  padding: 0.85rem 1rem;
  border-radius: 4px;
  line-height: 1.45;
}
.post pre code { background: none; padding: 0; }

.post img { display: block; max-width: 100%; height: auto; background: var(--figure-paper); }
.post figure { display: grid; gap: 0.5rem; }
.post figure.wide {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, var(--wide-width));
  margin-block: 0.75rem;
}
.post figcaption {
  font-family: var(--utility);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.post figcaption .full-size { white-space: nowrap; margin-left: 0.4em; }
.post figure > a { cursor: zoom-in; }

/* Two versions of one figure and a switch between them (_includes/rastral-compare.html). Without script, both show,
   one under the other, and the switch stays hidden. */
.compare-switch { display: none; }
.js .compare-switch { display: flex; justify-self: start; }
.compare-switch button {
  font-family: var(--utility);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--ink-soft);
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}
.compare-switch button + button { border-left: none; }
.compare-switch button:first-child { border-radius: 999px 0 0 999px; }
.compare-switch button:last-child { border-radius: 0 999px 999px 0; }
.compare-switch button[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.compare-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.compare figcaption .compare-view + .compare-view { margin-top: 0.35rem; }
.js .compare:not([data-shown="b"]) .compare-view[data-view="b"],
.js .compare[data-shown="b"] .compare-view[data-view="a"] { display: none; }

/* The image overlay. */
html.zoom-open { overflow: hidden; }

.zoom {
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: auto;
  overscroll-behavior: contain;
}
/* Older Safari doesn't pass the page's tokens to ::backdrop, hence the fallback. */
.zoom::backdrop { background: var(--overlay, rgba(18, 17, 15, 0.97)); }

.zoom-stage {
  box-sizing: border-box;
  min-width: 100%;
  min-height: 100%;
  width: max-content;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3.75rem clamp(12px, 3vw, 32px) 1.25rem;
}
.zoom-stage img {
  display: block;
  max-width: calc(100vw - 2 * clamp(12px, 3vw, 32px));
  max-height: calc(100dvh - 7.5rem);
  width: auto;
  height: auto;
  background: var(--figure-paper);
}
.zoom.full .zoom-stage img { max-width: none; max-height: none; }

.zoom-caption {
  margin: 0;
  max-width: min(46rem, calc(100vw - 2rem));
  font-family: var(--utility);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--overlay-ink);
  text-align: center;
}
.zoom.full .zoom-caption { position: sticky; left: 1rem; }

.zoom-status { display: none; margin: 0; font-family: var(--utility); color: var(--overlay-ink); }
.zoom.loading .zoom-status { display: block; }
.zoom.loading .zoom-stage img { display: none; }

.zoom-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: var(--overlay-control);
  box-shadow: 0 0 0 1px var(--overlay-control-rim);
  color: var(--overlay-ink);
  font: 400 1.75rem/1 var(--utility);
  cursor: pointer;
}
.zoom-close:hover { background: var(--overlay-control-hover); }
.zoom-close:focus-visible { outline: 2px solid var(--overlay-ink); outline-offset: 2px; }

.feed-address { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.post .feed-address code {
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  overflow-wrap: anywhere;
  user-select: all;
}

.quiet-button {
  font: 600 0.9375rem/1 var(--utility);
  color: var(--accent);
  background: var(--quiet-ground);
  border: 0;
  border-radius: 4px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
.quiet-button:hover { text-decoration: underline; text-underline-offset: 0.15em; }
.quiet-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.post-list h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.25rem;
  line-height: 1.1;
  margin: 0 0 0.3rem;
  text-wrap: balance;
}
.post-list h2 a { color: inherit; text-decoration: none; }
.post-list h2 a:hover { text-decoration: underline; }
.post-list p { margin: 0; }
.post-list time { font-family: var(--utility); font-size: 0.875rem; color: var(--ink-soft); }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-family: var(--utility);
  font-size: 0.875rem;
}
.foot a { color: var(--ink-soft); }
