/* ── et-book font (Tufte) ── */
@font-face {
  font-family: "et-book";
  src: url("https://edwardtufte.github.io/tufte-css/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("https://edwardtufte.github.io/tufte-css/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "et-book";
  src: url("https://edwardtufte.github.io/tufte-css/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ── */
:root {
  --gap: 24px;
  --content-gap: 20px;
  --nav-width: 1024px;
  --main-width: 720px;
  --header-height: 60px;
  --footer-height: 60px;
  --radius: 8px;
  --offset: 3px;

  --theme: #fffff8;
  --entry: #ffffff;
  --primary: #1e1e1e;
  --secondary: #7e7e7e;
  --tertiary: #d6d6d6;
  --content: #1f1f1f;
  --code-bg: #f4f4ec;
  --border: #eeeeee;
  --link-hover: rgba(188, 230, 173, 0.462);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --theme: rgb(29, 30, 32);
  --entry: rgb(46, 46, 51);
  --primary: rgb(218, 218, 219);
  --secondary: rgb(155, 156, 157);
  --tertiary: rgb(65, 66, 68);
  --content: rgb(196, 196, 197);
  --code-bg: rgb(55, 56, 62);
  --border: rgb(51, 51, 51);
  --link-hover: rgba(120, 170, 240, 0.18);
  color-scheme: dark;
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
}
body, figure, ul, p, h1, h2, h3, h4, h5, h6 {
  margin: 0;
  padding: 0;
}
ul { list-style: none; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-y: scroll;
}

body {
  font-family: "et-book", "Newsreader", Palatino, "Book Antiqua", Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  background: var(--theme);
  color: var(--primary);
  word-break: break-word;
  margin: 0 var(--gap);
  padding: 0 var(--gap);
}

a, button, h1, h2, h3, h4, h5, h6 {
  color: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 600;
}

h1 { font-size: 3.5rem; margin-top: 3rem; margin-bottom: 1.5rem; line-height: 1; }
h2 { font-size: 1.7rem; margin-top: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; font-weight: 500; }

p { margin-bottom: 1rem; }

/* ── Header / Nav ── */
.header {
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  max-width: calc(var(--nav-width) + var(--gap) * 2);
  margin: 0 auto;
  line-height: var(--header-height);
}
.logo, #menu {
  display: flex;
  margin: auto var(--gap);
}
.logo {
  align-items: center;
  gap: 8px;
}
.logo a {
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}
.logo-switches {
  display: inline-flex;
  align-items: center;
}
#theme-toggle {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 6px;
  display: inline-flex;
  align-items: center;
}
#theme-toggle svg { display: block; }
:root #sun { display: none; }
:root[data-theme="dark"] #moon { display: none; }
:root[data-theme="dark"] #sun { display: block; }

#menu {
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
#menu a {
  text-decoration: none;
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
}
#menu a:hover .active,
#menu a:hover span {
  background-color: var(--link-hover);
  border-radius: var(--radius);
  padding: var(--offset);
}
#menu .active {
  font-weight: 600;
}
/* Sit the mark on the text baseline like a glyph rather than centring it on
   the 60px nav line box, which reads high against lowercase serif type. */
#menu .menu-icon {
  display: inline-block;
  padding: var(--offset);
  border-radius: var(--radius);
  transition: background-color 0.2s ease-in-out;
}
#menu .menu-icon svg {
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.22em;
}
#menu .menu-icon:hover {
  background-color: var(--link-hover);
}

/* ── Main ── */
.main {
  position: relative;
  min-height: calc(100vh - var(--header-height) - var(--footer-height));
  max-width: calc(var(--main-width) + var(--gap) * 2);
  margin: 0 auto;
  padding: var(--gap);
}

/* ── Home / Hero ── */
.home-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--theme);
}
.home-info .entry-content {
  flex: 1;
}
.home-info .entry-content p {
  font-size: 1.1rem;
  line-height: 1.4;
  color: var(--content);
  margin-bottom: 1.1rem;
  text-align: left;
}
.home-info .entry-content pre,
.home-info .entry-content a.email {
  display: inline-block;
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--content);
  margin: 5px 0 0;
  padding: 0.45rem 0.8rem;
  background: var(--code-bg);
  border: 1px solid var(--tertiary);
  border-radius: 6px;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Email chip: same box as the <pre> it replaced, with the icon set inline. */
.home-info .entry-content a.email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
}
.home-info .entry-content a.email:hover {
  background: var(--link-hover);
  text-decoration: none;
}
.home-info .entry-content a.email svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.home-info .profile-picture {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-info .profile-picture img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--tertiary);
}

