:root {
  --paper: #f2ebd9;
  --print: #faf6ea;
  --ink: #1d3b2c;
  --ink-2: #47604f;
  --hair: rgba(29, 59, 44, .28);
  --faint: rgba(29, 59, 44, .12);
  --red: #b23a26;
  --display: "Cormorant Garamond", "EB Garamond", Garamond, Georgia, serif;
  --text: "EB Garamond", Garamond, Georgia, serif;
  --edge: clamp(10px, 1.6vw, 18px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: clamp(16px, 11px + .42vw, 25px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.2rem/1.62 var(--text);
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Paper: fine grain plus long, faint fibres. Sits above everything so the
   photograph and drawing look printed on the same sheet. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: .5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .40 0 0 0 0 .33 0 0 0 0 .20 1.3 0 0 0 -.5'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .09' numOctaves='3' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .36 0 0 0 0 .22 0.55 0 0 0 -.27'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
}
/* Soft darkening toward the edges of the sheet */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 59; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(120, 98, 52, .10) 100%);
}

.frame {
  position: fixed; inset: var(--edge); z-index: 50; pointer-events: none;
  border: 1px solid var(--ink);
  /* Paper outside the frame, so nothing shows in the margin as the page scrolls */
  box-shadow: 0 0 0 calc(var(--edge) + 4px) var(--paper);
}
/* …and text dissolves into the paper before it reaches the top and bottom rules */
.frame::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, var(--paper) 7px, rgba(242, 235, 217, 0) 2.8rem),
    linear-gradient(to top, var(--paper) 7px, rgba(242, 235, 217, 0) 2.8rem);
}
.frame::after {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid var(--hair);
}

::selection { background: var(--ink); color: var(--paper); }
a { color: inherit; text-decoration-color: var(--hair); text-underline-offset: .18em; text-decoration-thickness: 1px; transition: text-decoration-color .3s; }
a:hover { text-decoration-color: var(--ink); }
a:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- Type ---------- */
.overline {
  margin: 0;
  font: 500 .74em/1.4 var(--text);
  letter-spacing: .24em;
  text-transform: uppercase;
  font-variant-numeric: lining-nums;
  color: var(--ink-2);
}
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; text-wrap: balance; }
h2 {
  font-size: clamp(2.3rem, 5.2vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -.01em;
  margin: .35em 0 .9em;
  padding-bottom: .5em;
  position: relative;
}
h2 em { font-weight: 400; }
h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: var(--ink);
  transform: scaleX(0); transform-origin: left;
  transition: transform 1.4s cubic-bezier(.2, .7, .1, 1) .25s;
}
h2.in::after { transform: scaleX(1); }

p { margin: 0 0 1.05em; text-wrap: pretty; hanging-punctuation: first; }
.dropcap::first-letter {
  float: left;
  font: 500 4.55em/.74 var(--display);
  padding: .09em .09em 0 0;
  margin-left: -.03em;
  color: var(--ink);
}

.fn {
  font-size: .62em; vertical-align: super; line-height: 0;
  font-variant-numeric: lining-nums;
  text-decoration: none; padding: 0 .12em 0 .16em; color: var(--ink-2);
}
.fn:hover { color: var(--ink); }

.col { width: min(100% - 2 * clamp(28px, 7vw, 80px), 39rem); margin-inline: auto; }
.sec { padding: clamp(5.5rem, 15vh, 10rem) 0 clamp(4rem, 10vh, 7rem); }
.sec--tight { padding-bottom: 2rem; }
.sec--after { padding-top: clamp(3rem, 8vh, 5rem); }

/* ---------- Reveal ---------- */
[data-reveal] {
  opacity: 0; transform: translateY(16px);
  transition: opacity 1.1s ease, transform 1.2s cubic-bezier(.2, .7, .1, 1);
}
[data-reveal].in { opacity: 1; transform: none; }

/* ---------- Title page ---------- */
.hero {
  min-height: 100svh;
  display: grid; place-content: center; justify-items: center;
  text-align: center;
  padding: 5rem clamp(28px, 7vw, 80px) 6rem;
  position: relative;
}
.hero h1 { margin: 0 0 clamp(1.8rem, 5vh, 3rem); }
.hero h1 span {
  display: block;
  font-size: clamp(2.7rem, 9.2vw, 7.4rem);
  line-height: .98;
  letter-spacing: -.015em;
}
.hero h1 em {
  display: block; margin-top: .75em;
  font-size: clamp(1.3rem, 3vw, 2.25rem);
  font-weight: 400; line-height: 1.2;
}
.byline { margin-top: 1.6rem; }

