/* ==========================================================================
   Portfolio – one page, plain CSS

   HOW THIS FILE KEEPS THE DESIGN CALM
   - Fonts and colors: change them in the two :root blocks below, nowhere else.
   - Type scale: only six sizes are used (display, h2, h3, lead, body, small).
   - Text colors: only two (--text and --text-muted). The accent is reserved for
     things you can interact with (hover, focus, the highlighted phrase).
   - Spacing: everything uses the --s1 … --s7 steps (8px base).
   ========================================================================== */

/* Questrial (SIL Open Font License), self-hosted so no visitor data goes to Google */
@font-face {
  font-family: "Questrial";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/questrial-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Questrial";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/questrial-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* FONTS: Questrial has a single weight (400), so headings use 400 too. */
  --font-display: "Questrial", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Questrial", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* COLORS (light) */
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #e9edf0;
  --text: #14191f;
  --text-muted: #5b6672;
  --border: rgba(20, 25, 31, 0.13);
  --accent: #0f766e;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.14);
  --nav-bg: rgba(246, 247, 248, 0.85);

  /* Hero highlight + plant drawing */
  --highlight: #98d183;
  --highlight-text: #14191f;
  --plant-stem: #3f7d33;
  --plant-pot: #e39a6b;
  --plant-rim: #d4855a;
  --plant-pot-line: #8a4b2c;
  --plant-face: #4a2a1a;
  --plant-blush: #f2b8a8;
  --plant-petal: #f7c6d9;
  --plant-petal-line: #b5577e;
  --plant-center: #f6d36b;

  /* TYPE SCALE */
  --fs-display: clamp(2.5rem, 6.4vw, 4.5rem);
  --fs-h2: clamp(1.75rem, 3.2vw, 2.25rem);
  --fs-h3: 1.5rem;
  --fs-lead: clamp(1.125rem, 1.8vw, 1.375rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;

  /* SPACING (8px base) */
  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2rem;
  --s5: 3rem;
  --s6: 4.5rem;
  --s7: 7rem;
  --section-y: clamp(var(--s6), 9vw, var(--s7));

  /* LAYOUT */
  --wrap: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 14px;
  --nav-h: 68px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1318;
  --surface: #161d24;
  --surface-2: #1c252e;
  --text: #e8edf2;
  --text-muted: #9aa7b5;
  --border: rgba(232, 237, 242, 0.14);
  --accent: #5eead4;
  --accent-contrast: #062a26;
  --accent-soft: rgba(94, 234, 212, 0.16);
  --nav-bg: rgba(14, 19, 24, 0.85);
  --plant-stem: #7fc46a;
  --plant-pot-line: #f0b48e;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--s2));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute;
  left: var(--s2);
  top: -60px;
  z-index: 100;
  padding: var(--s1) var(--s2);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: var(--s1); }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Shared pieces ---------- */
.label {
  margin-bottom: var(--s2);
  font-family: var(--font-body);
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tags { display: flex; flex-wrap: wrap; gap: var(--s1); }
.tags li {
  padding: 0.1rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.35rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  border: 1.5px solid var(--text);
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* Placeholder for images. Delete once you use real <img> tags. */
.ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: var(--fs-small);
  color: var(--text-muted);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, var(--accent-soft) 14px 28px),
    var(--surface-2);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__inner { height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.nav__brand { font-family: var(--font-display); font-weight: 400; text-decoration: none; }

.nav__links { display: flex; align-items: center; gap: var(--s4); }
.nav__links a:not(.nav__cta) {
  padding: 0.25rem 0;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.nav__links a:not(.nav__cta):hover { color: var(--accent); }
.nav__links a[aria-current="true"]:not(.nav__cta) { border-bottom-color: var(--accent); }

.nav__cta {
  padding: 0.35rem 1.1rem;
  text-decoration: none;
  font-weight: 600;
  border: 1.5px solid var(--text);
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.nav__cta:hover,
.nav__cta[aria-current="true"] { background: var(--text); color: var(--bg); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: calc(-1 * var(--s1));
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.theme-toggle:hover { background: var(--accent-soft); }
.theme-toggle .icon { width: 1.3rem; height: 1.3rem; fill: currentColor; stroke: none; }
.theme-toggle .icon-sun { fill: none; stroke: currentColor; display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Hero ---------- */
/* 40px above the intro line and 40px from "Download CV" to the next section */
.hero { padding-top: 40px; }
.hero + .section { padding-top: 40px; }

.hero__intro { margin-bottom: var(--s4); font-size: var(--fs-body); }

/* headline and plant share one row; the plant drops below the headline when it doesn't fit */
.hero__headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  /* sized so the longest title still fits on one line next to the plant */
  font-size: clamp(2.25rem, 4.3vw, 3.75rem);
}
.hero h1 { font-size: 1em; font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; text-wrap: wrap; }

.cv-link {
  display: inline-block;
  margin-top: var(--s4);
  font-size: var(--fs-lead);
  line-height: 1.05;             /* so the hover highlight hugs the letters */
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  border-radius: 2px;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.cv-link:hover { background: var(--highlight); color: var(--highlight-text); }

/* the changing title, highlighted in green */
.grow__word {
  display: inline-block;
  padding: 0 0.12em;
  border-radius: 0.12em;
  color: var(--highlight-text);
  background: var(--highlight);
  white-space: nowrap;
}
.grow__caret {
  display: inline-block;
  width: 0.06em;
  height: 0.9em;
  margin-left: 0.04em;
  vertical-align: -0.08em;
  background: currentColor;
  animation: caret-blink 1s steps(1) infinite;
}
.grow__word.is-typing .grow__caret { animation: none; }
@keyframes caret-blink { 50% { opacity: 0; } }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Plant ---------- */
/* about as tall as the headline; it grows wide (bushy) rather than tall */
.plant { flex: none; height: 1.75em; }
.plant__svg { display: block; height: 100%; width: auto; overflow: visible; }

.plant__sway { transform-origin: 120px 110px; animation: sway 6s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

/* stems are drawn in when their stage is reached (script.js adds .is-on) */
.plant__stem {
  fill: none;
  stroke: var(--plant-stem);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.4s var(--ease);
}
.plant__stem.is-on { stroke-dashoffset: 0; transition: stroke-dashoffset 0.8s var(--ease); }
.plant__leaf, .plant__petal { fill: var(--highlight); stroke: var(--plant-stem); stroke-width: 2.5; stroke-linejoin: round; }
.plant__vein { fill: none; stroke: var(--plant-stem); stroke-width: 2; stroke-linecap: round; }
.plant__petal { fill: var(--plant-petal); stroke: var(--plant-petal-line); }
.plant__center { fill: var(--plant-center); stroke: var(--plant-petal-line); stroke-width: 2.5; }

/* parts pop in when their stage is reached (script.js adds .is-on) */
.plant [data-s] {
  transform-origin: 0 0;
  transform: scale(0);
  transition: transform 0.5s var(--ease);
}
.plant [data-s].is-on { transform: scale(1); transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s; }

.plant__pot { fill: var(--plant-pot); stroke: var(--plant-pot-line); stroke-width: 2.5; stroke-linejoin: round; }
.plant__rim { fill: var(--plant-rim); stroke: var(--plant-pot-line); stroke-width: 2.5; }
.plant__eyes circle { fill: var(--plant-face); }
.plant__eyes { transform-origin: 120px 133px; animation: blink 5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
.plant__smile { fill: none; stroke: var(--plant-face); stroke-width: 2.5; stroke-linecap: round; }
.plant__blush { fill: var(--plant-blush); }

/* ---------- Sections ---------- */
.section { padding-top: var(--section-y); }
.section__title { margin-bottom: var(--s5); font-size: var(--fs-h2); font-weight: 400; letter-spacing: -0.015em; }
.section__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s2); }

/* Selected projects heading: on hover it turns into "Show me all projects" */
.title-swap {
  display: inline-grid;
  text-decoration: none;
  overflow: hidden;
  padding-bottom: 0.08em;            /* room for descenders */
}
.title-swap > span { grid-area: 1 / 1; transition: transform 0.45s var(--ease), opacity 0.3s ease; }
.title-swap__b {
  justify-self: start;
  padding: 0 0.15em;
  margin-left: -0.15em;
  border-radius: 0.12em;
  color: var(--highlight-text);
  background: var(--highlight);
  transform: translateY(105%);
  opacity: 0;
}
.title-swap__arrow { display: inline-block; }
.title-swap:hover .title-swap__a,
.title-swap:focus-visible .title-swap__a { transform: translateY(-105%); opacity: 0; }
.title-swap:hover .title-swap__b,
.title-swap:focus-visible .title-swap__b { transform: none; opacity: 1; }
.title-swap:hover .title-swap__arrow { animation: nudge 1s var(--ease) infinite; }
@keyframes nudge { 50% { transform: translateY(0.12em); } }

/* Slider: one project at a time, native swipe + scroll snapping */
.slider {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
}
.slider__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  border-radius: var(--radius);
}
.slider__track::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--s5);
  align-items: center;
  scroll-snap-align: start;
  padding: var(--s1);                /* keeps the focus ring inside the track */
}
.slide__media { aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); }
.slide__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }

.slider__dots { display: flex; justify-content: center; gap: 0.6rem; margin-top: var(--s4); }
.slider__dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 1.5px solid var(--text-muted);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: width 0.35s var(--ease), background-color 0.2s ease, border-color 0.2s ease;
}
.slider__dot[aria-current="true"] { width: 28px; background: var(--highlight); border-color: var(--plant-stem); }

.project__meta { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s1); font-size: var(--fs-small); color: var(--text-muted); }
.project__index { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.project__meta span + span::before { content: "·"; margin-right: var(--s2); }
.project__meta .project__index + span::before { content: none; margin: 0; }

.slide h3 { font-size: var(--fs-h3); font-weight: 400; letter-spacing: -0.01em; }
.project__link { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size 0.4s var(--ease); }
/* the whole slide is clickable through the title link */
.project__link::after { content: ""; position: absolute; inset: 0; }
.project__link:focus-visible { outline: none; }
.project__link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--radius); }

