@font-face {
  font-family: "Apple Garamond";
  src: url("/fonts/AppleGaramond.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Apple Garamond";
  src: url("/fonts/AppleGaramond-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: rgba(0, 0, 0, 0.72);
  --line: rgba(0, 0, 0, 0.18);
  --accent: #000000;
  --accent-contrast: #ffffff;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    "SF Pro Text",
    "Segoe UI",
    Helvetica,
    Arial,
    sans-serif;
  overflow: hidden;
}

a {
  color: inherit;
}

.site-shell {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 0 0 56px;
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(220px, 350px) minmax(0, 820px);
  gap: 20px;
  justify-content: center;
}

.site-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 220px;
  max-width: 350px;
  max-height: 300px;
  overflow-y: auto;
  padding: 32px 24px 0 16px;
}

.site-kicker {
  margin: 0;
  font-family: "Apple Garamond", serif;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  font-weight: 300;
  line-height: 1.15;
  text-align: center;
}

.site-links {
  margin-top: 12px;
  display: flex;
  justify-content: space-around;
  font-family: "Apple Garamond", serif;
  font-size: 1.125rem;
}

.site-links a,
.inline-link,
.project-item h2 a {
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 22, 19, 0.35);
}

.site-nav {
  margin-top: 40px;
  display: grid;
  gap: 2px;
}

.site-nav a {
  display: block;
  width: 100%;
  padding: 4px 8px;
  font-family: "Apple Garamond", serif;
  font-size: 1.95rem;
  text-align: right;
  text-decoration: none;
}

.site-nav a.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.site-main {
  min-width: 0;
  height: 100vh;
  padding: 28px 0 24px;
  max-width: 760px;
  overflow-y: auto;
  scrollbar-width: none;
}

.site-main::-webkit-scrollbar,
.site-sidebar::-webkit-scrollbar {
  display: none;
}

.page-header h1 {
  margin: 0;
  font-family: "Apple Garamond", serif;
  font-size: clamp(3rem, 5.6vw, 4.2rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "Apple Garamond", serif;
  font-size: 1.15rem;
}

.copy-flow,
.project-list,
.article-index,
.article-page {
  margin-top: 30px;
}

.copy-flow p,
.project-item p {
  margin: 0 0 18px;
  max-width: 74ch;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: -0.02em;
  color: #1f2937;
}

.project-list {
  display: grid;
  gap: 24px;
}

.article-index {
  display: grid;
  gap: 24px;
}

.article-card {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.article-card:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.article-card h2 {
  margin: 0 0 10px;
  font-family: "Apple Garamond", serif;
  font-size: clamp(1.8rem, 3vw, 2.25rem);
  font-weight: 300;
  line-height: 1.05;
}

.article-body p,
.article-body li,
.article-footer p,
.article-figure figcaption {
  font-size: 16px;
  line-height: 1.68;
  letter-spacing: -0.02em;
  color: #1f2937;
}

.article-back {
  margin: 0 0 20px;
  font-family: "Apple Garamond", serif;
  font-size: 1.15rem;
}

.article-back a {
  text-decoration: none;
  border-bottom: 1px solid rgba(24, 22, 19, 0.35);
}

.article-header h1 {
  margin: 0;
  font-family: "Apple Garamond", serif;
  font-size: clamp(2.5rem, 4.6vw, 3.8rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
}

.article-body {
  margin-top: 26px;
  max-width: 74ch;
}

.article-body p {
  margin: 0 0 18px;
}

.article-body h2 {
  margin: 28px 0 12px;
  font-family: "Apple Garamond", serif;
  font-size: 1.9rem;
  font-weight: 300;
  line-height: 1.08;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  margin: 0 0 22px;
  padding-left: 22px;
}

.article-body li {
  margin-bottom: 10px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 24px;
  font-size: 15px;
}

.article-body th,
.article-body td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.article-body th {
  font-weight: 600;
  color: var(--text);
}

.article-figure {
  margin: 24px 0 0;
  max-width: 740px;
}

.article-figure img {
  width: 100%;
  height: auto;
}

.article-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
}

.article-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  max-width: 74ch;
}

.equation-block {
  display: grid;
  gap: 14px;
}

.equation-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: "Apple Garamond", serif;
  font-size: 1.2rem;
}

.equation-fraction {
  display: inline-grid;
  justify-items: center;
  line-height: 1.2;
}

.equation-top,
.equation-bottom {
  display: block;
  padding: 0 8px;
  white-space: nowrap;
}

.equation-top {
  border-bottom: 1px solid var(--text);
  padding-bottom: 4px;
}

.equation-bottom {
  padding-top: 4px;
}

.equation-note {
  margin: 0;
}

.project-item {
  padding-top: 0;
  border-top: 0;
}

.project-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.project-item h2 {
  margin: 0 0 10px;
  font-family: "Apple Garamond", serif;
  font-size: clamp(1.9rem, 3.5vw, 2.35rem);
  font-weight: 300;
  line-height: 1;
}

.project-meta,
.project-note {
  color: var(--muted);
}

.project-meta {
  font-size: 1rem;
  font-family:
    "SF Pro Text",
    "Segoe UI",
    Helvetica,
    Arial,
    sans-serif;
}

.project-note {
  font-size: 0.96rem;
}

@media (max-width: 900px) {
  html,
  body {
    height: auto;
  }

  body {
    overflow: visible;
  }

  .site-shell {
    width: min(100%, calc(100% - 32px));
    height: auto;
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 18px;
  }

  .site-sidebar {
    position: static;
    max-width: none;
    max-height: none;
    padding: 12px 4px 0;
    overflow: visible;
  }

  .site-nav {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
  }

  .site-nav a {
    text-align: center;
  }

  .site-main {
    height: auto;
    overflow: visible;
    padding-top: 8px;
  }

  .page-header h1 {
    line-height: 1;
  }
}
