@font-face {
  font-family: "Geist";
  src: url("./assets/fonts/Geist-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("./assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --paper: #f6f5f1;
  --ink: #0e0e0d;
  --muted: #6b6a65;
  --faint: #8c8b85;
  --line: rgba(14, 14, 13, 0.12);
  --line-strong: rgba(14, 14, 13, 0.85);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --shell: 68rem;
  --gutter: clamp(1.5rem, 7vw, 6rem);
  --space-section: clamp(3.5rem, 8vw, 6.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f0f0e;
    --ink: #eeede8;
    --muted: #97968f;
    --faint: #76756f;
    --line: rgba(238, 237, 232, 0.12);
    --line-strong: rgba(238, 237, 232, 0.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
  -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-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }

:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.shell {
  width: min(calc(100% - (2 * var(--gutter))), var(--shell));
  margin-inline: auto;
}

/* Small mono labels — the only "loud" type on the page is quiet. */
.site-nav a,
.eyebrow,
.label,
.meta,
.text-link,
.index-row .num,
.index-row .go,
.site-footer {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.72rem;
  transform: translateY(-200%);
}

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

/* Header */
.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}

.site-header-inner {
  display: flex;
  min-height: 4.5rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.site-name {
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.site-nav a {
  color: var(--muted);
  transition: color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] { color: var(--ink); }

/* Links */
.text-link {
  display: inline-flex;
  width: fit-content;
  gap: 0.6rem;
  align-items: center;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line-strong);
}

.text-link span { transition: transform 200ms ease; }
.text-link:hover span,
.text-link:focus-visible span { transform: translateX(0.2rem); }

/* Hero */
.hero {
  padding: clamp(6rem, 16vw, 12rem) 0 var(--space-section);
}

.hero h1 {
  max-width: 17ch;
  margin-top: 2rem;
  font-size: clamp(2.6rem, 6.4vw, 5.25rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.hero h1 .muted { color: var(--faint); }

.hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 6vw, 6rem);
  align-items: end;
  margin-top: clamp(3.5rem, 8vw, 6rem);
}

.hero-foot p {
  max-width: 30rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  justify-content: flex-end;
}

/* Sections */
.section { padding-bottom: var(--space-section); }

.section > .shell {
  padding-top: var(--space-section);
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr);
  gap: 2rem clamp(2rem, 6vw, 6rem);
}

.section-head .label { padding-top: 0.55rem; color: var(--muted); }

.lead {
  max-width: 22ch;
  font-size: clamp(1.85rem, 3.6vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-wrap: balance;
}

.prose {
  display: grid;
  gap: 1.1rem;
  max-width: 34rem;
  margin-top: clamp(2rem, 4vw, 3rem);
}

.prose .meta { margin-top: 0.75rem; color: var(--muted); }

.prose p:not(.meta) {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
  text-wrap: pretty;
}

/* Numbered rows */
.index {
  margin: clamp(3.5rem, 7vw, 5.5rem) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}

.index-row {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr);
  gap: 0.5rem clamp(2rem, 6vw, 6rem);
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}

.index-row .num { padding-top: 0.3rem; color: var(--muted); }

.index-row .meta { margin-top: 0.6rem; color: var(--muted); }

.index-row h3 {
  font-size: clamp(1.15rem, 1.6vw, 1.35rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.index-row p:not(.meta) {
  max-width: 34rem;
  margin-top: 0.5rem;
  color: var(--muted);
  line-height: 1.65;
}

.section-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.section-foot .meta { color: var(--muted); }

.status {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

.status::before {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
  content: "";
  opacity: 0.6;
}

/* Writing index */
.page-hero {
  padding: clamp(6rem, 14vw, 10rem) 0 clamp(4rem, 8vw, 6rem);
}

.page-hero h1 {
  max-width: 16ch;
  margin-top: 2rem;
  font-size: clamp(2.6rem, 6vw, 4.75rem);
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.page-hero > .shell > p:not(.eyebrow) {
  max-width: 34rem;
  margin-top: 2rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
}

.index-row.is-empty h3 { color: var(--muted); }

/* Contact form */
.contact-form {
  display: grid;
  gap: 2rem;
  max-width: 34rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.field { display: grid; gap: 0.5rem; }

.field label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.4rem 0 0.7rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.5;
  transition: border-color 160ms ease;
}

.field textarea { min-height: 7.5rem; resize: vertical; }

.field input:focus,
.field textarea:focus {
  border-bottom-color: var(--line-strong);
  outline: none;
}

.field-trap {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.form-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

button.text-link {
  padding: 0 0 0.35rem;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: none;
  color: var(--ink);
  cursor: pointer;
}

button.text-link:disabled { opacity: 0.5; cursor: progress; }

.form-status { color: var(--muted); }
.form-status[data-state="error"] { color: var(--ink); }
.form-status > span { display: none; }
.form-status > span:target { display: inline; }

.index-row h3 a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 240ms ease;
}

.index-row h3 a:hover,
.index-row h3 a:focus-visible { background-size: 100% 1px; }

/* Article */
.article-hero {
  padding: clamp(6rem, 14vw, 10rem) 0 clamp(3rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}

.article-kicker,
.article-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.draft-badge { padding: 0.2rem 0.45rem; border: 1px solid var(--line-strong); }

.article-hero h1 {
  max-width: 18ch;
  margin: 2rem 0 1.5rem;
  font-size: clamp(2.4rem, 5.4vw, 4.25rem);
  letter-spacing: -0.045em;
  line-height: 1.04;
  text-wrap: balance;
}

.article-dek {
  max-width: 38rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  color: var(--muted);
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.5;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 var(--space-section);
}

.article-aside {
  position: sticky;
  top: 6.5rem;
  align-self: start;
}

.article-aside p:last-child {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.article-body { max-width: 40rem; }

.article-body p,
.article-body li {
  font-size: 1.1rem;
  line-height: 1.75;
  text-wrap: pretty;
}

.article-body p { margin-bottom: 1.5rem; }
.article-body .lede { font-size: clamp(1.2rem, 1.6vw, 1.35rem); line-height: 1.6; }

.article-body h2 {
  margin: clamp(3rem, 5vw, 4rem) 0 1.1rem;
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.article-body ul { margin: 0 0 1.75rem; padding-left: 1.2rem; }
.article-body li { margin-bottom: 0.5rem; padding-left: 0.3rem; }
.article-body li::marker { color: var(--faint); }

.article-body blockquote {
  margin: clamp(2.5rem, 5vw, 3.5rem) 0;
  padding: 0 0 0 1.5rem;
  border-left: 1px solid var(--line-strong);
  font-size: clamp(1.4rem, 2.2vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.article-end {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: clamp(3.5rem, 7vw, 5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.article-end p { max-width: 26rem; margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }

/* 404 */
.error-page {
  display: flex;
  min-height: calc(100svh - 4.5rem - 6rem);
  padding-block: clamp(6rem, 14vw, 10rem) clamp(3rem, 6vw, 5rem);
  flex-direction: column;
  justify-content: space-between;
  gap: 4rem;
}

.error-page h1 {
  margin-top: 2rem;
  font-size: clamp(3.5rem, 10vw, 7.5rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.error-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: end;
  justify-content: space-between;
}

.error-bottom p { color: var(--muted); }

/* Footer */
.site-footer { color: var(--muted); }

.footer-inner {
  display: flex;
  min-height: 6rem;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.site-footer a { transition: color 160ms ease; }
.site-footer a:hover,
.site-footer a:focus-visible { color: var(--ink); }

@media (max-width: 760px) {
  .site-header-inner { min-height: 4rem; }

  .hero-foot,
  .section-head,
  .index-row,
  .article-layout { grid-template-columns: 1fr; }

  .hero-links { justify-content: flex-start; }
  .section-head .label { padding-top: 0; }
  .index-row .num { padding-top: 0; }
  .article-aside { position: static; display: none; }
}

@media (max-width: 460px) {
  .site-nav { gap: 1rem; }
  .site-nav a { font-size: 0.68rem; }
  .footer-inner p:nth-child(2) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .text-link span,
  .site-nav a,
  .site-footer a { transition: none; }
}