.project__summary { margin-top: var(--s2); color: var(--text-muted); }

.facts { display: grid; gap: var(--s1); margin: var(--s3) 0; }
.facts div { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: var(--s2); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--text-muted); }

.project__cta { display: inline-flex; align-items: center; gap: var(--s1); margin-top: var(--s3); font-weight: 600; }
.project__arrow { display: inline-block; transition: transform 0.35s var(--ease); }

@media (hover: hover) {
  .slide:hover .slide__media img { transform: scale(1.04); }
  .slide:hover .project__link { background-size: 100% 2px; }
  .slide:hover .project__cta { color: var(--accent); }
  .slide:hover .project__arrow { transform: translateX(6px); }
}

/* Research: stacked publication cards */
.papers { display: grid; gap: var(--s2); }
.paper {
  position: relative;
  display: grid;
  gap: var(--s1);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.35s var(--ease);
}
.paper:hover { border-color: var(--plant-stem); }
.paper__venue { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); font-size: var(--fs-small); color: var(--text-muted); letter-spacing: 0.04em; }
.paper__badge { padding: 0.05rem 0.6rem; border-radius: 999px; color: var(--highlight-text); background: var(--highlight); letter-spacing: 0; }
.paper__title { font-size: var(--fs-h3); font-weight: 400; letter-spacing: -0.01em; max-width: 46rem; }
.paper__authors { color: var(--text-muted); }
.paper__links { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s1); font-weight: 600; }
.paper__links a { text-underline-offset: 4px; }
.paper__links a:hover { color: var(--accent); }

