:root {
  --bg: #fdfdfc;
  --surface: #f4f3f0;
  --text: #1a1a18;
  --muted: #6b6a65;
  --border: #e2e0da;
  --accent: #9a3412;
  /* Report-state chips — the one loud element on the page. */
  --state-bounty-bg: #dcf0e4;
  --state-bounty-fg: #1a6340;
  --state-ack-bg: #eae8e2;
  --state-ack-fg: #5c5a54;
  --radius: 8px;
  --measure: 34rem;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14140f;
    --surface: #1e1e18;
    --text: #eceae4;
    --muted: #9a978d;
    --border: #2e2e26;
    --accent: #f0a882;
    --state-bounty-bg: #14311f;
    --state-bounty-fg: #7fd4a0;
    --state-ack-bg: #292921;
    --state-ack-fg: #a8a59b;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

/* ------------------------------------------------------------- chrome */

.site-header,
main,
.site-footer {
  max-width: calc(var(--measure) + 12rem);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-header nav {
  display: flex;
  gap: 1.5rem;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

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

.site-header nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 5rem;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 0;
}

/* --------------------------------------------------------------- hero */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 0.35rem;
}

.tagline {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 2rem;
}

.hero p {
  max-width: var(--measure);
}

.cta-row {
  margin-top: 2rem;
}

.timeline-points {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: var(--measure);
}

.timeline-points li {
  margin-bottom: 0.35rem;
}

/* ----------------------------------------------------------- sections */

.section {
  margin-top: 4.5rem;
}

.section > h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
}

.section > h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 0 0 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.more {
  margin-top: 2rem;
  font-size: 0.95rem;
}

.empty {
  color: var(--muted);
  max-width: var(--measure);
}

/* ----------------------------------------------------------- timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.5rem;
}

.timeline li:not(:last-child) {
  margin-bottom: 2rem;
}

.timeline li:not(:last-child) .timeline-body {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}

.timeline-period {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.3rem;
  white-space: nowrap;
}

.timeline-body h3 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 600;
}

.timeline-org {
  display: block;
  color: var(--accent);
  font-size: 0.95rem;
}

.timeline-description {
  margin: 0.6rem 0 0;
  color: var(--muted);
  max-width: var(--measure);
}

/* ---------------------------------------------------------- post list */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-list li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.5rem;
  padding-bottom: 1.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
  border-bottom: 0;
}

.post-list time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding-top: 0.25rem;
}

.post-list a {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.post-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.post-summary {
  grid-column: 2;
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: var(--measure);
}

/* --------------------------------------------------------------- post */

.post {
  margin-top: 2rem;
}

.post-header {
  margin-bottom: 3rem;
}

.post-header h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 0.75rem;
  max-width: var(--measure);
}

.post-header time {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.origin {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.prose {
  max-width: var(--measure);
}

.prose > * {
  margin-top: 0;
  margin-bottom: 1.4rem;
}

.prose h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: -0.015em;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

.prose h3 {
  font-size: 1.15rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

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

.prose li {
  margin-bottom: 0.5rem;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.prose blockquote {
  margin-left: 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  font-style: italic;
}

.prose pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.55;
}

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

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ----------------------------------------------------------------- cv */

.cv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.cv-header h1 {
  margin: 0;
}

.button {
  display: inline-block;
  background: var(--text);
  color: var(--bg);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.button:hover {
  opacity: 0.85;
}

.cv-viewer {
  width: 100%;
  height: min(80vh, 900px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* -------------------------------------------------------------- stats */

.stats-section {
  margin-top: 3.5rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-value {
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-label {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

/* -------------------------------------------------------------- scope */

.scope {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.25rem;
}

.scope-item h3 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
}

.scope-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------- ledger */

.table-scroll {
  overflow-x: auto;
}

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.ledger td {
  padding: 0.85rem 0.75rem 0.85rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ledger tr:last-child td {
  border-bottom: 0;
}

.ledger-program {
  font-weight: 600;
  white-space: nowrap;
}

.ledger-platform {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.ledger td:last-child {
  text-align: right;
}

.state {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.state-bounty {
  background: var(--state-bounty-bg);
  color: var(--state-bounty-fg);
}

.state-ack {
  background: var(--state-ack-bg);
  color: var(--state-ack-fg);
}

/* ----------------------------------------------------------- projects */

.projects {
  display: grid;
  gap: 2.5rem;
}

.project h3 {
  font-size: 1.05rem;
  margin: 0 0 0.3rem;
}

.project h3 a {
  color: var(--text);
  text-decoration: none;
}

.project h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.project p {
  margin: 0;
  max-width: var(--measure);
}

.project > p:not(.credit):not(.project-meta) {
  color: var(--muted);
  font-size: 0.95rem;
}

.credit {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.6rem !important;
}

.project-meta {
  margin-top: 0.6rem !important;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* ------------------------------------------------------------ writing */

.subhead {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin: 3rem 0 1.5rem;
}

.post-list .source {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.3rem;
}

/* -------------------------------------------------------------- links */

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.link-list li:last-child {
  border-bottom: 0;
}

.link-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.link-list a {
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.link-note {
  display: inline-block;
  margin-left: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

/* ------------------------------------------------------------- mobile */

@media (max-width: 46rem) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 1.5rem;
  }

  .scope {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

@media (max-width: 34rem) {
  .timeline li,
  .post-list li,
  .link-list li {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .post-summary {
    grid-column: 1;
  }

  .timeline li:not(:last-child) .timeline-body {
    padding-bottom: 1.5rem;
  }

  .timeline li:not(:last-child) {
    margin-bottom: 1.5rem;
  }

  .ledger td:last-child {
    text-align: left;
  }
}
