:root {
  --ground:      #f9f5e9;
  --ground-sunk: #f2ecdc;
  --ink:         #1a1512;
  --mid:         #7b6251;
  --rule:        #ddd4c0;
  --rule-faint:  #e8e0cf;
  --accent:      #3f7a6a;  /* verdigris — trial 2026-08-20 */

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --sans:  "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Helvetica, sans-serif;

  --measure: 36rem;
  /* Reading typography, set 2026-08-20.
     Leading 1.7 = a word processor's "1.5 lines".
     Gap 48px = 1.5 lines at this size. */
  --prose-size: 1.1875rem;  /* 19px */
  --prose-leading: 1.7;
  --prose-gap: 1.5rem;      /* 24px · 0.75 line */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.75rem;
  --s4: 3rem;
  --s5: 5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #17120e;
    --ground-sunk: #1e1813;
    --ink:         #ede4d3;
    --mid:         #a08974;
    --rule:        #35291f;
    --rule-faint:  #262019;
    --accent:      #5fa896;  /* verdigris, lifted for the dark ground */
  }
}

:root[data-theme="dark"] {
  --ground:      #17120e;
  --ground-sunk: #1e1813;
  --ink:         #ede4d3;
  --mid:         #a08974;
  --rule:        #35291f;
  --rule-faint:  #262019;
  --accent:      #5fa896;  /* verdigris, lifted for the dark ground */
}

* { box-sizing: border-box; }

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

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  margin: 0;
  padding: 0 var(--s3) var(--s5);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding-top: var(--s5);
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: 1fr 8.25rem;
  gap: var(--s3);
  align-items: start;
  padding-bottom: var(--s3);
  border-bottom: 2px solid var(--accent);
}

.masthead-text {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
}

.name {
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.name a { text-decoration: none; }

.standfirst {
  max-width: var(--measure);
  color: var(--mid);
  margin: 0;
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-top: var(--s1);
}

.portrait {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
}
.portrait-frame {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--rule);
  background: var(--ground-sunk);
  overflow: hidden;
}
.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  display: block;
  filter: saturate(0.82) contrast(1.03);
}
.portrait-caption {
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--mid);
}

.signature { margin-top: 0.25rem; }
.signature img { max-height: 2.5rem; width: auto; display: block; }

/* ---------- section label ---------- */

.label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mid);
  margin: 0 0 var(--s3);
  display: flex;
  align-items: baseline;
  gap: var(--s2);
}
.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--accent);
}
.count {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* ---------- catalogue ---------- */

.catalogue { display: flex; flex-direction: column; }

.entry {
  display: grid;
  grid-template-columns: 6.5rem 7rem 1fr;
  gap: 0 var(--s3);
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule-faint);
  align-items: start;
}

/* Thumbnail. Framed like a plate, matching the portrait and the essay header. */
.entry-thumb {
  display: block;
  width: 7rem;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule);
  background: var(--ground-sunk);
  overflow: hidden;
  text-decoration: none;
}
.entry-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.entry:first-child { border-top: 1px solid var(--rule); }

.stamp {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mid);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin: 0;
  color: var(--accent);
  padding-top: 0.15rem;
}

.entry-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.entry-title {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 0;
  font-weight: 400;
  text-wrap: balance;
}
.entry-title a { text-decoration-color: transparent; }
.entry-title a:hover { text-decoration-color: var(--accent); }
.entry-sub {
  margin: 0;
  color: var(--mid);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* ---------- essay page ---------- */

.backlink {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
}

.essay-header { display: flex; flex-direction: column; gap: var(--s2); }

.essay-title {
  font-size: clamp(1.6rem, 4.4vw, 2.15rem);
  line-height: 1.15;
  font-weight: 400;
  margin: 0;
  max-width: var(--measure);
  text-wrap: balance;
}
.essay-sub {
  font-size: 1.125rem;
  color: var(--mid);
  margin: 0;
  max-width: var(--measure);
  font-style: italic;
}
.byline {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
  margin: var(--s1) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s2);
}

.essay-image {
  margin: var(--s3) 0 0;
  border: 1px solid var(--rule);
  background: var(--ground-sunk);
}
.essay-image img,
.essay-image picture { width: 100%; height: auto; display: block; }

.prose {
  max-width: var(--measure);
  margin-top: var(--s4);
  font-size: var(--prose-size);
  line-height: var(--prose-leading);
}
/* One uniform gap between every block. Flex gap rather than margins, so no
   later element rule can override it (a `.prose p { margin: 0 }` did exactly
   that and silently killed every spacing change). */
.prose {
  display: flex;
  flex-direction: column;
  gap: var(--prose-gap);
}
.prose > * { margin: 0; }
/* Section headings. Uppercase sans, scaled up so they read as structure.
   Letterspacing eases off as the size grows, which is how uppercase should
   be set — small caps need the air, large caps don't. */
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--sans);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.3;
  text-wrap: balance;
  color: var(--accent);
  margin-top: var(--s3);   /* stacks on top of the flex gap */
}

.prose h1 { font-size: 1.25rem;   letter-spacing: 0.06em; }  /* 20px */
.prose h2 { font-size: 1.125rem;  letter-spacing: 0.07em; }  /* 18px */
.prose h3 { font-size: 1rem;      letter-spacing: 0.09em; }  /* 16px */
.prose h4 { font-size: 0.875rem;  letter-spacing: 0.11em; }  /* 14px */

/* First heading shouldn't push away from the opening paragraph */
.prose > :first-child { margin-top: 0; }
.prose blockquote {
  margin: 0;
  padding-left: var(--s2);
  border-left: 2px solid var(--accent);
  color: var(--mid);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s3) 0;
}
.prose img { max-width: 100%; height: auto; }

/* A figure inside the essay body — a quoted screenshot, a plate, a photo.
   Framed like the header image and the catalogue thumbnails. */
.prose-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.prose-figure img,
.prose-figure picture {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
}
.prose-figure figcaption {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mid);
  line-height: 1.5;
}
.prose a { word-break: break-word; }

.essay-foot {
  max-width: var(--measure);
  margin-top: var(--s5);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mid);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
}

/* ---------- colophon ---------- */

.colophon {
  border-top: 1px solid var(--rule);
  padding-top: var(--s3);
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--mid);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  margin: 0;
}

/* ---------- responsive ---------- */

@media (max-width: 40rem) {
  .masthead { grid-template-columns: 1fr; gap: var(--s3); }
  .portrait { max-width: 7rem; }
}

@media (max-width: 48rem) {
  :root { --prose-size: 1.0625rem; } /* 17px, matching Substack's mobile step */
}

@media (max-width: 40rem) {
  .entry { grid-template-columns: 5.5rem 1fr; gap: 0 var(--s2); }
  .entry-thumb { grid-row: 1 / span 2; width: 5.5rem; }
  .stamp { grid-column: 2; }
  .entry-body { grid-column: 2; }
}

@media (max-width: 26rem) {
  .entry { grid-template-columns: 1fr; gap: 0.5rem; }
  .entry-thumb { grid-row: auto; width: 100%; max-width: 12rem; }
  .stamp { grid-column: 1; order: -1; }
  .entry-body { grid-column: 1; }
}

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