:root {
  --bg: #fcfcf9;
  --surface: #ffffff;
  --text: #171717;
  --muted: #626262;
  --border: #e7e5df;
  --accent: #0f766e;
  --accent-soft: #e6f3f1;
  --max-width: 72rem;
  --content-width: 42rem;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f;
    --surface: #1b1a17;
    --text: #f2f0ea;
    --muted: #a8a49b;
    --border: #33312c;
    --accent: #4fd1c5;
    --accent-soft: #14322f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(252, 252, 249, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.site-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.site-nav a,
.language-switcher a,
.language-current,
.language-muted {
  font-size: 0.92rem;
  text-decoration: none;
}

.language-switcher {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}

.language-current {
  font-weight: 700;
}

.language-muted {
  color: var(--muted);
}

.site-main {
  padding: 3rem 0 5rem;
}

.page-header,
.post-header {
  max-width: var(--content-width);
  margin-bottom: 2rem;
}

.eyebrow,
.post-meta,
.meta-label,
.site-footer p,
.site-footer a {
  font-size: 0.92rem;
  color: var(--muted);
}

.page-title {
  margin: 0.2rem 0 0;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 700;
  line-height: 1.1;
}

.page-intro {
  max-width: 38rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  gap: 3rem;
  align-items: start;
}

.content-main {
  min-width: 0;
}

.content-side {
  display: grid;
  gap: 1rem;
}

.side-block {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.post-list {
  display: grid;
  gap: 1.75rem;
}

.post-card {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-card-title {
  margin: 0.35rem 0 0.55rem;
  font-family: var(--font-serif);
  font-size: 1.7rem;
  line-height: 1.2;
}

.post-card-title a {
  text-decoration: none;
}

.post-card-excerpt {
  margin: 0;
  color: var(--muted);
}

.taxonomy-inline {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.taxonomy-inline a,
.text-link {
  color: var(--accent);
}

.meta-block {
  margin-bottom: 1rem;
}

.prose {
  max-width: var(--content-width);
  font-size: 1.04rem;
}

.prose > * + * {
  margin-top: 1rem;
}

.prose h2,
.prose h3,
.prose h4 {
  margin-top: 2.2rem;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.prose h2,
.prose h3 {
  font-family: var(--font-serif);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #f2f0ea;
  padding: 0.15rem 0.3rem;
  border-radius: 0.2rem;
}

.prose pre {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: #faf8f3;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.term-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: var(--content-width);
  border-top: 1px solid var(--border);
}

.term-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--border);
}

.search-shell {
  max-width: 60rem;
}

.search-shell .pagefind-ui {
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text);
  --pagefind-ui-background: var(--surface);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--accent-soft);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 6px;
  --pagefind-ui-font: var(--font-sans);
}

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 880px) {
  .header-inner,
  .footer-inner {
    flex-wrap: wrap;
    justify-content: flex-start;
    padding: 0.8rem 0;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(calc(100% - 1.25rem), var(--max-width));
  }

  .site-main {
    padding-top: 2rem;
  }

  .page-title {
    font-size: 2.15rem;
  }

  .post-card-title {
    font-size: 1.45rem;
  }

  .term-list-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ---------- Home hero ---------- */
.home-hero {
  max-width: var(--content-width);
  margin: 1rem 0 3.5rem;
}
.home-hero-name {
  margin: 0.4rem 0 0;
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
}
.home-hero-tagline {
  margin: 1rem 0 0;
  font-size: 1.2rem;
  color: var(--muted);
}
.home-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.75rem;
}
.home-cta a {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.home-cta a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Home sections ---------- */
.home-section { margin-top: 3rem; }
.home-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

/* ---------- Project grid & cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.25rem;
}
.project-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface);
}
.project-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.project-card-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}
.project-card-year { color: var(--muted); font-size: 0.9rem; }
.project-card-desc { margin: 0.6rem 0 0; color: var(--muted); }
.project-tags {
  list-style: none;
  padding: 0;
  margin: 0.9rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.project-tags li {
  font-size: 0.78rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.project-links { margin: 0.9rem 0 0; font-size: 0.92rem; }
.project-links a { color: var(--accent); }

/* ---------- CV ---------- */
.cv { max-width: var(--content-width); }
.cv-section { margin-top: 2.5rem; }
.cv-list { list-style: none; padding: 0; margin: 0; }
.cv-entry {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.cv-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cv-entry-title { font-weight: 700; }
.cv-entry-period { color: var(--muted); font-size: 0.9rem; }
.cv-entry-meta { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.cv-highlights { margin: 0.6rem 0 0; padding-left: 1.1rem; }
.cv-highlights li { margin-top: 0.3rem; }
.cv-skills { display: grid; gap: 1rem; }
.cv-skill-label { display: block; font-weight: 700; margin-bottom: 0.4rem; }
.chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chips li {
  font-size: 0.85rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.cv-langs { list-style: none; padding: 0; margin: 0; }
.cv-langs li { padding: 0.3rem 0; }

@media (max-width: 640px) {
  .home-section-head { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

