/* =====================================================================
   Styles. Colours and fonts are defined once, at the top.
   ===================================================================== */

@font-face {
  font-family: "Bricolage";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin-wght-normal.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;
}
@font-face {
  font-family: "Bricolage";
  font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(../fonts/bricolage-grotesque-latin-ext-wght-normal.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif";
  font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-serif-4-latin-wght-normal.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;
}
@font-face {
  font-family: "Source Serif";
  font-style: normal; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-serif-4-latin-ext-wght-normal.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif";
  font-style: italic; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-serif-4-latin-wght-italic.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;
}
@font-face {
  font-family: "Source Serif";
  font-style: italic; font-weight: 200 900; font-display: swap;
  src: url(../fonts/source-serif-4-latin-ext-wght-italic.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-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --paper:   #f3f5f6;
  --surface: #ffffff;
  --ink:     #16202c;
  --slate:   #566271;
  --rule:    #d3dae0;
  --fringe:  #2a52a6;   /* projector blue: links, sequence, fringes */
  --signal:  #d4952b;   /* amber: keyboard focus ring */

  --sans:  "Bricolage", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Source Serif", Georgia, "Times New Roman", serif;

  --measure: 64ch;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1180px;
}
/* Dark theme: follows the system unless the visitor picked a theme with the button */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0e1520;
    --surface: #151e2b;
    --ink:     #e6ebf1;
    --slate:   #93a1b1;
    --rule:    #243042;
    --fringe:  #7fa2ea;
    --signal:  #e8b35a;
  }
}
:root[data-theme="dark"] {
    --paper:   #0e1520;
    --surface: #151e2b;
    --ink:     #e6ebf1;
    --slate:   #93a1b1;
    --rule:    #243042;
    --fringe:  #7fa2ea;
    --signal:  #e8b35a;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--serif);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
a { color: var(--fringe); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3, .ui { font-family: var(--sans); }
h2 { font-size: clamp(1.6rem, 2.6vw, 2.05rem); line-height: 1.15; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
h3 { font-size: 1.125rem; line-height: 1.3; font-weight: 600; margin: 0 0 .35rem; }
p { margin: 0 0 1rem; }

.container { max-width: var(--max); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.bar.scrolled { border-bottom-color: var(--rule); }
.bar .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 60px; }
.bar .home { font: 600 1rem/1 var(--sans); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.bar nav { display: flex; gap: 4px; margin-left: auto; font: 500 .95rem/1 var(--sans); }
.bar nav a { color: var(--slate); text-decoration: none; padding: 8px 12px; border-radius: 6px; }
.bar nav a:hover, .bar nav a[aria-current="true"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.tools { display: flex; align-items: center; gap: 8px; order: 3; }
.theme-btn { font: 500 .9rem/1 var(--sans); color: var(--slate); background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--slate); }
.menu-btn { display: none; font: 500 .95rem/1 var(--sans); color: var(--ink); background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 8px 12px; cursor: pointer; }

/* ---------- Hero ---------- */
.hero { padding: clamp(32px, 6vw, 72px) 0 clamp(48px, 7vw, 88px); }
/* Faint wrapped-phase texture behind the hero only (assets/img/phase.webp) */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url(../img/phase.webp) center / cover no-repeat;
  opacity: var(--phase-opacity, .09);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
:root[data-theme="dark"] .hero::before { --phase-opacity: .06; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero::before { --phase-opacity: .06; } }
.hero .container { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
/* Round portrait to the left of the name */
.name-row { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px); margin: 0 0 18px; }
.name-row h1 { margin: 0; }
.portrait { flex: 0 0 auto; width: clamp(92px, 11.5vw, 152px); height: clamp(92px, 11.5vw, 152px); min-width: 0; max-width: none; aspect-ratio: 1 / 1; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--rule); }
.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5.2rem); line-height: .98; font-weight: 700;
  letter-spacing: -0.035em; margin: 0 0 18px;
}
.hero .role { font: 500 1.05rem/1.45 var(--sans); color: var(--slate); margin: 0 0 22px; max-width: 40ch; }
.hero .lead { font-size: clamp(1.15rem, 1.6vw, 1.3rem); line-height: 1.55; max-width: 34em; margin: 0 0 28px; }
.contact { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 400 .98rem/1.5 var(--sans); }
.contact .k { display: inline-block; min-width: 4.6em; color: var(--slate); }
.contact .links a { margin-right: 14px; }

.scan { margin: 0; }
.canvas-box { position: relative; aspect-ratio: 5 / 4; width: 100%; max-height: 440px; margin: 0 auto; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font: 500 .88rem/1.3 var(--sans); color: var(--slate); }
.legend li { display: inline-flex; align-items: center; gap: 8px; opacity: .45; transition: opacity .4s; }
.legend li.on { opacity: 1; }
.sw { width: 18px; height: 12px; border-radius: 3px; flex: none; }
.sw-fringe { background: repeating-linear-gradient(180deg, var(--fringe) 0 3px, transparent 3px 6px); border: 1px solid var(--rule); }
.sw-model { background:
  linear-gradient(var(--ink), var(--ink)) 50% 0 / 1px 100% no-repeat,
  linear-gradient(var(--ink), var(--ink)) 0 50% / 100% 1px no-repeat; border: 1px solid var(--ink); opacity: .8; }
.sw-ctrl { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 1.5px solid var(--ink); }
@media (prefers-reduced-motion: reduce) { .legend li { transition: none; } }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 96px) 0; border-top: 1px solid var(--rule); }
.section > .container { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: clamp(20px, 4vw, 56px); }
.section .head { align-self: start; position: sticky; top: 88px; }
.section .head p { font: 400 .95rem/1.5 var(--sans); color: var(--slate); margin: 12px 0 0; max-width: 24ch; }
.prose { max-width: var(--measure); }