/* ── Custom underlines (Tufte-style) ── */
.home-info .entry-content a,
.news-item a,
.news-page-items a,
.talk-item a,
.publication-list a,
.misc-content a,
.post-description a,
.section-more a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: var(--offset);
  padding: var(--offset);
  border-radius: var(--radius);
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.home-info .entry-content a:hover,
.news-item a:hover,
.news-page-items a:hover,
.talk-item a:hover,
.publication-list a:hover,
.misc-content a:hover,
.post-description a:hover,
.section-more a:hover {
  background-color: var(--link-hover);
  text-decoration-thickness: 1.5px;
}

/* ── Page header ── */
.page-header {
  margin: 24px auto var(--content-gap);
}
.page-header h1 {
  font-size: 2.4rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.post-description {
  color: var(--secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
}

/* ── Section ── */
.section {
  margin-bottom: 3rem;
}

/* ── News ── */
.news-list { margin: 1rem 0; }
.news-page-items {
  list-style: none;
  padding: 0;
  margin: 0;
}
.news-item {
  display: flex;
  align-items: baseline;
  gap: var(--gap);
  margin-bottom: 0.6rem;
  padding: 4px 0;
  font-size: 1rem;
}
/* Fixed 20ch gutter — the longest date ("Nov 2025 - Jan 2026") is 19 monospace
   characters, so every entry's text starts on the same left edge. */
.news-date {
  color: var(--secondary);
  flex-shrink: 0;
  font-family: monospace;
  font-size: 0.9rem;
  min-width: 20ch;
  white-space: nowrap;
}
.news-title {
  flex-grow: 1;
  color: var(--primary);
  font-weight: 500;
}

/* ── Publications ── */
.publication-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 1rem 0;
}
.publication-item {
  display: flex;
  gap: 1.5rem;
  background: var(--entry);
  padding: var(--gap);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10);
}
:root[data-theme="dark"] .publication-item {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.publication-image {
  flex: 0 0 150px;
  max-width: 150px;
}
.publication-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}
.publication-content {
  flex: 1;
  line-height: 1.3;
}
.publication-title {
  margin-bottom: 8px;
}
.publication-title a,
.publication-title span {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.publication-title a:hover {
  text-decoration: underline;
}
.publication-authors,
.publication-venue,
.publication-summary {
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 4px;
}
.publication-authors {
  color: var(--secondary);
  font-weight: 300;
}
.publication-venue {
  font-style: italic;
  color: var(--secondary);
  font-weight: 300;
}
.publication-content {
  font-weight: 300;
}
.author-highlight {
  font-weight: 700;
  text-decoration: underline;
}
.publication-summary {
  color: var(--content);
}
.publication-resources {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.publication-resources a {
  color: #06c;
  text-decoration: none;
}
:root[data-theme="dark"] .publication-resources a {
  color: rgb(120, 170, 240);
}
.publication-resources a:hover {
  text-decoration: underline;
}

/* ── Talks ── */
.talk-item {
  display: flex;
  align-items: baseline;
  gap: var(--gap);
  margin-bottom: 0.5rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1.7;
}
.talk-date {
  color: var(--secondary);
  flex-shrink: 0;
  font-family: monospace;
  font-size: 0.9rem;
  min-width: 20ch;
  white-space: nowrap;
}
.talk-title {
  flex-grow: 1;
  font-weight: 500;
  color: var(--primary);
}

/* ── Misc ── */
.misc-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--content);
}

/* ── Footer / Social ── */
.entry-footer {
  margin-top: 1rem;
}
.social-icons {
  display: flex;
  flex-wrap: wrap;
}
.social-icons a {
  display: inline-flex;
  padding: 10px;
  color: var(--primary);
}
.social-icons a svg {
  height: 26px;
  width: 26px;
}

.footer {
  text-align: center;
  padding: 24px 0;
  font-size: 13px;
  color: var(--secondary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --gap: 14px; }

  body { font-size: 17px; }

  h1 { font-size: 2.4rem; }

  .home-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0 2rem;
  }
  .home-info .entry-content p { text-align: left; }
  .home-info .profile-picture img {
    width: 160px;
    height: 160px;
  }

  .publication-item {
    flex-direction: column;
    gap: 1rem;
  }
  .publication-image {
    flex: none;
    max-width: 100%;
  }

  .news-item, .talk-item {
    flex-direction: column;
    gap: 2px;
  }
}
