:root {
  --bg: #f4f1e8;
  --card: #fffdf8;
  --text: #2a2b28;
  --muted: #6d6f68;
  --accent: #4e7a5b;
  --accent-hover: #b4563b;
  --border: #e2dccd;
  --wallpaper-opacity: 0.12;
  --art-opacity: 0.7;
  --art-blend: multiply;
  --art-filter: none;
  --shadow: 0 2px 18px rgba(60, 50, 30, 0.08);
  --bg-opacity: 0.9;
  --bg-veil: color-mix(in srgb, var(--bg) calc((1 - var(--bg-opacity)) * 100%), transparent);
  --serif: Georgia, "Times New Roman", serif;
}

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

/* The pattern lives on the root element so it paints the entire canvas:
   it keeps repeating above, below, and beyond the page, including overscroll.
   The translucent colour layer on top reproduces --bg-opacity. */
html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-veil), var(--bg-veil)),
    url("../img/bg_grid.jpg");
  background-repeat: repeat;
  background-size: auto, 60% auto;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
a:hover, a:focus-visible { color: var(--accent-hover); border-bottom-color: currentColor; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 2.1rem; }
/* .section-heading lets a page's top-level <h1> share the h2 look. */
h2, .section-heading {
  font-size: 1.35rem;
  margin: 2.2rem -0.8rem 0.9rem;
  padding: 0.4rem 0.8rem;
}
h2:first-child, .section-heading:first-child { margin-top: 0; }

h2, .section-heading, .topbar {
  position: relative;
  border-radius: 4px;
}
h2::before, .section-heading::before, .topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: url("../img/tile.png") repeat center;
  background-size: 216px 216px;
  opacity: var(--wallpaper-opacity);
  mix-blend-mode:exclusion;
  pointer-events: none;
}
h3 { font-size: 1.08rem; margin: 1.3rem 0 0.3rem; }
p { margin: 0 0 1rem; }
ul { padding-left: 1.2rem; }
li { margin-bottom: 0.35rem; }
.muted { color: var(--muted); }
.placeholder { color: var(--muted); font-style: italic; }

.page {
  max-width: 960px;
  margin: 32px auto 48px;
  padding: 0 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: var(--shadow);
  padding: 24px 24px 22px;
  isolation: isolate;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  margin: 0 -0.8rem 28px;
  padding: 12px 0.8rem;
}
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--text); }
.brand:hover { color: var(--accent-hover); border-bottom-color: transparent; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.nav a { color: var(--muted); font-size: 0.95rem; padding-bottom: 2px; }
.nav a:hover { color: var(--accent-hover); }
.nav a[aria-current="page"] { color: var(--text); border-bottom: 2px solid var(--accent); }

.hero { display: flex; gap: 32px; align-items: flex-start; margin-bottom: 1.5rem; }
.hero .portrait {
  width: 190px;
  flex: 0 0 190px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.hero .portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 50%;
  transform: scale(var(--portrait-zoom, 1.4));
  transform-origin: 60% 100%;
  filter: saturate(5);
}

.hero-text { flex: 1 1 auto; min-width: 0; }

.hero-art {
  flex: 0 4 500px;
  min-width: 0;
  margin: 0;
}
.hero-art img {
  display: block;
  width: 100%;
  height: calc(240px * 4 / 3);
  object-fit: cover;
  opacity: var(--art-opacity);
  mix-blend-mode: var(--art-blend);
  filter: var(--art-filter);
  -webkit-mask-image: radial-gradient(ellipse closest-side at center, #000 50%, transparent 100%);
  mask-image: radial-gradient(ellipse closest-side at center, #000 50%, transparent 100%);
  pointer-events: none;
  user-select: none;
}

.hero-art figcaption {
  margin-top: -3rem;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.78rem;
  line-height: 1.1;
  color: var(--muted);
}
@media (max-width: 900px) { .hero-art { display: none; } }
.hero-text .title { color: var(--muted); margin: 0.35rem 0 0.9rem; font-size: 1.02rem; }

.links { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0; list-style: none; }
.links a { display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; }
.links svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }

.pub { margin-bottom: 1.6rem; }
.pub .pub-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin: 0 0 0.2rem; }
.pub .authors { margin: 0 0 0.15rem; font-size: 0.97rem; }
.pub .venue { color: var(--muted); font-size: 0.93rem; margin: 0 0 0.45rem; }
.pub .pub-links { font-size: 0.9rem; margin: 0 0 0.5rem; }
.pub .pub-links a + a::before { content: "·"; color: var(--muted); margin: 0 8px 0 0; }
.pub .pub-links a + a { margin-left: 8px; }
.pub .summary { margin: 0; }
.talks li { margin-bottom: 0.6rem; }

.footer {
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .page { margin-top: 16px; }
  .card { padding: 22px 18px 28px; border-radius: 8px; }
  .hero { flex-direction: column; gap: 18px; }
  .hero .portrait { width: 160px; flex-basis: auto; }
  h1 { font-size: 1.8rem; }
}
