/* Self-hosted Schibsted Grotesk (SIL OFL 1.1, see fonts/OFL.txt) */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("/assets/fonts/schibsted-grotesk-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: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url("/assets/fonts/schibsted-grotesk-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;
}

/* Design tokens */
:root {
  --paper: #f7f8fa;
  --ink: #1c2433;
  --muted: #5d6678;
  --rule: #dce0e7;
  --accent: #2f47c9;
  --accent-soft: #e3e7f9;

  /* Classical type scale: 14 / 16 / 18 / 21 / 24 / 36 / 48 / 60 */
  --fs-small: 0.875rem;
  --fs-base: 1.125rem;
  --fs-h3: 1.125rem;
  --fs-h2: 1.3125rem;
  --fs-lead: 1.5rem;
  --fs-h1: clamp(2.25rem, 1.4rem + 3.6vw, 3.75rem);

  --measure: 66ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Top bar */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
  font-size: var(--fs-small);
}
.bar .home {
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}
.bar nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bar nav a { color: var(--muted); text-decoration: none; }
.bar nav a:hover { color: var(--ink); }
.bar .lang { font-weight: 600; color: var(--accent); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 22rem);
  gap: 2rem 4rem;
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5rem);
}
.ident {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.ident picture { flex: none; }
.ident img {
  width: 4.5rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 3px;
}
.ident p {
  margin: 0;
  font-size: var(--fs-small);
  color: var(--muted);
  line-height: 1.45;
}
.ident strong { color: var(--ink); font-weight: 600; }

h1 {
  margin: 0 0 1.25rem;
  font-size: var(--fs-h1);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.025em;
}
h1 .title {
  display: block;
  font-size: 0.4em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-bottom: 0.35em;
}
.lead {
  margin: 0;
  max-width: 34em;
  font-size: var(--fs-lead);
  line-height: 1.4;
  font-weight: 420;
}

/* Topology figure: a minimal monitor placement */
.topo { margin: 0; }
.topo figcaption {
  margin-top: 0.75rem;
  font-size: var(--fs-small);
  color: var(--muted);
  max-width: 22rem;
}
.topology .e {
  stroke: var(--rule);
  stroke-width: 1.6;
  stroke-linecap: round;
  animation: observe 0.7s ease-out forwards;
  animation-delay: calc(0.4s + var(--i) * 0.28s);
}
.topology .n {
  fill: var(--paper);
  stroke: var(--muted);
  stroke-width: 1.5;
}
.topology .m {
  fill: var(--accent);
  stroke: var(--paper);
  stroke-width: 2.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: arm 0.45s ease-out both;
  animation-delay: calc(0.25s + var(--i) * 0.28s);
}
.topology .d0 { --i: 0; } .topology .d1 { --i: 1; } .topology .d2 { --i: 2; }
.topology .d3 { --i: 3; } .topology .d4 { --i: 4; } .topology .d5 { --i: 5; }
.topology .d6 { --i: 6; }
@keyframes observe { to { stroke: #8f9fe3; stroke-width: 2; } }
@keyframes arm { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Sections */
main section {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 1rem 3rem;
  padding-block: 3rem;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 1rem;
}
main section > h2 {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.body { max-width: var(--measure); }
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.body p { margin: 0 0 1em; }
h3 {
  margin: 2rem 0 0.5rem;
  font-size: var(--fs-h3);
  font-weight: 650;
  line-height: 1.35;
}

/* Research themes */
.themes { margin: 1.5rem 0 0; }
.themes dt {
  font-weight: 650;
  margin-top: 1.5rem;
}
.themes dt:first-child { margin-top: 0; }
.themes dd { margin: 0.25rem 0 0; color: var(--ink); }

/* Dated lists: publications and career */
.dated {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dated li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0 1.25rem;
  padding-block: 0.6rem;
}
.dated li + li { border-top: 1px solid var(--rule); }
.dated .when {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--fs-small);
  padding-top: 0.2em;
}
.dated .what { margin: 0; }
.pub li { grid-template-columns: 3.5rem minmax(0, 1fr); }
.pub .t { font-weight: 560; }
.pub .t a {
  color: var(--ink);
  text-decoration-color: #9aa6d9;
}
.pub .t a:hover { color: var(--accent); text-decoration-color: currentColor; }
.pub .meta {
  display: block;
  color: var(--muted);
  font-size: var(--fs-small);
  margin-top: 0.15rem;
}
.pub .me { color: var(--ink); font-weight: 600; }
.pub .v { white-space: nowrap; }

.career .what span {
  display: block;
  color: var(--muted);
  font-size: var(--fs-small);
}

/* Module and topic lists */
.plain {
  margin: 0 0 1em;
  padding-left: 1.1em;
}
.plain li { margin-bottom: 0.3em; }
.plain li::marker { color: var(--accent); }

details {
  margin-top: 1.25rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
summary {
  cursor: pointer;
  padding-block: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}
details[open] summary { margin-bottom: 0.25rem; }
details ul {
  margin: 0 0 1rem;
  padding-left: 1.1em;
  font-size: 1rem;
}
details li { margin-bottom: 0.45em; }

/* Contact */
.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem 3rem;
}
.contact h3 { margin-top: 0; }
.contact address { font-style: normal; }
.links {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* Footer */
.foot {
  border-top: 1px solid var(--rule);
  padding-block: 1.5rem 2.5rem;
  font-size: var(--fs-small);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}
.foot ul {
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.foot a { color: var(--muted); }

/* Legal pages */
/* Legal pages and standalone content pages share one layout */
.legal, .page { padding-block: 2.5rem 4rem; }
.legal .body, .page .body { max-width: 44rem; }
.legal h1, .page h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem); margin-bottom: 2rem; }
.legal h2, .page h2 { font-size: var(--fs-h2); font-weight: 650; margin: 2.25rem 0 0.5rem; }
.legal address { font-style: normal; margin-bottom: 1em; }

/* Responsive */
@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; }
  .topo { max-width: 20rem; }
  .hero { padding-block: 2rem 2.5rem; }
  main section { grid-template-columns: 1fr; gap: 1rem; padding-block: 2.25rem; }
}
@media (max-width: 30rem) {
  .topo { max-width: 16rem; }
  :root { --fs-base: 1.0625rem; --fs-lead: 1.25rem; }
  .dated li, .pub li { grid-template-columns: 1fr; }
  .dated .when { padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .topology .e, .topology .m { animation: none; }
  .topology .e { stroke: #8f9fe3; stroke-width: 2; }
}

@media print {
  .bar nav, .skip, .topo { display: none; }
  body { background: #fff; }
  a { color: inherit; }
}
