:root {
  --paper: #faf7f2;
  --ink: #1a1815;
  --muted: #5f584c;
  --faint: #877e70;
  --hairline: rgba(26, 24, 21, 0.16);
  --accent: #9a3324;
  --code-bg: #f1ebe1;
  --measure: 42rem;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.375rem;
}

a {
  color: inherit;
}

::selection {
  background: #ecdccd;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -100vw;
  top: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.875rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.875rem;
  border-radius: 4px;
}

.skip-link:focus-visible {
  left: 0.75rem;
}

/* ---------- Underline transitions ---------- */

.u-link {
  text-decoration: underline;
  text-decoration-color: rgba(26, 24, 21, 0.25);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.u-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--hairline);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.5rem;
}

.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1875rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease;
}

.wordmark:hover {
  color: var(--accent);
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  text-decoration-color: var(--accent);
}

/* ---------- Homepage intro ---------- */

.intro {
  padding-block: clamp(3rem, 9vw, 5.25rem) clamp(2.5rem, 7vw, 4rem);
}

.intro-role {
  margin: 0 0 1.125rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw + 0.75rem, 2.875rem);
  line-height: 1.15;
  letter-spacing: -0.012em;
  max-width: 22ch;
  transition: opacity 0.2s ease;
}

.intro h1.is-swapping {
  opacity: 0;
}

.tagline-block {
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
}

.tagline-picker {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-block: 1em;
}

.tick {
  appearance: none;
  background: none;
  border: none;
  margin: 0;
  cursor: pointer;
  line-height: 0;
}

.tick::after {
  content: "";
  display: block;
  width: 0.2rem;
  height: 20px;
  border-radius: 999px;
  background: var(--ink);
  opacity: 0.1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tick:hover::after,
.tick:focus-visible::after {
  opacity: 0.2;
}

.tick[aria-pressed="true"]::after {
  opacity: 0.3;
}

.tick:focus-visible {
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .tick::after {
    transition: none;
  }
}

/* ---------- Post list ---------- */

.section-label {
  margin: 0 0 0.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--hairline);
}

.post-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.375rem 2.25rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.post-date {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  font-variant-caps: all-small-caps;
  font-size: 0.9375rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.post-year {
  color: var(--faint);
}

.post-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.22;
  letter-spacing: -0.008em;
  transition: color 180ms ease;
}

.post-excerpt {
  margin: 0.45rem 0 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 52ch;
}

.post-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--faint);
  transition: color 180ms ease;
}

.post-more .arrow {
  transition: transform 180ms ease;
}

.post-link {
  text-decoration: none;
  color: inherit;
}

.post-link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-row:hover .post-title,
.post-link:focus-visible .post-title {
  color: var(--accent);
}

.post-row:hover .post-more,
.post-link:focus-visible .post-more {
  color: var(--accent);
}

.post-row:hover .arrow,
.post-link:focus-visible .arrow {
  transform: translateX(3px);
}

.home-main > .wrap:last-child {
  padding-bottom: clamp(3.5rem, 9vw, 6rem);
}

/* ---------- Page header (article / about) ---------- */

.page-head {
  padding-block: clamp(3rem, 8vw, 5rem) clamp(1.75rem, 5vw, 2.75rem);
}

.kicker {
  display: block;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;  color: var(--accent);
}

.page-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.125rem, 5.5vw + 0.5rem, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 24ch;
  text-wrap: balance;
}