.rule { display: flex; align-items: center; justify-content: center; gap: 12px; }
.rule span { width: clamp(40px, 9vw, 96px); height: 1px; background: var(--ink); }
.rule i { width: 6px; height: 6px; border: 1px solid var(--ink); transform: rotate(45deg); }

.hero > *, .hero h1 > * { opacity: 0; transform: translateY(14px); animation: rise 1.3s cubic-bezier(.2, .7, .1, 1) forwards; }
.hero h1 { opacity: 1; transform: none; animation: none; }
.hero__a { animation-delay: .2s !important; }
.hero__b { animation-delay: .38s !important; }
.hero__c { animation-delay: .7s !important; }
.hero__d { animation-delay: 1s !important; }
.hero__e { animation-delay: 1.15s !important; }
.hero__g { animation-delay: 1.7s !important; }
@keyframes rise { to { opacity: 1; transform: none; } }

.scrollcue {
  position: absolute; left: 50%; bottom: calc(var(--edge) + 2.6rem);
  width: 21px; height: 56px; margin-left: -10px;
  display: block; overflow: hidden;
}
.scrollcue span {
  position: absolute; left: 10px; top: 0; width: 1px; height: 100%;
  background: var(--ink);
  animation: cue 2.6s cubic-bezier(.6, 0, .3, 1) infinite;
}
@keyframes cue {
  0% { transform: translateY(-100%); }
  55% { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* ---------- Working drawing ---------- */
.stage { height: 500vh; position: relative; }
.stage__sticky {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden;
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
}
.stage__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--faint) 1px, transparent 1px),
    linear-gradient(rgba(29, 59, 44, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 59, 44, .05) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  background-position: center;
  -webkit-mask-image: radial-gradient(ellipse 62% 62% at 58% 50%, #000 20%, transparent 78%);
          mask-image: radial-gradient(ellipse 62% 62% at 58% 50%, #000 20%, transparent 78%);
  opacity: .8;
}
.stage__inner {
  position: absolute; inset: calc(var(--edge) + 14px);
  display: grid; grid-template-columns: minmax(15rem, 30%) 1fr;
  align-items: center; gap: 2vw;
  padding-left: clamp(1rem, 4vw, 4.5rem);
}
.stage__captions { position: relative; height: 22rem; }
.cap {
  position: absolute; inset: 0; margin: 0;
  display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(12px);
  transition: opacity .55s ease, transform .7s cubic-bezier(.2, .7, .1, 1);
  pointer-events: none;
}
.cap.on { opacity: 1; transform: none; transition-delay: .12s; }
.cap h3 { font-size: clamp(1.9rem, 3.1vw, 2.8rem); line-height: 1.06; font-style: italic; font-weight: 400; margin: .4em 0 .5em; }
.cap p { margin: 0; }
.cap p:not(.overline):not(.cap__note) { max-width: 22rem; }
.cap__note {
  margin-top: 1.1em !important; padding-top: .8em;
  border-top: 1px solid var(--hair);
  font-size: .82em; font-style: italic; color: var(--ink-2);
  font-variant-numeric: lining-nums;
  max-width: 22rem;
}

.bp { width: 100%; height: 100%; min-height: 0; display: block; overflow: visible; }
.bp .ln   { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bp .thin { fill: none; stroke: var(--ink); stroke-width: .7; opacity: .62; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bp .dash { stroke-dasharray: 5 4; }
.bp .fill { fill: var(--paper); stroke: none; }
.bp text  { font-family: var(--text); fill: var(--ink); font-variant-numeric: lining-nums; paint-order: stroke; stroke: var(--paper); stroke-linejoin: round; }
.bp .num  { font-family: var(--display); font-style: italic; }
/* The font's glyphs are built from overlapping shapes, so a bare stroke shows seams inside the letters.
   Stroke first, then cover the inside with paper: only the outer contour is left. */
.bp .lidtxt { font-family: var(--display); font-weight: 700; fill: var(--paper); stroke: var(--ink); stroke-linejoin: round; paint-order: stroke; letter-spacing: .01em; }


.stage__rail {
  position: absolute; right: calc(var(--edge) + 20px); top: 50%; transform: translateY(-50%);
  list-style: none; margin: 0; padding: 0; display: grid; gap: 10px;
}
.stage__rail li { width: 14px; height: 1px; background: var(--ink); opacity: .3; transform-origin: right; transition: transform .5s, opacity .5s; }
.stage__rail li.on { opacity: 1; transform: scaleX(1.9); }

/* ---------- Photograph, tucked into the page ---------- */
.photo {
  width: min(100% - 2 * clamp(28px, 7vw, 80px), 50rem);
  margin: clamp(.5rem, 2vh, 1.5rem) auto clamp(3rem, 7vh, 4.5rem);
}
.photo__print {
  position: relative;
  padding: clamp(7px, 1.1vw, 12px);
  background: var(--print);
  box-shadow: 0 0 0 1px rgba(60, 50, 25, .10), 0 1px 2px rgba(50, 40, 20, .16), 0 8px 22px -14px rgba(50, 40, 20, .35);
  transform: rotate(-1.1deg);
}
.photo img {
  display: block; width: 100%; height: auto;
  filter: grayscale(1) sepia(.22) contrast(1.04) brightness(1.03);
}
.corner {
  position: absolute; width: clamp(2rem, 6vw, 3.4rem); aspect-ratio: 1;
  filter: drop-shadow(1px 1px 1.2px rgba(40, 32, 14, .42));
}
.corner::before {
  content: ""; position: absolute; inset: 0;
  background: var(--paper);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.corner.tl { top: -2px; left: -2px; }
.corner.tr { top: -2px; right: -2px; transform: scaleX(-1); }
.corner.bl { bottom: -2px; left: -2px; transform: scaleY(-1); }
.corner.br { bottom: -2px; right: -2px; transform: scale(-1); }
.photo figcaption {
  margin-top: 1.3rem; text-align: center;
  font-style: italic; font-size: .9em; color: var(--ink-2);
}

/* ---------- Ledger ---------- */
.ledger { margin: .4rem 0 2.8rem; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.ledger p { display: flex; align-items: baseline; gap: .6em; margin: 0; padding: .78em 0; }
.ledger p + p { border-top: 1px solid var(--faint); }
.ledger i { flex: 1; min-width: 1.5em; border-bottom: 1px dotted var(--ink-2); transform: translateY(-.28em); opacity: .7; }
.ledger__head { justify-content: space-between; font-size: .74em; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); padding: .9em 0 !important; }
.ledger__head + p { border-top-color: var(--hair) !important; }
.ledger__total { font-weight: 500; }
.ledger__total span:last-child { font: 500 1.75em/1 var(--display); }

/* ---------- End matter ---------- */
.end { padding: clamp(2rem, 6vh, 4rem) 0 calc(var(--edge) + clamp(3.5rem, 9vh, 6rem)); }
.end .rule { margin: 0 0 2rem; }
.end__sign { text-align: center; font: italic 400 clamp(1.6rem, 3vw, 2.1rem)/1.2 var(--display); margin-bottom: .5rem; }
.end__contact { text-align: center; font-size: .92em; color: var(--ink-2); margin-bottom: clamp(3.5rem, 9vh, 6rem); }
.end__contact a { text-decoration: none; }
.end__contact a:hover { text-decoration: underline; }
.notes {
  margin: 0; padding: 1.4rem 0 0 1.3em;
  border-top: 1px solid var(--hair);
  font-size: .84em; line-height: 1.5; color: var(--ink-2);
  font-variant-numeric: lining-nums;
}
.notes li { padding-left: .3em; margin-bottom: .45em; scroll-margin-top: 30vh; }
.notes li:target { color: var(--ink); }
.notes .back { text-decoration: none; padding-left: .2em; }
.fn { scroll-margin-top: 35vh; }
.credit { margin-top: 1.6rem; font-size: .78em; line-height: 1.5; font-style: italic; color: var(--ink-2); }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .stage__inner {
    grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto;
    padding: 1.2rem clamp(.8rem, 4vw, 2rem) .6rem; gap: .5rem;
  }
  .bp { grid-row: 1; }
  .stage__captions { grid-row: 2; height: 13.5rem; }
  .cap { justify-content: flex-start; }
  .cap h3 { font-size: 1.7rem; margin: .25em 0 .35em; }
  .cap p:not(.overline) { font-size: .95em; line-height: 1.45; max-width: none !important; }
  .cap__note { margin-top: .6em !important; padding-top: .5em; }
  .stage__grid { -webkit-mask-image: radial-gradient(ellipse 80% 45% at 50% 36%, #000 20%, transparent 80%); mask-image: radial-gradient(ellipse 80% 45% at 50% 36%, #000 20%, transparent 80%); }
  .stage__rail { display: none; }
}
@media (max-width: 600px) {
  .ledger__total { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal], .hero > *, .hero h1 > * { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  h2::after { transform: scaleX(1); transition: none; }
  .scrollcue span { animation: none; }
}

@media print {
  body::before, body::after, .frame, .scrollcue, .stage { display: none; }
  [data-reveal] { opacity: 1; transform: none; }
}
