/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f5f7;
  --text: #1c1e21;
  --text-muted: #5b6270;
  --border: #e3e5e9;
  --accent: #2c5282;
  --accent-strong: #1a365d;
  --card-bg: #f7f8fa;
  --tag-bg: #eef1f6;
  --tag-text: #3a4258;
  --max-width: 46rem;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-alt: #1b1e24;
    --text: #e7e9ee;
    --text-muted: #9aa1ae;
    --border: #2b2f38;
    --accent: #7fb2ff;
    --accent-strong: #a9cbff;
    --card-bg: #1b1e24;
    --tag-bg: #232733;
    --tag-text: #c3cbdb;
  }
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

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

a {
  color: var(--accent);
}

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

img {
  max-width: 100%;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

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

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  font-size: 0.88rem;
  align-self: start;
}

@media (min-width: 55em) {
  .sidebar {
    position: sticky;
    top: 1.5rem;
  }
}

.sidebar__name {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.sidebar__bio {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar__links a {
  color: var(--text);
  text-decoration: none;
}

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

.sidebar__links .fa-fw,
.sidebar__links .ai-fw {
  color: var(--text-muted);
  width: 1.2em;
}

/* ---------- Layout ---------- */
.content-layout {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 55em) {
  .content-layout {
    grid-template-columns: 13rem 1fr;
    align-items: start;
  }
}

main {
  min-width: 0;
}

.prose {
  max-width: var(--max-width);
}

.prose h1 {
  font-size: 1.75rem;
  margin-top: 0;
}

.prose h2 {
  font-size: 1.35rem;
  margin-top: 2.2rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 1.1rem;
  margin-top: 1.6rem;
}

.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

.prose pre {
  background: var(--bg-alt);
  padding: 0.9rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
}

.prose code {
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.88em;
}

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

.prose .callout {
  background: var(--card-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.6rem 1rem;
  margin: 1.2rem 0;
}

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

.prose .footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Table of contents (eleventy-plugin-toc) */
.toc {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.3rem;
  margin: 1.5rem 0 2rem;
  font-size: 0.92rem;
}

.toc ol {
  margin: 0.3rem 0 0;
  padding-left: 1.2rem;
}

/* ---------- Page/post header ---------- */
.entry-header {
  margin-bottom: 1.5rem;
}

.entry-header h1 {
  margin-bottom: 0.4rem;
}

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

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.6rem 0 0;
}

.tag-list a {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  text-decoration: none;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
}

.tag-list a:hover {
  text-decoration: underline;
}

/* ---------- Hero / homepage ---------- */
.hero {
  background: linear-gradient(160deg, var(--accent-strong), var(--accent));
  color: #fff;
}

.hero__inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.hero h1 {
  font-size: 2.1rem;
  margin: 0 0 0.75rem;
}

.hero p {
  max-width: 42rem;
  font-size: 1.05rem;
  opacity: 0.95;
}

.hero a {
  color: #fff;
  text-decoration: underline;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  max-width: 60rem;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card .btn {
  display: inline-block;
  margin-top: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- Lists (blog index / publications index) ---------- */
.list-year {
  margin-top: 2.2rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
}

.post-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.post-list a {
  text-decoration: none;
  color: var(--text);
}

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

.post-list time {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.publi-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.publi-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.publi-plumx {
  flex: none;
}

.publi-item h3 {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
}

.publi-item h3 a {
  text-decoration: none;
  color: var(--text);
}

.publi-item .publi-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---------- Publication detail badges ---------- */
.publi-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.7rem 0 1.4rem;
}

.publi-badges a {
  color: inherit;
  text-decoration: none;
}

.publi-badges .ai {
  margin-right: 0.3em;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer__inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.8rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

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

@media (max-width: 40em) {
  html {
    font-size: 16px;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
}