.meta-line {
  margin-top: 1.375rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.meta-line .sep {
  margin-inline: 0.55em;
  color: var(--faint);
}

/* ---------- Long-form prose ---------- */

.prose {
  padding-bottom: clamp(2.5rem, 7vw, 4rem);
}

.prose p {
  margin: 0 0 1.35em;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.72;
}

.prose > p:first-of-type {
  font-size: 1.28rem;
  line-height: 1.66;
}

.prose h2 {
  margin: 2.75em 0 0.9em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.prose h3 {
  margin: 2.25em 0 0.7em;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.prose h4 {
  margin: 2em 0 0.6em;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose ul,
.prose ol {
  margin: 0 0 1.5em;
  padding-left: 1.4em;
}

.prose li {
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.72;
  margin-bottom: 0.4em;
}

.prose li > ul,
.prose li > ol {
  margin: 0.4em 0 0.6em;
  padding-left: 1.4em;
}

.prose li > ul li::marker {
  color: var(--faint);
}

.prose strong {
  font-weight: 600;
}

.prose hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--hairline);
}

.prose li::marker {
  color: var(--accent);
}

.pullquote {
  margin: 2.75rem 0;
  padding: 2.25rem 0.5rem;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  text-align: center;
}

.pullquote p {
  margin: 0 auto;
  max-width: 30ch;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw + 0.75rem, 1.875rem);
  line-height: 1.35;
  letter-spacing: -0.008em;
  text-wrap: balance;
}

blockquote {
  margin: 1.75em 0;
  padding: 0.25em 0 0.25em 1.25em;
  border-left: 2px solid var(--hairline);
}

blockquote p {
  font-style: italic;
  color: var(--muted);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.15em 0.4em;
  background: var(--code-bg);
  border-radius: 4px;
}

/* ---------- Figures: book plates ---------- */

.prose figure {
  margin: 2.5rem 0;
}

.prose figure img,
.prose figure video,
.media-frame img,
.media-frame video {
  display: block;
  width: 100%;
  height: auto;
  background: #fffdf9;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.375rem;
}

.prose figcaption {
  margin-top: 0.8rem;
  font-size: 0.8125rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.1em;
  text-align: center;
  color: var(--faint);
}

.media-frame {
  margin: 2.5rem 0;
}

.embed {
  position: relative;
  aspect-ratio: 16 / 9;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: #fffdf9;
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---------- Superscripts & footnotes ---------- */

sup {
  font-size: 0.66em;
  line-height: 0;
  vertical-align: super;
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
}

.footnotes p {
  margin: 0 0 0.55em;
  font-family: var(--sans);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--muted);
}

.footnotes a {
  overflow-wrap: anywhere;
}

/* ---------- Tables ---------- */

.table-scroll {
  margin: 1.75em 0;
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.prose th {
  font-family: var(--sans);
  font-variant-caps: all-small-caps;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  color: var(--muted);
}

.prose th,
.prose td {
  padding: 0.6em 0.9em;
  border-bottom: 1px solid var(--hairline);
}

/* ---------- Quote cards (tweets etc.) ---------- */

.quote-card {
  margin: 2.25rem 0;
  padding: 1.5rem 1.625rem;
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #fffdf9;
}

.quote-card p {
  margin: 0 0 0.9em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
}

.quote-card p:last-of-type {
  margin-bottom: 0;
}

.quote-card footer {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--muted);
}

pre {
  margin: 1.75em 0;
  padding: 1.25rem 1.5rem;
  background: var(--code-bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
  line-height: 1.75;
}

.back-link {
  display: inline-block;
  margin-bottom: clamp(3rem, 8vw, 5rem);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.back-link:hover {
  color: var(--accent);
}

.back-link .arrow {
  display: inline-block;
  transition: transform 180ms ease;
}

.back-link:hover .arrow {
  transform: translateX(-3px);
}

/* ---------- About page ---------- */

.about-lede {
  margin: 0 0 1.5em !important;
  font-size: 1.375rem !important;
  line-height: 1.55 !important;
}

.elsewhere {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--hairline);
}

.elsewhere h2 {
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
}

.elsewhere ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.elsewhere li {
  font-size: 1rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2.25rem;
}

.copyright {
  margin: 0;
  font-size: 0.875rem;
  color: var(--faint);
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-nav a {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- Responsive: date column beside content ---------- */

@media (min-width: 40em) {
  .post-row {
    grid-template-columns: 6.75rem 1fr;
    align-content: start;
  }

  .post-date {
    padding-top: 0.3rem;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.post-row.archived {
  display: none;
}

.archived-note {
  display: inline-block;
  margin-bottom: 1.25rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
