:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino,
           "URW Palladio L", "Source Serif Pro", ui-serif, Georgia,
           Cambria, "Times New Roman", Times, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
          "Roboto Mono", monospace;

  --bg: #f7f4ee;
  --bg-grad: radial-gradient(ellipse at top, #fbf8f1 0%, #f5f1ea 70%);
  --surface: #ffffff;
  --text: #181613;
  --muted: #756e64;
  --rule: #e3ddd1;
  --accent: #c2410c;
  --accent-strong: #8a3215;

  --measure: 38rem;
  --page-pad-x: clamp(1.25rem, 5vw, 2rem);
  --section-gap: clamp(3.5rem, 8vw, 5.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0e0c;
    --bg-grad: radial-gradient(ellipse at top, #181612 0%, #0c0b09 70%);
    --surface: #16161a;
    --text: #f1eee7;
    --muted: #9a948a;
    --rule: #2a2722;
    --accent: #f1a17a;
    --accent-strong: #f8b893;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (min-width: 700px) {
  body { font-size: 18px; }
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6rem) var(--page-pad-x) clamp(3rem, 6vw, 4rem);
}

section + section { margin-top: var(--section-gap); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
  color: var(--text);
}

h1 {
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin-bottom: 1rem;
  position: relative;
}

h1::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  background: var(--accent);
  margin-top: 1.25rem;
  border-radius: 2px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head .num {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 120ms ease;
}
a:hover { color: var(--accent-strong); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  z-index: 10;
}

/* Hero */
.hero .lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.2rem, 2.6vw, 1.45rem);
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 1.75rem;
  max-width: 32rem;
}

.credential {
  font-style: normal;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.005em;
}

/* About headshot */
.about-photo {
  float: right;
  width: 8.5rem;
  height: 8.5rem;
  object-fit: cover;
  border-radius: 4px;
  margin: 0.25rem 0 1rem 1.5rem;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04),
    0 12px 28px -10px rgba(0, 0, 0, 0.18);
  filter: saturate(0.95);
}
@media (max-width: 599px) {
  .about-photo {
    float: none;
    display: block;
    width: 7rem;
    height: 7rem;
    margin: 0 0 1.25rem;
  }
}

.hero .status {
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.cta {
  display: inline-block;
  margin-left: 0.35rem;
  font-weight: 500;
  position: relative;
}
.cta::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0.4);
  transform-origin: left;
  transition: transform 180ms ease;
}
.cta:hover::after { transform: scaleX(1); }

.muted {
  color: var(--muted);
  font-size: 0.95em;
}

/* Experience list */
.experience {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  border-top: 1px solid var(--rule);
}
.experience li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}
.experience .year {
  flex: 0 0 4rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-transform: uppercase;
}
.experience .role { flex: 1; }

/* Writing list (homepage) */
.writing {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  border-top: 1px solid var(--rule);
}
.writing li {
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
}
.writing .post-title-link {
  font-family: var(--serif);
  font-size: 1.08rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.005em;
}
.writing .post-title-link:hover { color: var(--accent); }
.writing .post-summary {
  display: block;
  color: var(--muted);
  font-size: 0.92em;
  margin-top: 0.2rem;
}
.writing time {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 0.5rem;
}

/* Post pages */
.post { padding-top: clamp(2.5rem, 6vw, 4rem); }

.back-link {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 3rem;
}
.back-link:hover { color: var(--text); }

.post-header { margin-bottom: 2.75rem; }
.post-header h1 { margin-bottom: 0.5rem; }

.post-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.25rem;
}

.post-lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  line-height: 1.5;
  color: var(--muted);
  margin: 1.5rem 0 0;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.75;
}
.post-body p { margin: 0 0 1.25rem; }
.post-body h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
  color: var(--text);
}
.post-body h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}
.post-body ul, .post-body ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
}
.post-body li { margin-bottom: 0.4rem; }
.post-body blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
}
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.post-body pre {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--rule);
  padding: 1rem 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1.5rem 0;
}
.post-body pre code {
  background: none;
  padding: 0;
  font-size: 1em;
}
.post-body hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem auto;
  width: 4rem;
}
.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}
.post-body a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-footer-nav {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.post-footer-nav .back-link { margin-bottom: 0; }

@media (prefers-color-scheme: dark) {
  .post-body code { background: rgba(255, 255, 255, 0.08); }
  .post-body pre { background: rgba(255, 255, 255, 0.04); }
}

/* Footer */
footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem var(--page-pad-x) 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-name { margin: 0; }

.social {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 1rem;
}
.social a {
  color: var(--muted);
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 4px;
  text-decoration: none;
  transition: color 120ms ease;
}
.social a:hover { color: var(--text); }
.social svg { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
