/* Layout: an editorial home page. A two-column hero (big type left, a live Langton's-ant canvas right)
   sits over two catalogs: an essay index and an asymmetric project grid. Articles use one ~40rem reading measure. */
:root {
  --paper: #f4f5f7;
  --surface: #ffffff;
  --ink: #0d1016;
  --ink-2: #4a5160;
  --ink-3: #6f7786;
  --rule: #dcdfe5;
  --accent: #2f3fe0;
  --accent-ink: #ffffff;
  --accent-soft: #e3e6ff;
  --mark: #ffe357;
  --mark-ink: #0d1016;
  --shadow: 0 1px 2px rgb(13 16 22 / 0.04), 0 8px 24px rgb(13 16 22 / 0.06);
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --s-xs: 0.75rem;
  --s-sm: 0.875rem;
  --s-md: 1.125rem;
  --s-lg: 1.3rem;
  --s-xl: clamp(1.9rem, 3.6vw, 2.6rem);
  --s-hero: clamp(3.1rem, 9.6vw, 7.6rem);
  --gutter: clamp(16px, 4vw, 48px);
  --max: 76rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0d12; --surface: #13161d; --ink: #eceef3; --ink-2: #a5acb9; --ink-3: #7d8594; --rule: #252a34;
    --accent: #8c98ff; --accent-ink: #0b0d12; --accent-soft: #1b1f47; --mark: #e6ca3b; --mark-ink: #0b0d12;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b0d12; --surface: #13161d; --ink: #eceef3; --ink-2: #a5acb9; --ink-3: #7d8594; --rule: #252a34;
  --accent: #8c98ff; --accent-ink: #0b0d12; --accent-soft: #1b1f47; --mark: #e6ca3b; --mark-ink: #0b0d12;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--s-md)/1.6 var(--f-serif);
  padding-inline: var(--gutter); padding-block: 0;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: var(--ink-3); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; margin: 0; }
p { margin: 0; }
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; }
.kicker { font: 500 var(--s-xs)/1.4 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; z-index: 10; }

