:root {
  --paper: #faf6f1;
  --ink: #2c2520;
  --header-bg: #3d2b1f;
  --nav-link: #d4bfa8;
  --accent: #b5694a;
  --muted: #6b5a50;
  --card-bg: #ffffff;
  --card-border: #e0d0c0;
  --badge-bg: #f5f0ea;
  --badge-published-bg: #eef6ee;
  --badge-published-border: #b5d6b5;
  --badge-published-ink: #5a7a5c;
  --photo-ring: #f5ede2;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Lato, "Segoe UI", -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }
footer { flex-shrink: 0; }

h1, h2, h3 {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  color: var(--ink);
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
nav.site-nav {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.nav-brand {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.nav-links a {
  font-size: 13.6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--nav-link);
  padding: 6px 12px;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-links a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-decoration: none;
}
.nav-links a.current {
  color: #fff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 620px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    flex-direction: column;
    flex-basis: 100%;
    gap: 0;
    padding-top: 6px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 4px; }
}

/* ---- Hero ---- */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.hero {
  display: flex;
  align-items: flex-start;
  gap: 56px;
  padding-bottom: 48px;
}
.hero img.avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--photo-ring);
  flex-shrink: 0;
}
.hero h1 {
  font-size: 41.6px;
  font-weight: 700;
  margin-bottom: 6px;
}
.hero-subtitle {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 12px;
  color: var(--ink);
}
.hero p { margin: 0 0 14px; max-width: 54ch; }

.icon-row { display: flex; gap: 18px; margin-top: 20px; flex-wrap: wrap; }
.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--accent);
}
.icon-btn .c-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.6px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover .c-icon { background: var(--accent); color: #fff; }
.icon-btn span.lbl {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

hr.section-rule {
  border: none;
  border-top: 1px solid var(--card-border);
  max-width: 960px;
  margin: 0 auto;
}

/* ---- Section labels ---- */
.section-label {
  font-size: 22.4px;
  font-weight: 500;
  padding-bottom: 10px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
}

/* ---- Cards ---- */
.paper-card {
  background: var(--card-bg);
  border: 0.8px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(61,43,31,0.06);
  padding: 28px 32px;
  margin: 0 0 28px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--badge-bg);
  border: 0.8px solid var(--card-border);
  color: var(--muted);
  margin-bottom: 14px;
}
.badge.badge-published {
  background: var(--badge-published-bg);
  border-color: var(--badge-published-border);
  color: var(--badge-published-ink);
}
.paper-card h3 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 8px;
}
.paper-card .byline {
  font-style: italic;
  color: var(--muted);
  font-size: 14.5px;
  margin-bottom: 14px;
}
.paper-card .abstract-toggle {
  background: none;
  border: none;
  padding: 0;
  font-family: Lato, sans-serif;
  font-size: 13.12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.paper-card .abstract-body {
  margin-top: 12px;
  font-size: 15px;
  color: var(--ink);
}
.paper-card .meta-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
.paper-card .meta-line b { color: var(--ink); font-weight: 700; }

/* ---- Interior page header (non-About pages) ---- */
.page-head { padding: 48px 0 8px; }
.page-head .eyebrow {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}
.page-head h1 {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 10px;
}
.page-head .intro {
  color: var(--muted);
  max-width: 62ch;
  margin: 0 0 8px;
  font-size: 16px;
}

.tags-line { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 8px; }
.tags-line span {
  font-size: 12.5px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--badge-bg);
  border: 0.8px solid var(--card-border);
  padding: 4px 12px;
  border-radius: 20px;
}

/* ---- Teaching module rows ---- */
.mod-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--card-border);
}
.mod-row:last-child { border-bottom: 1px solid var(--card-border); }
.mod-row .code {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
  font-size: 16px;
}
.mod-row .desc { color: var(--muted); font-size: 14.5px; }
.mod-row .level {
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  align-self: flex-start;
  border: 0.8px solid var(--card-border);
  background: var(--badge-bg);
  padding: 3px 10px;
  border-radius: 20px;
}

/* ---- Writing posts ---- */
.post {
  padding: 22px 0;
  border-top: 1px solid var(--card-border);
}
.post:last-child { border-bottom: 1px solid var(--card-border); }
.post-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.post h3 { font-size: 18px; font-weight: 700; }
.post time {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.post p { color: var(--muted); margin: 8px 0 0; font-size: 15px; }
.post .flag {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Blog post layout: sticky left TOC + article ---- */
.post-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: start;
}
.post-toc {
  position: sticky;
  top: 88px;
}
.post-toc .toc-label {
  display: block;
  font-family: -apple-system, "Segoe UI", ui-sans-serif, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.post-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--card-border);
}
.post-toc li { margin: 0; }
.post-toc a {
  display: block;
  padding: 6px 0 6px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
}
.post-toc a:hover { color: var(--ink); }
.post-toc a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ---- Blog post body ---- */
.post-body { max-width: 68ch; }
.post-body p { margin: 0 0 1.1em; }
.post-body h2 {
  font-size: 22px;
  margin: 1.6em 0 0.6em;
  scroll-margin-top: 88px;
}
.post-body ol, .post-body ul {
  padding-left: 1.4em;
  margin: 0 0 1.1em;
}
.post-body li { margin-bottom: 0.5em; }
.post-body strong { color: var(--ink); }

@media (max-width: 860px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-toc { display: none; }
}

/* ---- Contact page ---- */
.contact-block { display: flex; flex-direction: column; gap: 18px; max-width: 46ch; }
.contact-row { display: flex; flex-direction: column; gap: 2px; }
.contact-row .lbl {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.contact-row a, .contact-row span.val { font-size: 17px; }

footer {
  background: var(--header-bg);
  color: var(--nav-link);
  text-align: center;
  padding: 24px;
  font-size: 13px;
}

@media (max-width: 620px) {
  .hero { flex-direction: column; align-items: center; text-align: center; }
  .hero p { max-width: 100%; }
  .icon-row { justify-content: center; }
  .mod-row, .post-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}
