:root {
  color-scheme: dark;
  --bg: #100f0f;
  --surface: #171616;
  --text: #cecdc3;
  --muted: #878580;
  --faint: #575653;
  --line: #282726;
  --link: #d8d7ce;
  --focus: #f2f0e5;
  --max-width: 674px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fffcf0;
  --surface: #f2f0e5;
  --text: #343331;
  --muted: #6f6e69;
  --faint: #9f9d96;
  --line: #dedad1;
  --link: #1c1b1a;
  --focus: #100f0f;
}

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

html {
  min-height: 100%;
  background: var(--bg);
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--link);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

.site-shell {
  width: min(calc(100% - 48px), var(--max-width));
  margin-inline: auto;
  padding: 44px 0 120px;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 76px;
  color: var(--muted);
}

.home-page .site-shell {
  width: min(calc(100% - 64px), 1040px);
}

.home-page .site-header {
  align-items: center;
  margin-bottom: 76px;
}

.home-handle {
  margin: 0 auto 0 0;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(52px, 8vw, 76px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.045em;
}

.home-handle a {
  color: var(--text);
  text-decoration: none;
}

.home-hero {
  margin-bottom: 96px;
}

.home-section-label {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 18px;
}

.home-rule {
  height: 1px;
  margin: 0 0 42px;
  border: 0;
  background: var(--line);
}

.home-bio {
  max-width: 1000px;
  font-family: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

.home-bio p {
  margin-bottom: 48px;
  font-size: clamp(24px, 2.65vw, 34px);
  line-height: 1.52;
  letter-spacing: -0.012em;
}

.home-bio p:last-child {
  margin-bottom: 0;
}

.home-page main > section:not(.home-hero),
.home-page .site-footer {
  max-width: var(--max-width);
}

.site-name {
  margin-right: auto;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
}

.article-breadcrumb {
  color: var(--muted);
}

.article-breadcrumb .site-name {
  margin-right: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  text-decoration: none;
}

.theme-toggle {
  display: grid;
  width: 54px;
  height: 30px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  place-items: center;
}

.theme-icon {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: inset -7px -4px 0 var(--bg);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

:root[data-theme="light"] .theme-icon {
  box-shadow: inset 0 0 0 6px var(--bg);
  transform: scale(0.92);
}

h1,
h2,
h3,
p,
ul,
ol,
blockquote {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.02em;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(31px, 5vw, 40px);
  line-height: 1.2;
}

h2 {
  margin: 52px 0 14px;
  font-size: 26px;
  line-height: 1.3;
}

h3 {
  margin: 38px 0 12px;
  font-size: 21px;
  line-height: 1.35;
}

p,
li,
blockquote {
  font-size: 18px;
  line-height: 1.55;
}

p {
  margin-bottom: 24px;
}

ul,
ol {
  margin: 0 0 24px;
  padding-left: 26px;
}

li + li {
  margin-top: 7px;
}

blockquote {
  margin: 32px 0;
  padding-left: 26px;
  border-left: 1px solid var(--text);
  color: var(--text);
}

blockquote p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--link);
  font-weight: 600;
}

.intro {
  margin-bottom: 60px;
}

.intro h1 {
  max-width: 630px;
  margin-bottom: 18px;
}

.intro p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.section-label {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 17px;
}

.section-label a {
  text-decoration: none;
}

.latest-card {
  display: block;
  margin-bottom: 58px;
  color: inherit;
  text-decoration: none;
}

.latest-card h2 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.25;
}

.meta,
.byline {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 18px;
}

.latest-card .meta {
  margin-bottom: 12px;
}

.latest-card .summary {
  margin: 0;
  color: var(--muted);
}

.latest-card:hover .read-more {
  color: var(--text);
}

.rule {
  height: 1px;
  margin: 0 0 58px;
  border: 0;
  background: var(--line);
}

.writing-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.writing-list a {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 24px;
  color: var(--text);
}

.writing-list time,
.writing-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.projects-rule {
  margin-top: 58px;
}

.project-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  color: var(--text);
  text-decoration: none;
}

.project-list a:hover .project-domain {
  color: var(--text);
}

.project-domain {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.article-intro {
  font-size: 19px;
}

.article-nav,
.article-end {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
}

.article-nav p,
.article-end p {
  margin: 0;
  font-size: 16px;
}

.page-copy p:last-child {
  margin-bottom: 0;
}

.site-footer {
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
}

.site-footer p {
  margin: 0;
  font-size: 16px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.social-links a {
  display: grid;
  width: 38px;
  height: 38px;
  color: var(--text);
  text-decoration: none;
  place-items: center;
}

.social-links a:hover {
  color: var(--link);
}

.social-links svg {
  width: 30px;
  height: 30px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.social-links .social-fill {
  fill: currentColor;
  stroke: none;
}

.social-links .social-dot {
  fill: currentColor;
  stroke: none;
}

.footer-nav {
  margin-top: 22px !important;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

@media (max-width: 620px) {
  body {
    font-size: 17px;
  }

  .site-shell {
    width: min(calc(100% - 36px), var(--max-width));
    padding-top: 28px;
  }

  .site-header {
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 56px;
  }

  .home-page .site-shell {
    width: min(calc(100% - 36px), 1040px);
  }

  .home-page .site-header {
    flex-wrap: nowrap;
    margin-bottom: 56px;
  }

  .home-handle {
    flex-basis: auto;
    font-size: clamp(44px, 14vw, 58px);
  }

  .home-hero {
    margin-bottom: 72px;
  }

  .home-section-label {
    margin-bottom: 18px;
    font-size: 16px;
  }

  .home-rule {
    margin-bottom: 30px;
  }

  .home-bio p {
    margin-bottom: 34px;
    font-size: 22px;
    line-height: 1.5;
  }

  .site-name,
  .article-breadcrumb {
    flex-basis: calc(100% - 70px);
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 22px;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .writing-list a {
    grid-template-columns: 94px 1fr;
    gap: 14px;
  }

  .project-list a {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .project-domain {
    font-size: 15px;
  }

  .social-links {
    gap: 18px;
  }

  p,
  li,
  blockquote,
  .meta,
  .byline {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media print {
  :root,
  :root[data-theme="light"] {
    color-scheme: light;
    --bg: #ffffff;
    --text: #111111;
    --muted: #444444;
    --line: #cccccc;
    --link: #000000;
  }

  .site-shell {
    width: 100%;
    padding: 0;
  }

  .site-header,
  .theme-toggle,
  .skip-link,
  .article-nav,
  .article-end {
    display: none;
  }
}