/* ---------- nav ---------- */
.site-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-block: 22px; }
.wordmark { font: 700 1.15rem/1 var(--f-display); letter-spacing: -0.02em; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.wordmark i { width: 12px; height: 12px; background: var(--accent); border-radius: 3px; display: inline-block; transform: rotate(45deg); }
.nav-links { display: flex; gap: 6px 22px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font: 500 var(--s-sm)/1 var(--f-mono); }
.nav-links a { text-decoration: none; color: var(--ink-2); padding-block: 6px; }
.nav-links a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 0.95rem/1 var(--f-display); letter-spacing: -0.01em;
  padding: 14px 20px; border-radius: 999px; text-decoration: none; border: 1.5px solid var(--ink); color: var(--ink);
  transition: transform .2s ease, background-color .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn .arr { transition: transform .2s ease; }
.btn:hover .arr { transform: translateX(3px); }
button.plain { font: 500 var(--s-xs)/1 var(--f-mono); color: var(--ink-2); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 8px 12px; cursor: pointer; }
button.plain:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: clamp(28px, 6vw, 88px) clamp(48px, 7vw, 104px); }
.hero-id { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.hero-id img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); box-shadow: var(--shadow); }
.hero h1 { font-size: var(--s-hero); line-height: 0.9; letter-spacing: -0.055em; font-weight: 750; }
.hero h1 .line { display: block; }
.hero h1 .dot { color: var(--accent); }
.hl { background: linear-gradient(transparent 12%, var(--mark) 12%, var(--mark) 88%, transparent 88%) no-repeat 0 0 / 100% 100%; color: var(--mark-ink); padding-inline: 0.06em; margin-inline: -0.02em; border-radius: 0.08em; }
@media (prefers-reduced-motion: no-preference) {
  .hero .hl { background-size: 0% 100%; animation: swipe .7s cubic-bezier(.6,.05,.25,1) .45s forwards; color: inherit; }
  @keyframes swipe { to { background-size: 100% 100%; color: var(--mark-ink); } }
}
.hero-lede { font-size: var(--s-lg); line-height: 1.5; color: var(--ink-2); max-width: 34rem; margin-top: 30px; }
.hero-lede strong { color: var(--ink); font-weight: 500; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.ant-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ant-card canvas { width: 100%; aspect-ratio: 1; max-width: 100%; display: block; border-radius: 10px; background: var(--paper); image-rendering: pixelated; }
.ant-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding-inline: 4px; min-height: 32px; }
.ant-meta .kicker { margin-right: auto; }
.ant-step { font: 500 var(--s-sm)/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.ant-step span { color: var(--ink-3); }
.ant-card figcaption { font: inherit; margin: 0; color: inherit; }
.ant-card p { font: 400 0.98rem/1.5 var(--f-serif); color: var(--ink-2); padding-inline: 4px; }
.ant-card p b { font-weight: 500; color: var(--ink); }

/* ---------- sections ---------- */
.section { padding-block: clamp(40px, 6vw, 80px); border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px 48px; align-items: end; margin-bottom: clamp(24px, 4vw, 44px); }
.section-head h2 { font-size: var(--s-xl); line-height: 1.02; }
.section-head p { color: var(--ink-2); font-size: var(--s-md); max-width: 36rem; }

/* essays */
.essays { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.essay { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto; gap: 8px 32px; align-items: start; padding-block: 28px; border-bottom: 1px solid var(--rule); text-decoration: none; }
.essay .meta { font: 500 var(--s-xs)/1.7 var(--f-mono); color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; padding-top: 6px; }
.essay h3 { font-size: clamp(1.5rem, 2.8vw, 2.15rem); line-height: 1.08; transition: color .2s ease; }
.essay .dek { color: var(--ink-2); margin-top: 10px; max-width: 44rem; }
.essay .go { font: 500 1.5rem/1 var(--f-display); color: var(--ink-3); padding-top: 6px; transition: transform .25s ease, color .2s ease; }
.essay:hover h3, .essay:hover .go { color: var(--accent); }
.essay:hover .go { transform: translateX(6px); }

/* projects */
.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); }
.project { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; transition: transform .25s ease, box-shadow .25s ease; }
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.project.featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.thumb { aspect-ratio: 16 / 10; overflow: hidden; background: #12161b; position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.project:hover .thumb img { transform: scale(1.03); }
.thumb.fly { background: radial-gradient(120% 90% at 50% 100%, var(--accent) 0%, var(--accent-soft) 70%); aspect-ratio: auto; min-height: 20rem; }
.project.featured.reverse .thumb { order: 2; }
.thumb.muck { aspect-ratio: auto; min-height: 20rem; background: #0e0c0b; }
.thumb.grok { background: #0c0e13; }
.thumb.grok img { image-rendering: pixelated; object-position: 50% 50%; }
.thumb.soup { aspect-ratio: auto; min-height: 24rem; background: #0e1110; }
.thumb.soup img { image-rendering: pixelated; }
.project.lead h3 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); }
.subhead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 8px 48px; align-items: end; margin: clamp(40px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); padding-top: 28px; border-top: 1px solid var(--rule); }
.subhead h3 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.05; }
.subhead p { color: var(--ink-2); }
.subhead a { color: var(--accent); text-decoration: none; white-space: nowrap; }
.subhead a:hover { text-decoration: underline; }
.projects.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.thumb.fly img { object-fit: contain; padding: 6% 8% 0; object-position: bottom; }
.thumb.ants img { object-position: 50% 40%; }
.project-body { padding: clamp(20px, 2.6vw, 32px); display: flex; flex-direction: column; gap: 12px; flex: 1; }
.project h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.05; }
.project.featured h3 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
.project .desc { color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip { font: 500 var(--s-xs)/1 var(--f-mono); padding: 7px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.credit { font: 400 var(--s-xs)/1.5 var(--f-mono); color: var(--ink-3); }
.links { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: auto; padding-top: 10px; font: 600 0.95rem/1.2 var(--f-display); }
.links a { text-decoration: none; color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }
.links a:hover { text-decoration: underline; }

/* topics + about */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 32px 48px; align-items: start; }
.about-lead { display: flex; flex-direction: column; gap: 18px; }
.about-lead h2 { font-size: var(--s-xl); line-height: 1.02; }
.about-copy { display: flex; flex-direction: column; gap: 16px; color: var(--ink-2); }
.about-copy strong { color: var(--ink); font-weight: 500; }
.topics { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
.topics li { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.topics b { font: 650 1.02rem/1.25 var(--f-display); letter-spacing: -0.01em; color: var(--ink); }
.topics span { font-size: 0.95rem; line-height: 1.45; color: var(--ink-2); }

.site-foot { border-top: 1px solid var(--rule); padding-block: 36px 48px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font: 400 var(--s-xs)/1.6 var(--f-mono); color: var(--ink-3); }
.site-foot a { color: var(--ink-2); }

/* ---------- article ---------- */
.article-head { max-width: 40rem; margin-inline: auto; padding-block: clamp(24px, 6vw, 72px) 36px; display: flex; flex-direction: column; gap: 20px; }
.article-head h1 { font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 0.98; letter-spacing: -0.045em; }
.article-head .dek { font-size: clamp(1.2rem, 2.2vw, 1.45rem); line-height: 1.45; color: var(--ink-2); font-style: italic; }
.byline { display: flex; align-items: center; gap: 12px; font: 500 var(--s-sm)/1.3 var(--f-mono); color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--rule); }
.byline img { width: 40px; height: 40px; border-radius: 50%; }
.byline b { color: var(--ink); font-weight: 500; display: block; }
.hero-figure { max-width: 64rem; margin: 0 auto 48px; }
.prose { max-width: 40rem; margin-inline: auto; font-size: 1.2rem; line-height: 1.68; padding-bottom: 32px; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { font-size: clamp(1.55rem, 3vw, 1.95rem); line-height: 1.12; margin-top: 2.1em; }
.prose h3 { font-size: 1.3rem; line-height: 1.2; margin-top: 1.8em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose strong { font-weight: 600; }
.prose mark { background: var(--mark); color: var(--mark-ink); padding-inline: 0.12em; border-radius: 2px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.5em; }
.prose code { font: 400 0.86em var(--f-mono); background: var(--surface); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 4px; }
.prompt { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 18px 20px; font: 400 0.98rem/1.6 var(--f-mono); color: var(--ink); }
.prompt .kicker { display: block; margin-bottom: 10px; color: var(--accent); }
.prose figure { margin-inline: 0; margin-bottom: 0; }
.prose figure img, .hero-figure img { width: 100%; border-radius: 14px; border: 1px solid var(--rule); background: #12161b; }
figcaption { font: 400 var(--s-sm)/1.5 var(--f-mono); color: var(--ink-3); margin-top: 10px; }
.figure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.figure-pair img { aspect-ratio: 1; object-fit: cover; }
.pull { font: 650 clamp(1.45rem, 3vw, 1.9rem)/1.2 var(--f-display); letter-spacing: -0.02em; color: var(--ink); padding-block: 8px; border-block: 1px solid var(--rule); padding: 22px 0; }
.stats { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
.stats li { background: var(--surface); padding: 16px; margin: 0 !important; display: flex; flex-direction: column; gap: 4px; }
.stats b { font: 700 1.6rem/1.1 var(--f-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stats span { font: 400 var(--s-xs)/1.4 var(--f-mono); color: var(--ink-2); }
ol.steps { list-style: none; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 0; border-left: 2px solid var(--rule); margin-left: 14px; }
ol.steps li { counter-increment: step; position: relative; padding: 0 0 26px 30px; margin: 0; }
ol.steps li:last-child { padding-bottom: 0; }
ol.steps li::before { content: counter(step); position: absolute; left: -15px; top: 0.15em; width: 28px; height: 28px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); color: var(--accent); font: 600 0.8rem/24px var(--f-mono); text-align: center; }
ol.steps b { font-family: var(--f-display); font-weight: 650; letter-spacing: -0.01em; display: block; font-size: 1.12rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font: 400 0.92rem/1.4 var(--f-mono); font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font: 600 0.85rem/1.3 var(--f-display); color: var(--ink-2); }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: 0; }
td.best { color: var(--accent); font-weight: 600; }
.callout { background: var(--accent-soft); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.callout p { font-size: 1.1rem; }
.next { max-width: 40rem; margin: 24px auto 64px; display: block; text-decoration: none; border-top: 1px solid var(--rule); padding-top: 24px; }
.next .kicker { display: block; margin-bottom: 8px; }
.next b { font: 700 clamp(1.4rem, 3vw, 1.8rem)/1.1 var(--f-display); letter-spacing: -0.02em; transition: color .2s ease; }
.next:hover b { color: var(--accent); }

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .ant-card { max-width: 30rem; }
  .section-head, .about { grid-template-columns: minmax(0, 1fr); }
  .project.featured { grid-template-columns: minmax(0, 1fr); }
  .thumb.fly, .thumb.muck, .thumb.soup { min-height: 16rem; }
  .project.featured.reverse .thumb { order: 0; }
  .subhead { grid-template-columns: minmax(0, 1fr); }
  .projects.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .projects { grid-template-columns: minmax(0, 1fr); }
  .essay { grid-template-columns: minmax(0, 1fr) auto; }
  .essay .meta { grid-column: 1 / -1; padding-top: 0; }
  .topics { grid-template-columns: minmax(0, 1fr); }
  .prose { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
