@font-face {
  font-family: "Reenie Beanie";
  src: url("../fonts/reenie-beanie-latin-400.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #fffefb;
  --ink: #1d1a16;
  --pencil: #6d665c;
  --rule: #d8cfbf;
  --blood: #990000;
  --ochre: #b9701c;
  --hand: "Reenie Beanie", "Bradley Hand", "Segoe Print", cursive;
  --text: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --stroke: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.2C38 2.1 61 6.6 97 4.1s58-2.6 96 .4 66 1.9 105-1.3' fill='none' stroke='%231d1a16' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --stroke-ochre: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 8' preserveAspectRatio='none'%3E%3Cpath d='M2 5.2C38 2.1 61 6.6 97 4.1s58-2.6 96 .4 66 1.9 105-1.3' fill='none' stroke='%23b9701c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
}

@media (min-width: 72rem) {
  body {
    background-image: url("../images/site/left.jpg");
    background-repeat: no-repeat;
    background-position: 1.25rem 9rem;
    background-attachment: fixed;
    background-blend-mode: multiply;
  }
}

img { max-width: 100%; height: auto; }

a { color: var(--blood); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover, a:focus-visible { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blood); outline-offset: 3px; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 0.75rem; z-index: 10; }

.hand, h1, h2, .primary a, .byline, .trail, .pager, .door-title, .leaf-title, .work-title, .splash-tagline, .lightbox button {
  font-family: var(--hand);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* Masthead: the 2005 wordmark over a single uneven pen line. */
.masthead {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  background: var(--stroke) no-repeat bottom center / calc(100% - 2.5rem) 8px;
}
.wordmark img { display: block; width: 190px; mix-blend-mode: multiply; }
.is-home .masthead { justify-content: center; background-image: none; padding-bottom: 0; }
.is-home .wordmark { display: none; }

.primary ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.1rem 1.4rem; }
.primary a {
  display: inline-block;
  padding: 0.2rem 0 0.45rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.75rem;
  line-height: 1;
  background: var(--stroke-ochre) no-repeat bottom left / 0 7px;
  transition: background-size 0.25s ease-out;
}
.primary a:hover, .primary a:focus-visible, .primary a[aria-current] { background-size: 100% 7px; }
.primary a[aria-current] { color: var(--blood); }

main { max-width: 62rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }

h1 { font-size: clamp(2.9rem, 7vw, 4.4rem); line-height: 0.95; margin: 0; text-wrap: balance; }
h2 { font-size: 2.1rem; line-height: 1.05; margin: 2.6rem 0 0.6rem; }
h3 { font-size: 1.05rem; font-variant-caps: all-small-caps; letter-spacing: 0.08em; margin: 2rem 0 0.4rem; }

.trail { margin: 0 0 1.5rem; font-size: 1.5rem; line-height: 1; }
.trail a { color: var(--pencil); text-decoration: none; }
.trail a:hover { color: var(--blood); }

.byline { font-size: 1.6rem; line-height: 1.1; color: var(--ochre); margin: 0.6rem 0 0; }

.roundel { border-radius: 50%; width: 60px; height: 60px; flex: none; mix-blend-mode: multiply; }

.section-head, .essay-head { margin: 0 0 2.2rem; padding-bottom: 1rem; background: var(--stroke) no-repeat bottom left / min(100%, 22rem) 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
.section-head .byline { flex-basis: 100%; }

/* Prose */
.prose { max-width: 38rem; }
.prose p { margin: 0 0 1.15em; hanging-punctuation: first; }
.prose > p:first-child { font-size: 1.2rem; line-height: 1.55; }
.prose img { display: block; margin: 2rem 0; padding: 0.6rem; background: #fff; border: 1px solid var(--rule); box-shadow: 0 1px 0 var(--rule), 3px 4px 0 rgba(29, 26, 22, 0.06); }
.prose sup { font-size: 0.7em; line-height: 0; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5em; }
.essay-cover img { max-height: 26rem; padding: 0.6rem; background: #fff; border: 1px solid var(--rule); }
.essay-cover { margin: 0 0 2rem; }

.portrait { float: right; margin: 0 0 1.5rem 2rem; width: 168px; transform: rotate(1.4deg); }
.portrait img { display: block; padding: 0.5rem 0.5rem 1.6rem; background: #fff; border: 1px solid var(--rule); box-shadow: 3px 4px 0 rgba(29, 26, 22, 0.07); }

/* Chronology: years written in the margin of a single ruled line. */
.essay--chronology .prose { border-left: 1px solid var(--ink); padding-left: 1.6rem; margin-left: 0.4rem; }
.essay--chronology .prose h2 { position: relative; color: var(--blood); font-size: 2.4rem; margin-top: 2.2rem; }
.essay--chronology .prose h2::before { content: ""; position: absolute; left: -2.02rem; top: 0.55em; width: 0.8rem; height: 0.8rem; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--paper); }
.essay--chronology .prose > p:first-child { font-size: inherit; }

/* Section index: loose leaves. */
.leaves { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 2.2rem 2.5rem; clear: both; }
.leaf a { text-decoration: none; color: var(--ink); display: block; }
.leaf img { display: block; max-height: 13rem; width: auto; margin-bottom: 0.9rem; padding: 0.5rem; background: #fff; border: 1px solid var(--rule); box-shadow: 3px 4px 0 rgba(29, 26, 22, 0.07); transition: transform 0.2s ease-out; }
.leaf:nth-child(odd) img { transform: rotate(-0.8deg); }
.leaf:nth-child(even) img { transform: rotate(0.6deg); }
.leaf a:hover img { transform: rotate(0deg); }
.leaf-title { font-size: 2rem; line-height: 1; background: var(--stroke) no-repeat bottom left / 0 7px; padding-bottom: 0.4rem; transition: background-size 0.25s ease-out; }
.leaf a:hover .leaf-title, .leaf a:focus-visible .leaf-title { background-size: 100% 7px; color: var(--blood); }
.leaf-meta { margin: 0.35rem 0 0; color: var(--ochre); font-size: 0.9rem; font-variant-caps: all-small-caps; letter-spacing: 0.06em; }
.leaf-summary { margin: 0.3rem 0 0; color: var(--pencil); font-size: 0.95rem; line-height: 1.5; }

/* Works: each one mounted on its own sheet, none of them quite straight. */
.works { list-style: none; margin: 2.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: 2.6rem 2rem; align-items: end; }
.works--scans { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); align-items: start; }
.work a { display: block; padding: 0.55rem; background: #fff; border: 1px solid var(--rule); box-shadow: 3px 4px 0 rgba(29, 26, 22, 0.07); transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; }
.work img { display: block; margin: 0 auto; max-height: 15rem; width: auto; }
.works--scans .work img { max-height: 20rem; }
.work:nth-child(3n + 1) a { transform: rotate(-0.7deg); }
.work:nth-child(3n + 2) a { transform: rotate(0.5deg); }
.work:nth-child(5n) a { transform: rotate(-0.3deg); }
.work a:hover, .work a:focus-visible { transform: rotate(0deg) translateY(-2px); box-shadow: 4px 7px 0 rgba(29, 26, 22, 0.1); }
.work-caption, .feature figcaption { margin: 0.8rem 0 0; font-size: 0.82rem; line-height: 1.4; color: var(--pencil); }
.work-caption span, .feature figcaption span { display: block; }
.work-title { font-size: 1.55rem; line-height: 1; color: var(--ink); margin-bottom: 0.15rem; }
.work-year { color: var(--ochre); }

/* Home */
.splash { text-align: center; padding: 1rem 0 0; }
.splash-mark { width: min(100%, 550px); mix-blend-mode: multiply; }
.splash-tagline { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.05; color: var(--blood); margin: 0.2rem auto 0; max-width: 26rem; text-wrap: balance; }

.feature { margin: 3.5rem auto 0; width: fit-content; max-width: 100%; text-align: center; transform: rotate(-0.6deg); }
.feature img { display: block; padding: 0.8rem; background: #fff; border: 1px solid var(--rule); box-shadow: 5px 7px 0 rgba(29, 26, 22, 0.08); }
.feature figcaption { transform: rotate(0.6deg); }
.feature .work-title { font-size: 2.2rem; }

.voice { max-width: 34rem; margin: 4rem auto 0; padding: 0 0 0 1.5rem; border-left: 2px solid var(--ochre); font-size: 1.12rem; }
.voice p { margin: 0 0 1em; }
.voice p:last-child { font-style: normal; color: var(--pencil); font-size: 0.9rem; margin: 0; }

.pinned { list-style: none; margin: 4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 1.5rem 2rem; }
.pinned a { display: block; padding: 0.5rem; background: #fff; border: 1px solid var(--rule); box-shadow: 3px 4px 0 rgba(29, 26, 22, 0.07); transition: transform 0.2s ease-out; }
.pinned img { display: block; max-height: 11rem; width: auto; }
.pinned li:nth-child(1) a { transform: rotate(-2deg); }
.pinned li:nth-child(2) a { transform: rotate(1.2deg) translateY(0.6rem); }
.pinned li:nth-child(3) a { transform: rotate(-0.8deg); }
.pinned li:nth-child(4) a { transform: rotate(2.1deg) translateY(0.4rem); }
.pinned a:hover, .pinned a:focus-visible { transform: rotate(0deg); }

.doors { margin-top: 5rem; padding-top: 2.5rem; background: var(--stroke) no-repeat top center / 100% 8px; }
.doors ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 2rem 2.5rem; }
.doors a { display: flex; align-items: center; gap: 0.9rem; color: var(--ink); text-decoration: none; }
.door-title { font-size: 2.3rem; line-height: 1; }
.doors a:hover .door-title, .doors a:focus-visible .door-title { color: var(--blood); }
.doors p { margin: 0.4rem 0 0 calc(60px + 0.9rem); color: var(--pencil); font-size: 0.95rem; line-height: 1.5; }

/* Pager and footer */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; margin-top: 4rem; padding-top: 1.6rem; font-size: 1.6rem; line-height: 1.1; background: var(--stroke) no-repeat top left / 100% 8px; }
.pager a { color: var(--ink); text-decoration: none; }
.pager a:hover { color: var(--blood); }
.pager-next { margin-left: auto; text-align: right; }

.colophon { max-width: 62rem; margin: 0 auto; padding: 1.6rem 1.25rem 3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; background: var(--stroke) no-repeat top center / calc(100% - 2.5rem) 8px; }
.colophon .hand { font-size: 1.5rem; line-height: 1; margin: 0; }
.colophon .hand a { color: var(--ink); }
.colophon .saho img { display: block; height: 44px; width: auto; mix-blend-mode: multiply; }
.colophon .rights { flex-basis: 100%; margin: 0; font-size: 0.82rem; color: var(--pencil); }

/* Lightbox */
.lightbox { border: 0; padding: 1.5rem; max-width: min(96vw, 60rem); max-height: 96vh; background: var(--paper); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 8px 10px 0 rgba(29, 26, 22, 0.15); }
.lightbox::backdrop { background: rgba(29, 26, 22, 0.82); }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img { display: block; margin: 0 auto; max-height: 72vh; width: auto; }
.lightbox figcaption { margin-top: 0.9rem; font-size: 0.85rem; color: var(--pencil); }
.lightbox figcaption span { display: block; }
.lightbox button { border: 0; background: none; color: var(--ink); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0.3rem 0.2rem; }
.lightbox button:hover { color: var(--blood); }
.lightbox button[disabled] { visibility: hidden; }
.lightbox-close { display: block; margin: 0 0 0.6rem auto; }
.lightbox-nav { display: flex; justify-content: space-between; margin-top: 0.8rem; }

@media (max-width: 40rem) {
  .masthead { justify-content: center; }
  .primary ul { justify-content: center; gap: 0 1.1rem; }
  .primary a { font-size: 1.55rem; }
  .portrait { float: none; margin: 0 0 1.5rem; }
  .works { grid-template-columns: repeat(2, 1fr); gap: 1.8rem 1rem; }
  .doors p { margin-left: 0; }
}

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

@media print {
  .masthead nav, .pager, .lightbox, .doors { display: none; }
  body { background: #fff; }
}
