:root {
  --bg: #f7f4ec;
  --text: #1c1a17;
  --text-2: #4a463f;
  --text-3: #7a7468;
  --rule: #d8d2c1;
  --link: #5a3a1f;
  --link-hover: #1c1a17;
  --accent: #8a3a1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --text: #e8e1d0;
    --text-2: #b8b1a0;
    --text-3: #807968;
    --rule: #2c2920;
    --link: #d4a86a;
    --link-hover: #e8e1d0;
    --accent: #d4a86a;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: "Charter", "Iowan Old Style", "Iowan", "Palatino Linotype", "Palatino", "Georgia", "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  padding: 32px 24px 96px;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
}

/* === Top nav === */
nav.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 56px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  gap: 12px;
}

nav.top .brand {
  font-family: "Charter", "Iowan Old Style", "Palatino", "Georgia", serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

nav.top .brand a {
  color: inherit;
  border-bottom: none;
}

nav.top .brand a:hover {
  color: var(--link);
}

nav.top ul {
  list-style: none;
  display: flex;
  gap: 22px;
  align-items: baseline;
}

nav.top a {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
  padding-bottom: 2px;
}

nav.top a:hover {
  color: var(--text);
  border-bottom-color: var(--text-3);
}

nav.top a.current {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* === Headings === */
h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: 24px;
}

h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  margin-bottom: 24px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
}

h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.35;
  margin-bottom: 8px;
}

/* === Intro paragraph === */
.intro p {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 14px;
}

.intro p:last-child {
  margin-bottom: 0;
}

/* === Rule === */
hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 48px 0;
}

/* === Section page header (for sub-pages) === */
.page-header {
  margin-bottom: 48px;
}

.page-header h1 {
  margin-bottom: 12px;
}

.page-header .kicker {
  font-size: 14px;
  color: var(--text-3);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  margin-bottom: 12px;
}

.page-header p {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.7;
  max-width: 580px;
}

/* === Year-grid row === */
.row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 24px;
  margin-bottom: 24px;
  align-items: baseline;
}

.row:last-child {
  margin-bottom: 0;
}

.year {
  font-size: 14px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  font-weight: 500;
  padding-top: 3px;
}

.item {
  line-height: 1.6;
}

.item .title {
  color: var(--text);
}

.item .sub {
  color: var(--text-3);
  font-size: 15px;
  font-style: italic;
  display: block;
  margin-top: 3px;
}

.item .meta {
  color: var(--text-3);
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  display: block;
  margin-top: 4px;
}

/* === Links === */
a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link);
}

/* === Now/Bullet list === */
.now-list, .projects, .press, .plain-list {
  list-style: none;
}

.now-list li {
  margin-bottom: 24px;
  color: var(--text-2);
  line-height: 1.65;
}

.now-list li:last-child {
  margin-bottom: 0;
}

.now-list .label {
  color: var(--text);
  font-weight: 600;
}

/* === Projects === */
.projects li {
  margin-bottom: 28px;
  line-height: 1.6;
}

.projects li:last-child {
  margin-bottom: 0;
}

.projects .name {
  font-weight: 600;
  color: var(--text);
  font-size: 17px;
}

.projects .desc {
  color: var(--text-2);
  display: block;
  margin-top: 4px;
}

.projects .link {
  font-size: 13px;
  color: var(--text-3);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  margin-top: 4px;
  display: inline-block;
}

/* === Press === */
.press li {
  margin-bottom: 12px;
  color: var(--text-2);
  line-height: 1.6;
}

.press li:last-child {
  margin-bottom: 0;
}

.press .yr {
  color: var(--text-3);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  margin-right: 10px;
}

/* === Footer === */
footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.7;
}

footer a {
  color: var(--text-2);
  border-bottom: 1px solid var(--rule);
}

footer a:hover {
  color: var(--text);
  border-bottom-color: var(--text-2);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 12px;
}

/* === Misc === */
.placeholder {
  color: var(--text-3);
  font-style: italic;
  font-size: 15px;
}

.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  margin-bottom: 16px;
  margin-top: 32px;
}

/* === Article (post body) === */
article {
  max-width: 620px;
}

article header.post-header {
  margin-bottom: 48px;
}

article header.post-header .kicker {
  font-size: 13px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  margin-bottom: 12px;
}

article header.post-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

article header.post-header .post-meta {
  font-size: 14px;
  color: var(--text-3);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
}

article .post-body p,
article .post-body ul,
article .post-body ol,
article .post-body blockquote {
  margin-bottom: 22px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}

article .post-body p:last-child {
  margin-bottom: 0;
}

article .post-body strong {
  font-weight: 700;
}

article .post-body em {
  font-style: italic;
}

article .post-body h2 {
  font-size: 22px;
  font-weight: 700;
  font-family: "Charter", "Iowan Old Style", "Palatino", "Georgia", serif;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 48px 0 16px;
  line-height: 1.3;
}

article .post-body h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 36px 0 12px;
  letter-spacing: -0.005em;
}

article .post-body ul, article .post-body ol {
  padding-left: 24px;
}

article .post-body li {
  margin-bottom: 8px;
}

article .post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  color: var(--text-2);
  font-style: italic;
  margin-left: 0;
}

article .post-body .section-break {
  text-align: center;
  margin: 36px 0;
  color: var(--text-3);
  letter-spacing: 0.5em;
}

article .post-body a {
  color: var(--link);
  border-bottom: 1px solid rgba(0,0,0,0);
}

article .post-body a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link);
}

.post-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.post-footer .post-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 14px;
  color: var(--text-3);
  font-family: -apple-system, "Inter", sans-serif;
  margin-bottom: 32px;
}

.post-footer .post-nav a {
  color: var(--text-2);
  border-bottom: none;
}

.post-footer .post-nav a:hover {
  color: var(--accent);
}

.post-footer .back-link {
  font-size: 14px;
  font-family: -apple-system, "Inter", sans-serif;
}

/* === Post archive list (on /writings/) === */
.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}

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

.post-list .post-list-meta {
  font-size: 13px;
  color: var(--text-3);
  font-family: -apple-system, "Inter", sans-serif;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}

.post-list h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.post-list h3 a {
  color: var(--text);
  border-bottom: none;
}

.post-list h3 a:hover {
  color: var(--accent);
}

.post-list .excerpt {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.6;
}

/* === Mobile === */
@media (max-width: 540px) {
  body { padding: 24px 20px 64px; }
  h1 { font-size: 24px; }
  .row { grid-template-columns: 56px 1fr; gap: 16px; }
  .intro p, .page-header p { font-size: 16px; }
  hr { margin: 36px 0; }
  nav.top { margin-bottom: 36px; padding-bottom: 14px; }
  nav.top ul { gap: 16px; }
  nav.top a { font-size: 13px; }
  .page-header { margin-bottom: 36px; }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}