/* Research areas: a quiet two-column list, not cards */
.areas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; margin: 8px 0 0; padding: 0; list-style: none; }
.areas li { border-top: 2px solid var(--ink); padding-top: 14px; }
.areas p { color: var(--slate); margin: 0; font-size: 1rem; }

/* Pipeline: a real sequence, so it is numbered */
.pipeline { list-style: none; margin: 8px 0 40px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: step; }
.pipeline li { position: relative; padding: 46px 18px 0 0; counter-increment: step; }
.pipeline li::before {
  content: counter(step);
  position: absolute; top: 0; left: 0; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 .9rem/1 var(--sans); color: var(--paper); background: var(--fringe);
}
.pipeline li::after { content: ""; position: absolute; top: 15px; left: 38px; right: 8px; height: 2px; background: repeating-linear-gradient(90deg, var(--fringe) 0 6px, transparent 6px 10px); opacity: .5; }
.pipeline li:last-child::after { display: none; }
.pipeline h3 { font-size: 1.02rem; }
.pipeline p { font-size: .95rem; line-height: 1.55; color: var(--slate); margin: 0; }

/* Where the method is used: a quiet two-column list, no cards (the results below carry the detail) */
.uses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; margin: 0; padding-top: 18px; border-top: 1px solid var(--rule); }
.uses dt { font: 600 1rem/1.3 var(--sans); margin-bottom: 4px; }
.uses dd { margin: 0; color: var(--slate); font-size: 1rem; }

/* Photo of the scanner under the Method heading */
.device { margin: 28px 0 0; width: fit-content; max-width: 260px; }
.device img { display: block; width: 100%; max-width: 258px; height: auto; border-radius: 12px; border: 1px solid var(--rule); }
/* short label in a pill, directly under the photo */
.device { text-align: center; }
.device figcaption { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px;
  font: 600 .74rem/1.3 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule); }
/* narrower screens: small photo beside its caption, so the steps follow quickly */
@media (max-width: 960px) {
  .device { margin-top: 18px; }
  .device img { width: 112px; border-radius: 10px; }
  .device { width: 112px; }
}

/* Results band: a different background so the projects read as their own part of the page */
.section.band { background: var(--surface); border-top: 0; box-shadow: inset 0 1px 0 var(--rule), inset 0 -1px 0 var(--rule); }
.section.band + .section { border-top: 0; }
.section.band .result-anim { background: var(--paper); }
.section.band .result { border-bottom-color: color-mix(in srgb, var(--rule) 80%, var(--surface)); }