/* About me: round photo, text, contact card */
.about {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 22rem);
  gap: var(--s5);
  align-items: center;
}
.about__photo {
  width: clamp(140px, 16vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 8px var(--highlight);
}
.about__photo--ph {
  display: grid;
  place-items: center;
  font-size: var(--fs-small);
  color: var(--text-muted);
  background: repeating-linear-gradient(135deg, transparent 0 14px, var(--accent-soft) 14px 28px), var(--surface-2);
}
.prose { max-width: 36rem; }
.prose p + p { margin-top: var(--s2); }

.contact-card {
  padding: var(--s4);
  border-radius: calc(var(--radius) * 1.5);
  color: var(--highlight-text);
  background: var(--highlight);
}
.contact-card h3 { font-size: var(--fs-h3); font-weight: 400; }
.contact-card p { margin-top: var(--s1); }
.contact-card__links { display: grid; gap: 0.4rem; margin-top: var(--s3); }
.contact-card__links a {
  overflow-wrap: anywhere;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}
.contact-card__links a:hover { background: var(--bg); color: var(--text); }

/* Education & experience: a toggle with a table-like list */
.cv { margin-top: var(--s6); border-block: 1px solid var(--border); }
.cv__toggle {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding-block: var(--s3);
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  cursor: pointer;
  list-style: none;
  transition: color 0.2s ease;
}
.cv__toggle::-webkit-details-marker { display: none; }
.cv__toggle:hover { color: var(--accent); }
.cv__chevron {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 50%;
  background: var(--highlight);
  color: var(--highlight-text);
  transition: transform 0.35s var(--ease);
}
.cv[open] .cv__chevron { transform: rotate(90deg); }
.cv__body { padding-bottom: var(--s5); }
.cv__body .label { margin-top: var(--s4); }
.cv[open] .cv__body { animation: cv-open 0.45s var(--ease); }
@keyframes cv-open { from { opacity: 0; transform: translateY(-8px); } }

.rows { border-bottom: 1px solid var(--border); }
.rows > li, .rows > div {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr) 10rem;
  gap: var(--s3);
  padding-block: var(--s2);
  border-top: 1px solid var(--border);
}
.rows__when, .rows dt { padding-top: 0.15rem; font-size: var(--fs-small); color: var(--text-muted); }
.rows__where { padding-top: 0.15rem; font-size: var(--fs-small); color: var(--text-muted); text-align: right; }
.rows__what strong { display: block; font-weight: 400; font-size: 1.125rem; line-height: 1.4; }
.rows__what > span { display: block; color: var(--text-muted); }
.rows__points { margin-top: var(--s1); padding-left: 1.1em; list-style: disc; font-size: var(--fs-small); color: var(--text-muted); }
.rows__points li + li { margin-top: 0.3em; }
.rows__points li::marker { color: var(--plant-stem); }
.rows--skills > div { grid-template-columns: 10rem minmax(0, 1fr); }
.rows--skills dd { margin: 0; }

