/* Personal site layout. Original CSS; not derived from gitfolio, a Jekyll theme, or rubenkuipers.design.
   Type: Figtree (SIL Open Font License), a free stand-in for the heavy geometric sans on rubenkuipers.design. */

@font-face {
  font-family: "Figtree";
  src: url("../assets/fonts/figtree-latin-wght.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f0e8;
  --ink: #1b2330;
  --muted: #5a6370;
  --line: #e0d6c6;
  --card: #fffcf8;
  --rust: #7c341f;
  --ridge: #1a3948;
  --ridge-2: #24566a;
  --tint-1: #ece3d0;
  --tint-2: #dfe7e1;
  --tint-3: #dce6eb;
  --tint-4: #efddd2;
  --sans: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --page-max: clamp(1160px, 80vw, 1600px);
  --gutter: clamp(1.25rem, 3.5vw, 2.5rem);
  --gap: clamp(1rem, 2.2vw, 1.75rem);
  --shadow: 0 10px 30px rgba(27, 35, 48, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: clamp(1.0625rem, 0.15vw + 1rem, 1.1875rem);
  line-height: 1.65;
}

img { max-width: 100%; height: auto; }

a { color: var(--rust); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--ridge); }
.wrap a, .site-footer a { overflow-wrap: anywhere; }

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--ink);
  color: white;
  padding: 0.4rem 0.7rem;
  z-index: 10;
}
.skip:focus { top: 0.5rem; }