.applications { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.applications article { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 24px 26px; }
.applications p { margin: 0; color: var(--slate); font-size: 1rem; }

/* Selected results */
.result { display: grid; gap: 18px; padding: 0 0 40px; margin: 0 0 40px; border-bottom: 1px solid var(--rule); }
.result:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.result-strip { display: grid; gap: 10px; margin: 0; }
.result-strip.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-strip.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.result-strip figure { margin: 0; }
.result-strip img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; border-radius: 8px; background: var(--surface); }
.result-strip figcaption { font: 500 .85rem/1.35 var(--sans); color: var(--slate); margin-top: 6px; }
.result-strip figure + figure { position: relative; }
.result-text h3 { font-size: 1.2rem; margin-bottom: 6px; }
.result-text p { max-width: var(--measure); color: var(--ink); }
.result-text .result-meta { font: 400 .88rem/1.5 var(--sans); color: var(--slate); margin: 0 0 4px; }
.result.is-text .result-text { max-width: var(--measure); }
.result.is-anim { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: center; gap: 32px; }
.result-anim { position: relative; aspect-ratio: 1 / 1; max-height: 520px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); overflow: hidden; }
.result-anim canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.chart { margin: 4px 0 14px; max-width: var(--measure); }
.chart figcaption { font: 600 .9rem/1.4 var(--sans); color: var(--ink); margin-bottom: 8px; }
.bar { display: grid; grid-template-columns: minmax(0, 12em) minmax(0, 1fr) 3.4em; align-items: center; gap: 10px; padding: 3px 0; font: 400 .86rem/1.3 var(--sans); color: var(--slate); }
.bar-track { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--rule) 70%, transparent); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--fringe) 55%, var(--rule)); }
.bar.is-best { color: var(--ink); font-weight: 600; }
.bar.is-best .bar-fill { background: var(--fringe); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .bar { grid-template-columns: minmax(0, 1fr) 3.4em; } .bar-track { grid-column: 1 / -1; grid-row: 2; } }

/* Publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.filters button {
  font: 500 .92rem/1 var(--sans); color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.filters button:hover { border-color: var(--slate); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filters .count { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }

.year-group { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 16px; padding: 18px 0; border-top: 1px solid var(--rule); }
.year-group:first-of-type { border-top: 0; padding-top: 0; }
.year-group .year { font: 600 1.05rem/1.5 var(--sans); color: var(--slate); font-variant-numeric: tabular-nums; }
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.pub .t { font-size: 1.08rem; line-height: 1.4; font-weight: 600; margin: 0 0 4px; max-width: 60ch; }
.pub .a, .pub .v { font: 400 .95rem/1.5 var(--sans); color: var(--slate); margin: 0; }
.pub .a strong { color: var(--ink); font-weight: 600; }
.pub .v i { font-family: var(--serif); }
.pub .v a { word-break: break-word; }
.sub { font: 600 1.05rem/1.3 var(--sans); margin: 40px 0 16px; color: var(--slate); }
.empty { color: var(--slate); font-style: italic; }

/* Teaching and projects */
.rows { list-style: none; margin: 0 0 20px; padding: 0; }
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.rows li:first-child { border-top: 1px solid var(--rule); }
.rows .main { font-weight: 600; }
.rows .meta { font: 400 .95rem/1.5 var(--sans); color: var(--slate); text-align: right; }
.rows .desc { grid-column: 1 / -1; color: var(--slate); font-size: 1rem; margin: 0; }
.note { font: 400 .98rem/1.55 var(--sans); color: var(--slate); }

/* Footer */
.foot { border-top: 1px solid var(--rule); padding: 28px 0 48px; font: 400 .9rem/1.5 var(--sans); color: var(--slate); }
.foot .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero .container { grid-template-columns: 1fr; }
  .scan { order: -1; max-width: 520px; width: 100%; margin: 0 auto; }
  .canvas-box { aspect-ratio: 16 / 11; }
  .section > .container { grid-template-columns: 1fr; }
  .section .head { position: static; }
  .section .head p { max-width: none; }
  .pipeline { grid-template-columns: 1fr; gap: 22px; }
  .pipeline li { padding: 0 0 0 48px; }
  .pipeline li::after { top: 36px; bottom: -18px; left: 14px; right: auto; width: 2px; height: auto; background: repeating-linear-gradient(180deg, var(--fringe) 0 6px, transparent 6px 10px); }
}
@media (max-width: 720px) {
  .menu-btn { display: inline-block; }
  .bar nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; padding: 8px var(--gutter) 16px; background: var(--paper); border-bottom: 1px solid var(--rule); }
  .bar nav.open { display: flex; }
  .bar nav a { padding: 12px 8px; }
  .areas, .applications, .uses { grid-template-columns: 1fr; }
  .result-strip.n3 { grid-template-columns: 1fr 1fr; }
  .result-strip.n3 figure:last-child { grid-column: 1 / -1; }
  .result.is-anim { grid-template-columns: 1fr; }
  .year-group { grid-template-columns: 1fr; gap: 8px; }
  .rows li { grid-template-columns: 1fr; }
  .rows .meta { text-align: left; }
}

@media print {
  .bar, .scan, .filters, .tools { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding: 24px 0; }
  .section .head { position: static; }
}