/* Project gallery: bursts out while scrolling in (--burst: 0 → 1). It starts small and faded,
   then grows past the normal content width until it spans the whole screen. */
.burst { --burst: 1; margin-top: var(--section-y); overflow-x: clip; }
.burst__panel {
  padding-block: var(--s4) var(--s6);
  transform: scale(calc(0.55 + 0.45 * var(--burst)));
  transform-origin: 50% 0;
  opacity: calc(0.25 + 0.75 * var(--burst));
  will-change: transform, opacity;
}
.burst .wrap {
  --w0: min(var(--wrap), 100% - 2 * var(--gutter));
  width: calc(var(--w0) + (100% - 2 * var(--gutter) - var(--w0)) * var(--burst));
}
/* fixed column count, so cards grow instead of jumping between columns while it bursts */
.pinboard { columns: 3; column-gap: calc(var(--s2) + var(--s2) * var(--burst)); }
.pin {
  position: relative;
  display: block;
  break-inside: avoid;
  margin-bottom: var(--s3);
  overflow: hidden;
  text-decoration: none;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.pin img { width: 100%; height: auto; transition: transform 0.7s var(--ease); }
.pin__text { display: grid; gap: 0.15rem; padding: var(--s2) var(--s3) var(--s3); }
.pin__text strong { font-weight: 400; font-size: 1.25rem; }
.pin__text span { font-size: var(--fs-small); color: var(--text-muted); }
.pin--text p { padding: 0 var(--s3) var(--s3); color: var(--text-muted); }
.pin--text .pin__text { padding-top: var(--s3); }
@media (hover: hover) {
  a.pin:hover { transform: translateY(-4px); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.25); }
  a.pin:hover img { transform: scale(1.04); }
}

/* Footer */
.footer { border-top: 1px solid var(--border); }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); padding-block: var(--s3); }
.footer p { color: var(--text-muted); font-size: var(--fs-small); }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin-right: auto; font-size: var(--fs-small); }
.footer__links a { text-underline-offset: 4px; }
.footer__links a:hover { color: var(--accent); }
.to-top {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.to-top:hover { border-color: var(--accent); color: var(--accent); }

/* Legal pages (imprint, privacy) */
.legal { max-width: 46rem; padding-block: var(--s5) var(--section-y); }
.legal h1 { font-size: var(--fs-h2); font-weight: 400; letter-spacing: -0.015em; margin-bottom: var(--s4); }
.legal h2 { margin-top: var(--s5); margin-bottom: var(--s1); font-size: var(--fs-h3); font-weight: 400; }
.legal h3 { margin-top: var(--s3); margin-bottom: 0.25rem; font-size: var(--fs-body); font-weight: 400; color: var(--text-muted); }
.legal p + p, .legal ul + p, .legal p + ul { margin-top: var(--s2); }
.legal ul { padding-left: 1.25em; list-style: disc; }
.legal li + li { margin-top: 0.3em; }
.legal a { text-underline-offset: 3px; text-decoration-color: var(--plant-stem); }
.legal a:hover { color: var(--accent); }
.legal__updated { margin-top: var(--s5); font-size: var(--fs-small); color: var(--text-muted); }

/* ---------- Case study pages (work/*.html) ---------- */
.case { padding-block: var(--s4) var(--section-y); }

.case__back {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  margin-bottom: var(--s4);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}
.case__back:hover { color: var(--accent); }

.case__head { max-width: 50rem; }
.case__head .project__meta { margin-bottom: var(--s2); }
.case__head h1 { font-size: var(--fs-display); font-weight: 400; letter-spacing: -0.025em; line-height: 1.05; }

.case__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: var(--s3) var(--s4);
  margin: var(--s5) 0 0;
  padding-block: var(--s3);
  border-block: 1px solid var(--border);
}
.case__facts dt { margin-bottom: 0.25rem; font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.case__facts dd { margin: 0; }

.case__links { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }

/* A section: heading on the left, text and figures on the right */
.case__section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
  gap: var(--s2) var(--s5);
  padding-top: var(--s6);
}
.case__section > h2 { font-size: var(--fs-h3); font-weight: 400; letter-spacing: -0.01em; }

