:root {
  --bg: #f6f7f6;
  --bg-alt: #eceeee;
  --text: #191d24;
  --text-muted: #565c68;
  --accent: #1e5f6b;
  --accent-2: #a3742c;
  --rule: #d6d9da;
  --max-width: 780px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  line-height: 1.65;
  font-size: 17px;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover {
  border-bottom-color: currentColor;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(246, 247, 246, 0.92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule);
  z-index: 10;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-weight: 700;
  color: var(--text);
  border-bottom: none;
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.92rem;
}
.site-header nav a {
  color: var(--text-muted);
}
.site-header nav a:hover {
  color: var(--accent);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* icon-dark (moon) = shown while in light mode, click to go dark.
   icon-light (sun) = shown while in dark mode, click to go light. */
.theme-toggle .icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-dark { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-light { display: inline; }
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}
.hero-photo {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 50%;
  margin: 0 0 24px;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--rule);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent-2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0 0 10px;
}
.hero h1 {
  font-size: clamp(2.1rem, 4vw, 3rem);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.hero-sub {
  max-width: 560px;
  margin: 0 auto 26px;
  color: var(--text-muted);
  font-size: 1.05rem;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
}
.hero-links a {
  color: var(--text);
  border-bottom: 1px solid var(--rule);
}
.hero-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.hero-links a.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font-size: 1.05rem;
}
.hero-links a.icon-link:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

/* Sections */
.section {
  padding: 56px 0;
}
.section.alt {
  background: var(--bg-alt);
}
.section h2 {
  font-size: 1.5rem;
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.edit-note {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--accent-soft);
  font-style: italic;
}

/* Entries (education / experience) */
.entry {
  margin-bottom: 28px;
}
.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 16px;
}
.entry-head h3 {
  margin: 0;
  font-size: 1.15rem;
}
.entry-date {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.entry-role {
  margin: 4px 0 10px;
  color: var(--text-muted);
  font-style: italic;
}
.entry ul {
  margin: 0;
  padding-left: 1.2em;
}
.entry li {
  margin-bottom: 6px;
}

/* Skills */
.skills-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.skill-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 24px;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.skill-row:last-child {
  border-bottom: 1px solid var(--rule);
}
.skill-row dt {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  align-self: start;
}
.skill-row dd {
  margin: 0;
  color: var(--text-muted);
}

/* Publications */
.pub-list {
  list-style: decimal;
  padding-left: 1.4em;
  margin: 0;
}
.pub-list li {
  margin-bottom: 22px;
  padding-left: 4px;
}
.pub-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}
.pub-authors {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 3px;
}
.pub-venue {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}
.status-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border: 1px solid var(--accent-2);
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* Footer */
.site-footer {
  padding: 28px 0 40px;
  text-align: center;
  color: var(--text-muted);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 640px) {
  .site-header nav { gap: 12px; font-size: 0.85rem; }
  .skill-row { grid-template-columns: 1fr; gap: 4px; }
  .hero { padding: 56px 0 40px; }
}

/* Dark mode: follows the visitor's OS/browser preference, unless overridden by the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171c;
    --bg-alt: #1a1e24;
    --text: #e7e9ec;
    --text-muted: #a3a9b4;
    --accent: #6fb8c4;
    --accent-2: #d1a24f;
    --rule: #2c313a;
  }
  :root:not([data-theme="light"]) .site-header {
    background: rgba(20, 23, 28, 0.9);
  }
}

/* Dark mode: forced on via the toggle, regardless of OS preference */
:root[data-theme="dark"] {
  --bg: #14171c;
  --bg-alt: #1a1e24;
  --text: #e7e9ec;
  --text-muted: #a3a9b4;
  --accent: #6fb8c4;
  --accent-2: #d1a24f;
  --rule: #2c313a;
}
:root[data-theme="dark"] .site-header {
  background: rgba(20, 23, 28, 0.9);
}
