:root {
  --bg: #f7f6f2;
  --bg-gradient: linear-gradient(180deg, #f7f6f2 0%, #ffffff 100%);
  --surface: #ffffff;
  --header: #fffef9;
  --ink: #1f1f1f;
  --muted: #5d5d5d;
  --accent: #2f5d62;
  --border: #dcd6cf;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --bg-gradient: radial-gradient(circle at top, #1b1b1b 0%, #0f0f0f 70%);
    --surface: #1a1a1a;
    --header: #151515;
    --ink: #f2f2f2;
    --muted: #c3c3c3;
    --accent: #76b5c5;
    --border: #2a2a2a;
  }
}

html[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-gradient: linear-gradient(180deg, #f7f6f2 0%, #ffffff 100%);
  --surface: #ffffff;
  --header: #fffef9;
  --ink: #1f1f1f;
  --muted: #5d5d5d;
  --accent: #2f5d62;
  --border: #dcd6cf;
}

html[data-theme="dark"] {
  --bg: #121212;
  --bg-gradient: radial-gradient(circle at top, #1b1b1b 0%, #0f0f0f 70%);
  --surface: #1a1a1a;
  --header: #151515;
  --ink: #f2f2f2;
  --muted: #c3c3c3;
  --accent: #76b5c5;
  --border: #2a2a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Serif 4", "Georgia", serif;
  background: var(--bg-gradient);
  color: var(--ink);
  line-height: 1.6;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 16px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  z-index: 20;
}

.skip-link:focus-visible {
  left: 16px;
}


.site-nav a:focus-visible,
.theme-toggle:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--header);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-title {
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.5px;
}

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

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-header h1 {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page {
  padding: 48px 24px 72px;
}

.page-content {
  max-width: 760px;
  margin: 0 auto;
}

.hero {
  max-width: 760px;
  margin: 0 auto 48px;
}

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.75rem;
  color: var(--muted);
}

.hero h1 {
  font-size: 2.6rem;
  margin: 8px 0;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--muted);
}

.section {
  max-width: 760px;
  margin: 32px auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.section h2 {
  margin-top: 0;
}

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

.link-list li {
  margin: 8px 0;
}

.cv-section,
.pub-section {
  margin: 32px 0;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.cv-section__header,
.pub-section__header {
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cv-entry,
.pub-entry,
.project-entry {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}

.cv-entry:first-child,
.pub-entry:first-child,
.project-entry:first-child {
  border-top: none;
}

.cv-entry__header,
.cv-role__header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  justify-content: space-between;
}

.cv-entry__title {
  margin: 0;
}

.cv-entry__meta,
.cv-meta,
.cv-role__dates {
  color: var(--muted);
  font-size: 0.95rem;
}

.cv-role {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.cv-role__title {
  font-weight: 600;
}

.pub-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 24px;
}

.pub-entry.is-highlight {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 10px;
  padding: 16px;
}

.pub-title {
  margin: 0 0 6px 0;
}

.pub-authors p,
.pub-notes p {
  margin: 0 0 6px 0;
}

.pub-meta {
  margin: 6px 0 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.pub-notes {
  margin-top: 10px;
}

.pub-credit {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, var(--border));
  font-size: 0.9rem;
}

.pub-credit strong {
  color: var(--ink);
}

.pub-meta-item + .pub-meta-item::before {
  content: " · ";
}

.pub-links {
  white-space: nowrap;
  align-self: start;
  color: var(--muted);
  font-size: 0.9rem;
}

.pub-intro {
  margin-bottom: 24px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.pub-intro,
.pub-intro-note {
  margin-bottom: 24px;
}

.pub-intro p,
.pub-intro-note p {
  margin: 0;
}

.pub-intro p + p,
.pub-intro-note p + p {
  margin-top: 0.5rem;
}

.pub-intro-note {
  padding: 12px 18px;
  border-left: 3px solid var(--border);
  background: color-mix(in srgb, var(--surface) 85%, var(--border));
  color: var(--muted);
  font-size: 0.95rem;
}

.project-summary {
  margin: 8px 0 10px;
}

.project-meta {
  margin: 0;
}

.project-meta-row {
  display: flex;
  gap: 10px;
  margin: 6px 0;
}

.project-meta-row dt {
  min-width: 70px;
  font-weight: 600;
  color: var(--muted);
}

.project-meta-row dd {
  margin: 0;
}

.project-links {
  margin: 10px 0 0;
}

.project-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.project-links a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .pub-entry {
    grid-template-columns: 1fr;
  }

  .pub-links {
    white-space: normal;
  }
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 48px;
  background: var(--header);
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon {
  display: none;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-icon-moon svg {
  fill: currentColor;
  stroke: none;
}

html[data-theme="light"] .theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun {
  display: inline-flex;
}

@media (max-width: 720px) {
  .page {
    padding: 36px 16px 56px;
  }

  .site-header .wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .site-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .site-nav a {
    margin-left: 0;
    margin-right: 12px;
    display: inline-block;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 2rem;
  }
}