.prose ul, .prose ol { padding-left: 1.25em; margin-top: var(--s2); }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--text-muted); }
.prose h3 { margin-top: var(--s4); margin-bottom: var(--s1); font-size: var(--fs-body); font-weight: 700; }
.prose * + p, .prose ul + p, .prose ol + p { margin-top: var(--s2); }
.prose a { text-underline-offset: 3px; text-decoration-color: var(--accent); }
.prose a:hover { color: var(--accent); }

/* Figures: images and videos with captions */
.figure { margin: var(--s4) 0 0; }
.case__cover { margin-top: var(--s5); }
.figure img, .figure video {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.figure figcaption { margin-top: var(--s1); font-size: var(--fs-small); color: var(--text-muted); }
.figure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.figure-grid .figure { margin: 0; }

/* Small bar chart for questionnaire scores */
.scores { display: grid; gap: 0.6rem; margin-top: var(--s3); max-width: 34rem; }
.scores__row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) 2.25rem; align-items: center; gap: var(--s2); font-size: var(--fs-small); }
.scores__bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.scores__bar span { display: block; height: 100%; width: calc(var(--v) / 3 * 100%); background: var(--accent); border-radius: inherit; }
.scores__row b { text-align: right; font-variant-numeric: tabular-nums; }
.scores__note { margin-top: var(--s1); font-size: var(--fs-small); color: var(--text-muted); }

/* Next project link at the bottom of a case study */
.case__next {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s1) var(--s3);
  margin-top: var(--s6);
  padding-block: var(--s4);
  border-block: 1px solid var(--border);
  text-decoration: none;
}
.case__next span { font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.case__next strong { font-family: var(--font-display); font-size: var(--fs-h2); letter-spacing: -0.015em; transition: color 0.2s ease; }
.case__next:hover strong { color: var(--accent); }

/* ---------- Reveal on scroll (only when JS runs) ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .about { grid-template-columns: auto minmax(0, 1fr); }
  .contact-card { grid-column: 1 / -1; }
  .slide { grid-template-columns: 1fr; gap: var(--s3); }
  .rows > li { grid-template-columns: 8rem minmax(0, 1fr); }
  .rows__where { display: none; }
  .pinboard { columns: 2; }
  .case__section { grid-template-columns: 1fr; padding-top: var(--s5); }
}
@media (max-width: 640px) {
  .nav__brand { display: none; }
  .nav__inner { justify-content: flex-end; }
  .nav__links { gap: var(--s2); font-size: var(--fs-small); }
  .nav__cta { padding: 0.25rem 0.8rem; }
  .hero__intro { margin-bottom: var(--s3); }
  .facts div { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .slider { grid-template-columns: 1fr; }
  .slider__btn { display: none; } /* swipe or use the dots */
  .about { grid-template-columns: 1fr; gap: var(--s4); }
  .rows > li, .rows--skills > div { grid-template-columns: 1fr; gap: 0.25rem; }
  .paper { padding: var(--s3); }
  .pinboard { columns: 1; }
  .figure-grid { grid-template-columns: 1fr; }
  .scores__row { grid-template-columns: 6.5rem minmax(0, 1fr) 2rem; gap: var(--s1); }
}
@media (max-width: 360px) {
  .nav__links { gap: 0.75rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
