/* ── Tokens ───────────────────────────────────────────────────────────────── */

:root {
  --bg: #fafafa;
  --surface: #f0f0f0;
  --ink: #0a0a0a;
  --muted: #525252;
  --faint: #a3a3a3;
  --line: #e5e5e5;
  --accent: #0a0a0a;

  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --measure: 40rem;
  --gutter: 1.25rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */

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

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page {
  flex: 1;
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(4rem, 14vh, 8rem) var(--gutter) 5rem;
}

.sep {
  margin: 0 0.5em;
  color: var(--faint);
}

.label {
  margin-bottom: 0.75rem;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.arrow {
  display: inline-block;
  color: var(--faint);
  font-size: 0.85em;
  transition: transform 0.25s var(--ease), color 0.25s;
}

a:hover .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ── Home ─────────────────────────────────────────────────────────────────── */

.name {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
}

.tagline {
  margin-top: 0.875rem;
  color: var(--muted);
}

.location {
  margin-top: 0.125rem;
  color: var(--faint);
}

.about {
  max-width: 34rem;
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-top: 2rem;
}

.links a {
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  transition: border-color 0.25s;
}

.links a:hover {
  border-color: var(--ink);
}

.section {
  margin-top: 4.5rem;
}

.rows {
  padding: 0;
  list-style: none;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.75rem 0;
}

.row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.row-title {
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: color 0.25s;
}

.row-sub {
  color: var(--muted);
  font-size: 0.9375rem;
  text-wrap: pretty;
}

.row-meta {
  flex-shrink: 0;
  color: var(--faint);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

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

/* ── Article ──────────────────────────────────────────────────────────────── */

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--faint);
  font-size: 0.875rem;
  transition: color 0.25s;
}

.back span {
  transition: transform 0.25s var(--ease);
}

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

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

.back-end {
  margin-top: 4.5rem;
}

.article-header {
  margin: 3.5rem 0 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.meta {
  color: var(--faint);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.title {
  margin-top: 1rem;
  font-size: clamp(2.25rem, 6.5vw, 3.125rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lede {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1.1875rem;
  font-style: italic;
  line-height: 1.5;
}

.prose {
  font-size: 1.125rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.prose > * + * {
  margin-top: 1.2em;
}

.prose h2,
.prose h3 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: balance;
  scroll-margin-top: 2rem;
}

.prose h2 {
  margin-top: 2.6em;
  font-size: 1.375rem;
}

.prose h3 {
  margin-top: 2em;
  font-size: 1.125rem;
}

.prose :is(h2, h3) + * {
  margin-top: 0.6em;
}

.prose strong {
  font-weight: 600;
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s;
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}

.prose blockquote {
  padding-left: 1.25em;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose code {
  padding: 0.15em 0.35em;
  border-radius: 4px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.78em;
}

.prose pre {
  overflow-x: auto;
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.875rem;
  line-height: 1.65;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose hr {
  height: auto;
  margin: 2.5em 0;
  border: 0;
  text-align: center;
}

.prose hr::after {
  content: '· · ·';
  color: var(--faint);
  letter-spacing: 0.5em;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* ── 404 ──────────────────────────────────────────────────────────────────── */

.not-found .title {
  margin: 0 0 2.5rem;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.footer {
  display: flex;
  justify-content: flex-end;
  width: calc(100% - var(--gutter) * 2);
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.8125rem;
}

.footer nav {
  display: flex;
  gap: 1.25rem;
}

.footer a {
  transition: color 0.25s;
}

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

/* ── Motion ───────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 0.8s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 80ms);
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
  }
}

/* ── Small screens ────────────────────────────────────────────────────────── */

@media (max-width: 34rem) {
  .row {
    flex-direction: column;
    gap: 0.35rem;
  }

  .prose {
    font-size: 1.0625rem;
  }

  .lede {
    font-size: 1.125rem;
  }
}