/* ---------- Shared frame: header, container, footer ---------- */
.site-header {
  background: rgb(244 240 232 / 0.86);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid rgb(27 35 48 / 0.09);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner, .wrap, .site-footer .wrap {
  width: min(100% - 2 * var(--gutter), var(--page-max));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.brand span {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.3rem; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.nav a:hover { background: rgb(27 35 48 / 0.07); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.nav-toggle { display: none; }

main { padding: 2.5rem 0 4rem; position: relative; }
main:has(> .page-head) { padding-top: 0; }

h1, h2, h3 { font-family: var(--sans); font-weight: 800; line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2rem, 1.2rem + 2.4vw, 3.25rem); font-weight: 900; letter-spacing: -0.015em; margin: 0 0 0.5rem; }
h2 { font-size: clamp(1.45rem, 1.1rem + 0.9vw, 2rem); margin: 2.4rem 0 0.7rem; letter-spacing: -0.01em; }
h3 { font-size: 1.3rem; margin: 1.5rem 0 0.4rem; letter-spacing: -0.005em; }

.kicker, .tagline { color: var(--muted); }
.kicker { font-weight: 600; margin: 0 0 0.4rem; }
.tagline { font-size: 1.2rem; font-weight: 600; margin: 0 0 1rem; }

.eyebrow {
  margin: 0 0 1.1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.portrait {
  width: 100%;
  display: block;
  border-radius: 14px;
  background: var(--paper);
}

.caption { color: var(--muted); font-size: 0.92rem; margin: 0.35rem 0 0; }

.social { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 1rem 0; }
.social a { display: block; width: 34px; height: 34px; text-decoration: none; }
.social a img { width: 34px; height: 34px; display: block; }
.social a:hover { opacity: 0.75; }

.page-banner {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
}

/* ---------- Cards: one style for every page ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--gap);
  margin: 1rem 0 0;
}
.card {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  padding: clamp(1.25rem, 2vw, 1.75rem);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card img { display: block; width: 100%; height: auto; border-radius: 10px; }
.card img:first-child { margin: 0 0 1.1rem; }
.card img:last-child:not(:first-child) { margin: 1.1rem 0 0; }
.card picture { display: block; margin-top: 1.1rem; }
.card picture > img:first-child { margin: 0; }
.card video { display: block; width: 100%; height: auto; margin: 1.1rem 0 0; border-radius: 10px; background: #fff; }
.card h3 { margin: 0 0 0.4rem; font-size: clamp(1.3rem, 1.1rem + 0.6vw, 1.7rem); line-height: 1.15; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 18px; }
.card p { margin: 0 0 0.6rem; color: var(--muted); }
.card .links { margin-top: auto; font-size: 0.95rem; font-weight: 600; position: relative; z-index: 1; }
.card .links a { margin-right: 1rem; }
.card:has(h3 a):hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cards .card:nth-child(4n+1) { background: var(--tint-1); }
.cards .card:nth-child(4n+2) { background: var(--tint-2); }
.cards .card:nth-child(4n+3) { background: var(--tint-3); }
.cards .card:nth-child(4n)   { background: var(--tint-4); }
.lede { font-size: 1.2rem; max-width: 40rem; margin: 0 0 1.5rem; color: var(--muted); }
.page-banner + h1 { margin-top: clamp(1.5rem, 3vw, 2.25rem); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--gap) clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  margin-top: 1rem;
}
.split figure { margin: 0; }
.split figure img { width: 100%; height: auto; display: block; border-radius: 14px; }
.split .prose { max-width: none; }
.split .tagline { margin-top: 0; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
/* Two columns, the right one dropped: the cards on rubenkuipers.design. */
.stagger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
  margin-top: 1rem;
}
.stagger-col { display: flex; flex-direction: column; gap: var(--gap); }
.stagger-col + .stagger-col { margin-top: clamp(3rem, 8vw, 7rem); }
.stagger-col:first-child .card:nth-child(4n+1) { background: var(--tint-1); }
.stagger-col:first-child .card:nth-child(4n+2) { background: var(--tint-2); }
.stagger-col:first-child .card:nth-child(4n+3) { background: var(--tint-3); }
.stagger-col:first-child .card:nth-child(4n)   { background: var(--tint-4); }
.stagger-col + .stagger-col .card:nth-child(4n+1) { background: var(--tint-3); }
.stagger-col + .stagger-col .card:nth-child(4n+2) { background: var(--tint-4); }
.stagger-col + .stagger-col .card:nth-child(4n+3) { background: var(--tint-1); }
.stagger-col + .stagger-col .card:nth-child(4n)   { background: var(--tint-2); }

/* Slide up as each card scrolls into view (js/reveal.js adds .is-in). */
.js .stagger .card {
  opacity: 0;
  transform: translateY(2.4rem);
  transition: opacity 0.8s ease, transform 0.8s ease, box-shadow 0.25s ease;
}
.js .stagger .card.is-in { opacity: 1; transform: none; }
.js .stagger .card.is-in:has(h3 a):hover { transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) {
  .js .stagger .card { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
@media print {
  .js .stagger .card { opacity: 1; transform: none; }
}

/* ---------- Front page (body.home) ---------- */
body.home main { padding: 0; }

.home-hero { position: relative; }
.home-intro {
  display: grid;
  grid-template-columns: minmax(180px, 30%) minmax(0, 1fr);
  align-items: end;
  column-gap: clamp(1.5rem, 4vw, 4rem);
  width: min(100% - 2 * var(--gutter), var(--page-max));
  margin: 0 auto;
  border-bottom: 1px solid rgb(27 35 48 / 0.25);
}
.intro-portrait { display: block; width: 100%; max-width: clamp(320px, 24vw, 500px); height: auto; }
.intro-text { align-self: center; min-width: 0; padding: clamp(2.5rem, 5vw, 4.5rem) 0 clamp(2rem, 4vw, 3.5rem); }
.intro-text h1 { margin: 0 0 0.25em; font-size: clamp(2.1rem, 1.3rem + 3vw, 4.25rem); text-wrap: balance; }
.intro-text .nb { white-space: nowrap; }
.intro-text .tagline { margin: 0 0 0.7rem; }
.tagline .sep { margin: 0 0.35em; font-weight: 400; opacity: 0.55; }
.intro-text p { max-width: 40em; margin: 0 0 0.8em; }
.intro-text p.label { margin-bottom: 0.7rem; }
.intro-text .social { margin: 0 0 1.2rem; }

/* Expertises: one row that slides sideways (scroll-snap), like the project cards on rubenkuipers.design */
.expertises { margin: clamp(2.5rem, 5vw, 4.5rem) 0 0; }
.expertises-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(100% - 2 * var(--gutter), var(--page-max));
  margin: 0 auto 1.1rem;
}
.expertises h2 { margin: 0; }
.expertises h2.eyebrow, .closing-contact .label { font-size: clamp(1rem, 0.9rem + 0.45vw, 1.3rem); font-weight: 800; letter-spacing: 0.2em; color: var(--ink); }
.slider-nav { display: none; gap: 0.5rem; }
.js .slider-nav { display: flex; }
.slider-btn {
  width: 42px; height: 42px; border-radius: 999px; padding: 0;
  border: 1.5px solid rgb(27 35 48 / 0.3); background: transparent; color: var(--ink);
  font: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.slider-btn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.slider-btn:disabled { opacity: 0.3; cursor: default; }
.slider {
  --edge: calc((100% - min(100% - 2 * var(--gutter), var(--page-max))) / 2);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(260px, 24vw, 360px);
  gap: var(--gap);
  align-items: start;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  padding: 0 var(--edge) 1.5rem;
  scrollbar-width: none;
}
.slider::-webkit-scrollbar { display: none; }
.slider:focus-visible { outline: 2px solid var(--ridge-2); outline-offset: -2px; }
.slider .card { scroll-snap-align: start; }
.slider .card:nth-child(4n+1) { background: var(--tint-1); }
.slider .card:nth-child(4n+2) { background: var(--tint-2); }
.slider .card:nth-child(4n+3) { background: var(--tint-3); }
.slider .card:nth-child(4n)   { background: var(--tint-4); }

.closing { --fade: clamp(1.5rem, 7vw, 9rem); margin-top: clamp(3rem, 6vw, 6rem); }
.closing-contact {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 4vw;
  align-items: end;
  width: min(100% - 2 * var(--gutter), var(--page-max));
  margin: 0 auto;
  padding: 0 0 var(--fade);
  color: var(--ink);
}
.closing-contact p { margin: 0.15em 0; }
.closing-contact h2 { margin: 0 0 0.6rem; font-size: clamp(1.8rem, 1.2rem + 2.2vw, 3rem); }
.closing-contact .social { margin: 1rem 0 0; }
.closing-contact .contact-list { list-style: none; margin: 0; padding: 0; max-width: 26rem; }
.closing-contact .contact-list li { display: flex; align-items: flex-start; gap: 0.7rem; margin: 0 0 0.7rem; line-height: 1.5; }
.closing-contact .contact-list li:last-child { margin-bottom: 0; }
.closing-contact .contact-list a { font-weight: 700; }
.closing-contact .ico { flex: none; width: 1.3rem; height: 1.3rem; margin-top: 0.15rem; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.closing-contact a { color: var(--ink); }
.closing-photo {
  display: block;
  width: 100%;
  height: auto;
  margin-top: calc(var(--fade) * -1.25);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 0.25) 32%, #000 62%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgb(0 0 0 / 0.25) 32%, #000 62%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* ---------- Content pages ---------- */
.strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin: 0.8rem 0 0.3rem;
  align-items: start;
}
.strip.three { grid-template-columns: repeat(3, 1fr); }
.strip img { width: 100%; height: auto; display: block; border-radius: 10px; }

.pubs { padding-left: 1.1rem; }
.pubs li { margin: 0.55rem 0; }
.pubs .year { font-weight: 700; }

.prose { max-width: 50rem; }
.prose p { margin: 0.7rem 0; }
.prose ul { padding-left: 1.2rem; }
.note {
  background: #fff;
  border-left: 4px solid var(--ridge-2);
  padding: 0.2rem 1rem 0.6rem;
  margin: 1.2rem 0;
}

figure { margin: 1.4rem 0; }
figure img { border-radius: 12px; }

.doc {
  margin: 1rem 0 2rem;
  background: var(--card);
  border-radius: 18px;
  padding: 0.8rem;
}
.doc iframe {
  display: block;
  width: 100%;
  height: 820px;
  border: 0;
  border-radius: 10px;
  background: white;
}
.doc h2 { margin: 0; font-size: 1.3rem; }
.doc-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin: 0.4rem 0.4rem 0.8rem; }
.doc-actions { display: flex; gap: 0.5rem; }
.btn-blue {
  display: inline-block; padding: 0.4rem 1.05rem; border-radius: 999px;
  background: #2563b8; color: #fff; border: 1.5px solid #2563b8;
  font-size: 0.9rem; font-weight: 700; line-height: 1.3; text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.btn-blue:hover { background: #1b4c92; border-color: #1b4c92; color: #fff; }
#resume { scroll-margin-top: 5rem; }

/* About: the portrait and key facts stay in view at the left. */
.about-layout {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.about-profile { position: sticky; top: 5.75rem; }
.about-profile .portrait {
  width: auto;
  max-width: 100%;
  max-height: calc(100svh - 23rem);
  min-height: 12rem;
  margin: 0 0 1rem;
}
.about-profile h1 { font-size: 1.6rem; margin-bottom: 0.15rem; }
.about-profile .titles { margin: 0; color: var(--muted); font-weight: 600; line-height: 1.5; }
.about-profile .social { margin: 0.8rem 0 0; }
.about-main { min-width: 0; }
.about-sec { margin: 0 0 2.4rem; }
.about-sec > h2 { margin-top: 0; }
.about-profile .label { margin: 0.2rem 0 0.4rem; }
.about-layout { position: relative; z-index: 1; }
.about-main .prose { max-width: none; }
.about-main > h2:first-child, .about-main .prose > h2:first-child { margin-top: 0; }

.site-footer {
  position: relative;
  color: var(--ink);
  padding: 0 0 2.4rem;
  font-size: 0.95rem;
}
.site-footer p { margin: 0.25rem 0; }
.footer-contour {
  height: clamp(70px, 11vw, 150px);
  margin-bottom: 1.6rem;
  background: var(--ink);
  opacity: 0.2;
  -webkit-mask: linear-gradient(to bottom, transparent, #000 70%) no-repeat 0 0 / 100% 100%, url("../assets/contours/oso-strip.svg") center / cover no-repeat;
  -webkit-mask-composite: source-in;
  mask: linear-gradient(to bottom, transparent, #000 70%) no-repeat 0 0 / 100% 100%, url("../assets/contours/oso-strip.svg") center / cover no-repeat;
  mask-composite: intersect;
}
.footer-grid { display: grid; grid-template-columns: 1.1fr 1.6fr 1.3fr; gap: 1rem 2.5rem; }
.footer-name { font-weight: 800; font-size: 1.1rem; }
.footer-grid .muted { color: var(--muted); }
.footer-base { margin-top: 0; }
.footer-copy { margin: 0; color: var(--muted); font-size: 0.88rem; }

/* Front page fade-in: intro on load (top to bottom), the rest as it scrolls into view (js/site.js adds .is-in) */
@keyframes fade-up { from { opacity: 0; transform: translateY(1.1rem); } to { opacity: 1; transform: none; } }
.js .home-intro .fx { animation: fade-up 1s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--d, 0) * 220ms + 80ms); }
.reveal-on [data-reveal] { opacity: 0; transform: translateY(1.4rem); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(.2,.7,.2,1); transition-delay: var(--delay, 0s); }
.reveal-on [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .home-intro .fx { animation: none; }
  .reveal-on [data-reveal] { opacity: 1; transform: none; transition: none; }
}
@media print { .reveal-on [data-reveal] { opacity: 1; transform: none; } }

/* =====================================================================
   v2: topographic identity + project / research / about components
   ===================================================================== */

/* Small uppercase label above titles */
.label {
  margin: 0 0 0.7rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.5;
}
.label a { color: inherit; }

/* Contour lines drawn from the Oso landslide lidar, used as a CSS mask */
.contour-bg { position: relative; isolation: isolate; }
.contour-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--ink);
  opacity: 0.14;
  -webkit-mask: linear-gradient(to bottom, #000 35%, transparent) no-repeat 0 0 / 100% 100%, url("../assets/contours/oso.svg") var(--cpos, 50% 40%) / cover no-repeat;
  -webkit-mask-composite: source-in;
  mask: linear-gradient(to bottom, #000 35%, transparent) no-repeat 0 0 / 100% 100%, url("../assets/contours/oso.svg") var(--cpos, 50% 40%) / cover no-repeat;
  mask-composite: intersect;
  pointer-events: none;
}

/* Title block on every inner page */
.page-head { padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(1.5rem, 3vw, 2.5rem); }
.page-head .wrap > :last-child { margin-bottom: 0; }
.page-head h1 { margin: 0 0 0.6rem; font-size: clamp(2.1rem, 1.3rem + 3vw, 3.75rem); text-wrap: balance; }
.page-head h1.long { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 3.1rem); max-width: 22em; }
.page-head .lede { font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem); max-width: 42rem; margin: 0 0 1.4rem; color: var(--muted); }
.back { display: inline-block; margin: 0 0 1.4rem; font-size: 0.9rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--rust); }

/* Pill buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1.1rem; padding: 0; list-style: none; }
.btn-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 1.2rem; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--paper);
  font-size: 0.95rem; font-weight: 700; line-height: 1.3; text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.btn-pill::after { content: "\2197"; font-size: 0.85em; opacity: 0.75; }
.btn-pill:not([href^="http"])::after { content: none; }
.btn-pill:hover { background: var(--ridge-2); border-color: var(--ridge-2); color: #fff; }
.btn-pill.outline { background: transparent; color: var(--ink); }
.btn-pill.outline:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Fact chips */
.facts { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.facts li {
  padding: 0.2rem 0.8rem; border: 1px solid rgb(27 35 48 / 0.18); border-radius: 999px;
  background: rgb(255 252 248 / 0.55); font-size: 0.84rem; font-weight: 600; line-height: 1.5;
}
.facts li b { margin-right: 0.35rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* Blocks inside project and research pages */
.teaser { margin: 0; max-width: 1280px; }
.block { margin-top: clamp(2.5rem, 5vw, 4.5rem); }
.block > h2 { margin-top: 0; }
.split .teaser { margin: 0; }
.page-head .wrap { position: relative; }
.head-mark { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: clamp(120px, 17vw, 240px); height: auto; }
@media (max-width: 900px) { .head-mark { display: none; } }
.teaser img, .teaser video { display: block; width: 100%; height: auto; border-radius: 16px; background: #fff; }
.teaser.logo img { width: min(560px, 100%); margin-inline: auto; background: transparent; border-radius: 0; }
.fig-cap, figcaption.fig-cap { color: var(--muted); font-size: 0.92rem; margin: 0.6rem 0 0; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: var(--gap); }
.feature { border-radius: 18px; padding: 1.3rem 1.4rem 1.4rem; background: var(--tint-1); }
.feature:nth-child(4n+2) { background: var(--tint-2); }
.feature:nth-child(4n+3) { background: var(--tint-3); }
.feature:nth-child(4n) { background: var(--tint-4); }
.feature .num { display: block; margin-bottom: 0.7rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.2em; color: var(--muted); }
.feature h3 { margin: 0 0 0.35rem; font-size: 1.15rem; }
.feature p { margin: 0; color: var(--muted); font-size: 0.97rem; line-height: 1.55; }

.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); counter-reset: fig; }
.gallery figure { margin: 0; counter-increment: fig; }
.gallery figure.wide { grid-column: 1 / -1; }
.gallery img, .gallery video { display: block; width: 100%; height: auto; border-radius: 14px; background: #fff; }
.gallery video { background: #0e0e0e; }
.gallery figcaption { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.92rem; }
.gallery figcaption::before { content: "Fig. " counter(fig) " \2014  "; font-weight: 800; color: var(--ink); }

/* Install tabs + citation box */
.tabs, .cite-box { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0.9rem 1.1rem 1.1rem; max-width: 46rem; }
.tab-list { display: flex; gap: 0.4rem; margin-bottom: 0.7rem; }
.tab-list button {
  padding: 0.25rem 0.9rem; border-radius: 999px; border: 1.5px solid transparent; background: transparent;
  font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tab-list button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs pre, .cite-box pre, .install { margin: 0; overflow-x: auto; font-size: 0.9rem; line-height: 1.6; }
.tabs code, .cite-box code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.cite-box p { margin: 0; font-size: 0.97rem; }
.copy {
  position: absolute; top: 0.8rem; right: 0.9rem; padding: 0.2rem 0.8rem; border-radius: 999px;
  border: 1.5px solid rgb(27 35 48 / 0.25); background: transparent; font: inherit; font-size: 0.8rem; font-weight: 700; color: var(--ink); cursor: pointer;
}
.copy:hover { background: var(--ink); color: var(--paper); }
.cite-box .label { margin-bottom: 0.5rem; }

/* Click-to-open method sections */
details.how { border-top: 1px solid var(--line); }
details.how:last-of-type { border-bottom: 1px solid var(--line); }
details.how > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.05rem 0.2rem;
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.35rem); font-weight: 800; cursor: pointer; list-style: none;
}
details.how > summary::-webkit-details-marker { display: none; }
details.how > summary::after { content: "+"; font-size: 1.5rem; font-weight: 400; color: var(--muted); transition: transform 0.2s ease; }
details.how[open] > summary::after { content: "\2212"; }
details.how > summary:hover { color: var(--rust); }
.how-body { padding: 0 0.2rem 1.4rem; max-width: 50rem; }
.how-body p { margin: 0.7rem 0; }
.how-body ul { padding-left: 1.2rem; }
.how-body code, .block code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92em; background: rgb(27 35 48 / 0.06); padding: 0.05em 0.35em; border-radius: 5px; }
.how-body pre code, .block pre code { background: none; padding: 0; }

/* Next project / next topic */
.next-link {
  display: block; margin-top: clamp(3rem, 6vw, 5.5rem); padding: 1.6rem 0 0; border-top: 1px solid rgb(27 35 48 / 0.2);
  color: var(--ink); text-decoration: none;
}
.next-link .label { margin-bottom: 0.4rem; }
.next-link strong { display: block; font-size: clamp(1.7rem, 1.2rem + 2vw, 3rem); font-weight: 900; letter-spacing: -0.015em; line-height: 1.1; }
.next-link strong span { display: inline-block; transition: transform 0.25s ease; }
.next-link em { display: block; margin-top: 0.4rem; font-style: normal; color: var(--muted); }
.next-link:hover strong span { transform: translateX(0.35rem); }
.next-link:hover { color: var(--rust); }

/* Research case-study layout: facts stay in view at the left */
.case { display: grid; grid-template-columns: minmax(11rem, 4fr) minmax(0, 8fr); gap: 2rem clamp(2rem, 5vw, 5rem); align-items: start; }
.case-facts { position: sticky; top: 5.5rem; }
.case-facts dl { margin: 0; }
.case-facts dt { margin: 1.1rem 0 0.2rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.case-facts dt:first-child { margin-top: 0; }
.case-facts dd { margin: 0; font-weight: 600; font-size: 0.98rem; line-height: 1.45; }
.case-body { min-width: 0; max-width: 46rem; }
.case-body > :first-child { margin-top: 0; }
.case-body figure { margin: 1.8rem 0; counter-increment: cfig; }
.case-body figure img, .case-body figure video { display: block; width: 100%; height: auto; border-radius: 14px; background: #fff; }
.case-body figure.small img { max-width: 360px; }
.case-body figcaption { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.92rem; }
.case-body figcaption::before { content: "Fig. " counter(cfig) " \2014  "; font-weight: 800; color: var(--ink); }
.case-body { counter-reset: cfig; }
.case-body .lead-quote { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin: 0 0 1.4rem; text-wrap: balance; }
.case-body h2 { margin-top: 2.6rem; font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.9rem); }
.hyp { display: grid; gap: 0.8rem; margin: 1rem 0 1.6rem; }
.hyp-item { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; padding: 1.1rem 1.3rem; border-radius: 16px; background: var(--tint-2); }
.hyp-item:nth-child(even) { background: var(--tint-3); }
.hyp-n { font-size: 1.5rem; font-weight: 900; line-height: 1.1; color: var(--ridge-2); }
.hyp-item p { margin: 0; }

/* Reference lists */
.pub-list { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.pub-list li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 0.2rem 1rem; padding: 0.8rem 0; border-top: 1px solid var(--line); font-size: 0.97rem; line-height: 1.55; }
.pub-list .yr { font-weight: 800; color: var(--ridge-2); font-variant-numeric: tabular-nums; }
.pub-list .doi {
  display: inline-block; margin-left: 0.3rem; padding: 0 0.6rem; border: 1px solid rgb(27 35 48 / 0.25); border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.pub-list .doi:hover { background: var(--ink); color: var(--paper); }

/* About: rock-column timeline and skill tags */
.timeline { list-style: none; margin: 0.8rem 0 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 8.2rem 1rem minmax(0, 1fr); gap: 0 1rem; padding: 0.85rem 0; border-top: 1px dashed rgb(27 35 48 / 0.22); }
.tl-item:first-child { border-top: 0; }
.tl-date { font-size: 0.86rem; font-weight: 800; letter-spacing: 0.04em; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 0.15rem; }
.tl-bed { border-radius: 4px; background: var(--tint-1); box-shadow: inset 0 0 0 1px rgb(27 35 48 / 0.08); }
.tl-item:nth-child(4n+2) .tl-bed { background: var(--tint-2); }
.tl-item:nth-child(4n+3) .tl-bed { background: var(--tint-3); }
.tl-item:nth-child(4n) .tl-bed { background: var(--tint-4); }
.tl-body strong { display: block; font-weight: 800; line-height: 1.3; }
.tl-body span { display: block; color: var(--muted); font-size: 0.97rem; line-height: 1.45; }
.tag-group { margin: 1.2rem 0 0; }
.tag-group h3 { margin: 0 0 0.5rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 0.2rem 0.85rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 0.92rem; font-weight: 600; }

/* Project-list card pieces */
.card .label { margin-bottom: 0.9rem; }
.card-tile { display: block; height: clamp(8rem, 14vw, 11rem); border-radius: 10px; overflow: hidden; margin: 0 0 1.1rem; background: rgb(255 252 248 / 0.5); }
.card-tile::before { opacity: 0.4; inset: 0; -webkit-mask: url("../assets/contours/oso.svg") var(--cpos, 50% 50%) / 220% auto no-repeat; mask: url("../assets/contours/oso.svg") var(--cpos, 50% 50%) / 220% auto no-repeat; }
.teaser + .stagger { margin-top: clamp(2rem, 4vw, 3rem); }
.card-num { display: block; margin: 0 0 0.9rem; font-size: 0.74rem; font-weight: 800; letter-spacing: 0.2em; color: var(--muted); }

/* Front page extras */
body.home .home-intro, body.home .expertises { position: relative; z-index: 1; }

/* 404 */
.nf { text-align: left; padding: clamp(3rem, 10vw, 8rem) 0; }
.nf h1 { font-size: clamp(4rem, 3rem + 8vw, 9rem); line-height: 0.95; }

@media (max-width: 900px) {
  .case { grid-template-columns: minmax(0, 1fr); }
  .case-facts { position: static; display: block; }
  .case-facts dl { display: block; }
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .tl-item { grid-template-columns: 1rem minmax(0, 1fr); }
  .tl-date { grid-column: 2; }
  .tl-bed { grid-row: 1 / span 2; grid-column: 1; }
  .tl-body { grid-column: 2; }
  .pub-list li { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 800px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle {
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 0 10px; margin-left: auto;
    background: transparent; border: 1.5px solid rgb(27 35 48 / 0.3); border-radius: 999px; cursor: pointer;
  }
  .nav-toggle span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav { flex-basis: 100%; flex-direction: column; gap: 0.15rem; padding-bottom: 0.5rem; }
  .js .nav { display: none; }
  .js .nav.open { display: flex; }
  .footer-grid { grid-template-columns: 1fr; }
  .home-intro { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .intro-text { order: 1; }
  .intro-portrait { order: 2; width: min(78vw, 22rem); }
  .stagger { display: flex; flex-direction: column; margin-top: 1rem; }
  .stagger-col { display: contents; }
  .stagger-col + .stagger-col { margin-top: 0; }
  .stagger .card { order: var(--i, 0); }
  .closing-contact { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .strip { grid-template-columns: 1fr 1fr; }
  .doc iframe { height: 640px; }
  .about-layout { grid-template-columns: 1fr; }
  .about-profile { position: static; }
  .about-profile .portrait { max-width: 260px; max-height: none; }
}
