/* Long-form article layout (Iowan Old Style, built into Macs and iPhones, with Crimson Pro as the free fallback; contents on the left, margin notes on the right). Pages:
   writing/<slug>/index.html, with js/pages/article.js placing the notes. */
@font-face { font-family: "Crimson Pro"; src: url("/fonts/crimson-pro-latin-wght-normal.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Crimson Pro"; src: url("/fonts/crimson-pro-latin-wght-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Apfel Grotezk"; src: url("/fonts/apfel-grotezk-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Apfel Grotezk"; src: url("/fonts/apfel-grotezk-mittel.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #1b1b1d; --soft: #5f6066; --faint: #9a9ba1; --rule: #e6e6e9;
  --serif: "Iowan Old Style", "Crimson Pro", Georgia, serif;
  --sans: "Apfel Grotezk", -apple-system, "Helvetica Neue", sans-serif;
  --body: 640px; --toc: 220px; --notes: 260px; --gap: 56px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: #fff; color: var(--ink); font-family: var(--serif); font-size: 20px; line-height: 1.62;
  font-optical-sizing: auto; text-rendering: optimizeLegibility; }
a { color: inherit; text-decoration: underline; text-decoration-color: #b9b9bf; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 10px; background: #fff; font-family: var(--sans); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* the site header, matching style.css */
.site-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px;
  max-width: 760px; margin: 0 auto; padding: 24px; font: 400 16px/24px var(--sans); color: #171717; -webkit-font-smoothing: antialiased; }
.site-header p { margin: 0; }
.editorial__crumb a { color: #171717; text-decoration: none; }
.editorial__crumb .here { font-weight: 600; }
.topnav { display: flex; gap: 8px; align-items: baseline; }
.topnav a { color: #0864c7; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: currentColor; }
.topnav span { color: #767676; }

.head { text-align: center; padding: 64px 24px 0; max-width: 1000px; margin: 0 auto; }
.title { font-size: clamp(38px, 4.8vw, 66px); line-height: 1.08; font-weight: 700; letter-spacing: -.01em; margin: 0 auto 26px; text-wrap: balance; }
.dek { font-style: italic; font-size: clamp(19px, 2vw, 24px); color: #4a4b50; margin: 0 0 22px; }
.byline { font-family: var(--sans); font-size: 17px; color: var(--soft); margin: 0; }
.byline .sep { margin: 0 6px; color: var(--faint); }

.page { display: grid; grid-template-columns: var(--toc) var(--body) var(--notes); gap: var(--gap); justify-content: center;
  margin: 72px auto 120px; padding: 0 24px; }
.toc { position: sticky; top: 92px; align-self: start; display: flex; flex-direction: column; gap: 12px; font-family: var(--sans); font-size: 15.5px; }
.toc a { color: var(--soft); text-decoration: none; line-height: 1.35; position: relative; }
.toc a.on { color: var(--ink); }
.toc a.on::before { content: ""; position: absolute; left: -14px; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.body { grid-column: 2; min-width: 0; position: relative; }
.body section { scroll-margin-top: 90px; }
.body h2 { font-size: 30px; line-height: 1.25; font-weight: 700; margin: 64px 0 18px; }
.body section:first-child > :first-child { margin-top: 0; }
.body p, .body ul, .body ol { margin: 0 0 24px; }
.body li + li { margin-top: 8px; }
.body blockquote { margin: 0 0 24px; padding-left: 18px; border-left: 2px solid var(--rule); color: #333; }
.body hr { margin: 40px 0; border: 0; border-top: 1px solid var(--rule); }
.body .cited { font-size: 17px; line-height: 1.55; }

/* margin notes: in the right column on wide screens (placed by article.js), inline below on narrow ones */
.ref { font-size: .62em; line-height: 0; vertical-align: super; margin-left: 1px; font-feature-settings: "lnum"; }
.sn { float: right; clear: right; width: var(--notes); margin-right: calc(-1 * (var(--notes) + var(--gap))); margin-top: -.1em;
  font-size: 15.5px; line-height: 1.5; color: #333; }
.sn b { font-weight: 400; font-size: .75em; vertical-align: super; margin-right: 3px; }
.body.notes-js .sn { position: absolute; float: none; margin: 0; left: calc(100% + var(--gap)); width: var(--notes); }

@media (max-width: 1240px) {
  :root { --toc: 0px; --gap: 40px; }
  .toc { display: none; }
  .page { grid-template-columns: var(--body) var(--notes); }
  .body { grid-column: 1; }
}
@media (max-width: 1000px) {
  .page { grid-template-columns: minmax(0, var(--body)); }
  .sn { float: none; display: block; width: auto; margin: 10px 0 18px; padding-left: 14px; border-left: 2px solid var(--rule); }
}
@media (max-width: 640px) {
  body { font-size: 18px; }
  .head { padding-top: 40px; }
  .page { padding: 0 16px; margin-top: 48px; }
}
@media print {
  .site-header, .toc, .skip-link { display: none; }
  .page { display: block; margin: 0; }
  .sn { float: none; display: block; width: auto; margin: 6px 0 12px; font-size: 12px; }
}

/* on load: the header is simply there; the title fades up, then the subtitle and byline, then the text */
@keyframes article-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.head .title, .head .dek, .head .byline, .page { animation: article-rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.head .title { animation-delay: .08s; }
.head .dek { animation-delay: .32s; }
.head .byline { animation-delay: .44s; }
.page { animation-delay: .62s; animation-duration: 1.1s; }
@media (prefers-reduced-motion: reduce) { .head .title, .head .dek, .head .byline, .page { animation: none; } }

/* hover a section heading to reveal its # link (added by article.js) */
.body h2 { position: relative; }
.body h2 .hash { position: absolute; left: -.9em; color: var(--faint); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity .15s; }
.body h2:hover .hash, .body h2 .hash:focus { opacity: 1; }
@media (hover: none) { .body h2 .hash { display: none; } }
