:root {
  --bg: #fbfaf7;
  --card: #ffffff;
  --ink: #1b1b1a;
  --muted: #6a6964;
  --line: #e6e3dc;
  --link: var(--ink);
  --underline: #74213b;
  --button: #74213b;
  --button-text: #fbfaf7;
  --serif: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, 'Iowan Old Style', Georgia, serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --card: #1d1d1b;
    --ink: #e9e7e2;
    --muted: #9d9b95;
    --line: #2e2d2b;
    --link: var(--ink);
    --underline: #b0576d;
    --button: #7d2843;
    --button-text: #f3e9eb;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.1875rem/1.6 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page { max-width: 56rem; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

a { color: var(--link); text-decoration-color: var(--underline); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.25rem 0.5rem; }

/* Header */
.site-header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 4rem; }
.name { color: var(--ink); text-decoration: none; font-weight: 600; }
.lang { margin: 0; font-size: 0.85rem; letter-spacing: 0.04em; color: var(--muted); }
.lang a, .lang span { padding: 0.1rem 0.15rem; }
.lang span { color: var(--ink); }
.lang a { color: var(--muted); text-decoration: none; }
.lang a:hover { color: var(--ink); text-decoration: underline; }

/* Text */
h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h1 { font-size: 2rem; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 3.5rem 0 1rem; }
h3 { font-size: 1rem; margin: 2rem 0 0.4rem; }
p { margin: 0 0 1rem; }

.intro p:first-child { font-size: 1.3rem; line-height: 1.5; }

/* Keep running text at a comfortable line length on the wider page. */
.intro, .prose, .summary, .meta, .note, .project h1 { max-width: 38rem; }

/* Project cards */
.note { color: var(--muted); margin-bottom: 1.5rem; }
.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
}
.cards li { display: flex; }
.card {
  display: flex; flex-direction: column; width: 100%; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); text-decoration: none;
}
.card:hover { border-color: var(--muted); }
.card:hover .card-title { text-decoration: underline; text-decoration-color: var(--underline); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.card img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10;
  object-fit: cover; object-position: left top; border-bottom: 1px solid var(--line);
}
.card-body { display: block; padding: 1rem 1.1rem 1.2rem; }
.card-title { display: block; font-weight: 600; font-size: 1.1rem; color: var(--link); margin-bottom: 0.35rem; }
.card-text { display: block; font-size: 0.98rem; line-height: 1.55; }

/* Experience */
.cv { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.cv li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.cv li:last-child { border-bottom: 1px solid var(--line); }
.cv p { margin: 0; font-size: 1.02rem; }
.cv .cv-head { display: flex; justify-content: space-between; gap: 0 1rem; flex-wrap: wrap; margin-bottom: 0.2rem; }
.cv .dates { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }

.contact { margin: 0; }

/* Project page */
.back { font-size: 0.95rem; margin-bottom: 2.5rem; }
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--ink); text-decoration: underline; }
.summary { font-size: 1.3rem; line-height: 1.5; color: var(--muted); }
.meta { font-size: 0.95rem; color: var(--muted); margin-bottom: 2rem; }

figure { margin: 2rem 0; }
figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; }
.cover { margin-top: 0; max-width: 48rem; }

.next { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); }

.prose li { margin-bottom: 0.6rem; }
.prose ul { padding-left: 1.2rem; }

/* "Try it" / "Play it" button on project pages */
.button {
  display: inline-block; padding: 0.55rem 1.2rem; border-radius: 6px;
  background: var(--button); color: var(--button-text); text-decoration: none; font-weight: 600; font-size: 1.05rem;
}
.button:hover { filter: brightness(1.12); text-decoration: none; }
.source { margin-top: 2.5rem; font-size: 1rem; }

/* Projects that are not out yet */
.badge {
  display: inline-block; vertical-align: 0.15em; margin-left: 0.4rem; padding: 0.05rem 0.45rem;
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 0.72rem; font-weight: 400; letter-spacing: 0.03em; color: var(--muted);
}
.card.soon { background: transparent; border-style: dashed; }
.card.soon img { filter: grayscale(1); opacity: 0.55; }
.card.soon .card-title { color: var(--muted); }
.card.soon .card-text { color: var(--muted); }
.card.soon:hover img { filter: grayscale(0.4); opacity: 0.8; }

/* Secondary lines (education, languages) match the experience entries */
.small { font-size: 1.02rem; }
.cta { margin: 0 0 2rem; }

/* Portrait beside the intro; above it on small screens */
.intro { display: grid; gap: 1.25rem; align-items: start; }
.portrait { width: 7rem; height: 7rem; border-radius: 50%; object-fit: cover; }
@media (min-width: 44rem) {
  .intro { grid-template-columns: 1fr auto; max-width: 48rem; column-gap: 3rem; }
  .intro > div { grid-row: 1; grid-column: 1; }
  .portrait { grid-row: 1; grid-column: 2; width: 9rem; height: 9rem; margin-top: 0.4rem; }
}

/* Mushroom finds on the Forest Explorer page */
.strip { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.strip figcaption { flex-basis: 100%; }
.strip img { width: auto; max-width: 100%; height: 14rem; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.strip figcaption { grid-column: 1 / -1; }
@media (max-width: 30rem) { .strip img { height: 8rem; } }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.2rem; }

.outside { max-width: 38rem; margin: 1rem 0 0; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.cta-note { font-size: 0.92rem; color: var(--muted); }

/* Header menu */
.site-header { flex-wrap: wrap; row-gap: 0.5rem; }
.menu { display: flex; align-items: baseline; gap: 1.25rem; font-size: 0.95rem; }
.menu > a { color: var(--muted); text-decoration: none; }
.menu > a:hover { color: var(--ink); }
.menu > a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 0.35em; }
.menu .lang { margin-left: 0.5rem; padding-left: 1rem; border-left: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  .card.soon img { opacity: 0.22; }
  .card.soon:hover img { opacity: 0.4; }
}
