/* Crow's Prose — classic literary typography */

/* Variable font: one upright file covers the 400-600 weight range. */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-regular.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Single-glyph subset: the scene-break diamond lives outside the latin range. */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-diamond.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+25C6;
}

:root {
  color-scheme: light dark;
  --paper: #faf7f0;
  --ink: #22201c;
  --ink-muted: #7a746a;
  --accent: #7d2e2e;
  --rule: #d9d2c4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --ink: #d8d3c8;
    --ink-muted: #8c867a;
    --accent: #c98b8b;
    --rule: #5a564f;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "EB Garamond", Charter, "Iowan Old Style", Georgia, serif;
  font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.375rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  hanging-punctuation: first;
}

main {
  max-width: 65ch;
  margin-inline: auto;
  padding-inline: 1.25rem;
  padding-block: clamp(2.5rem, 8vh, 6rem) 6rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

h1 {
  font-weight: 600;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  line-height: 1.15;
  text-wrap: balance;
}

/* ---- Index ---- */

.masthead {
  text-align: center;
  margin-block-end: 3.5rem;
}

.masthead h1 {
  letter-spacing: 0.02em;
}

.masthead h1::after {
  content: "";
  display: block;
  width: 4rem;
  border-block-end: 1px solid var(--rule);
  margin: 1.25rem auto 0;
}

.essay-list {
  list-style: none;
}

.essay-list li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  justify-content: space-between;
  padding-block: 0.65rem;
}

.essay-list li + li {
  border-block-start: 1px solid var(--rule);
}

.essay-list a {
  font-size: 1.15em;
  color: var(--ink);
  text-decoration: none;
}

.essay-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.essay-list time {
  color: var(--ink-muted);
  font-size: 0.85em;
  font-variant-numeric: oldstyle-nums;
  white-space: nowrap;
}

/* ---- Essay page ---- */

.crumb {
  margin-block-end: 3rem;
  font-size: 0.85em;
}

.crumb a {
  color: var(--ink-muted);
  text-decoration: none;
}

.crumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.essay-header {
  text-align: center;
  margin-block-end: 3.5rem;
}

.essay-header time {
  display: block;
  margin-block-start: 1rem;
  color: var(--ink-muted);
  font-size: 0.8em;
  font-style: italic;
  font-variant-numeric: oldstyle-nums;
  letter-spacing: 0.04em;
}

/* Book-style paragraphs: indent runs of paragraphs, no gap between them.
   Anything between paragraphs (an hr, a heading) resets the indent chain,
   which is exactly right after a scene break. */
article p {
  margin-block-start: 1em;
}

article p + p {
  margin-block-start: 0;
  text-indent: 1.5em;
}

/* Scene breaks: `---` in the source, three small diamonds sitting on a
   hairline rule that runs unbroken behind them. */
article hr {
  border: 0;
  /* A gradient, not a border: the rule has to fade out at both ends. */
  height: 1px;
  width: 50%;
  margin-inline: auto;
  background: linear-gradient(
    to right,
    transparent,
    var(--rule) 25%,
    var(--rule) 75%,
    transparent
  );
  overflow: visible;
  margin-block: 2.75em;
  position: relative;
}

article hr::after {
  content: "◆    ◆    ◆"; /* ◆◆◆ */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -61.5%);
  color: var(--rule);
  font-size: 0.66em;
  line-height: 1;
  letter-spacing: 0.9em;
  /* letter-spacing trails the last glyph; balance it so the glyphs center */
  padding-inline-start: 0.9em;
}

article blockquote {
  margin-block: 1.5em;
  padding-inline-start: 1.5em;
  border-inline-start: 2px solid var(--rule);
  font-style: italic;
}

article strong {
  font-weight: 600;
}

@media (max-width: 34rem) {
  .essay-list li {
    flex-direction: column;
    gap: 0.1rem;
  }
}
