/* Sebastian Block: personal academic website. No external fonts or requests.
   Design logic: subtraction. One idea per section, generous whitespace, one type family
   (the system font: SF Pro on Apple devices), an almost colourless palette and one accent
   that means "clickable" and nothing else. Light or dark follows the system setting.
   Type scale (px): 12 / 14 / 17 / 19 / 24 / h2 32-48 / display 40-72. Spacing on an 8 px grid. */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #0066cc;
  --accent-hover: #0058b0;
  --on-accent: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --t12: 12px; --t14: 14px; --t17: 17px; --t19: 19px; --t24: 24px;
  --t-h2: clamp(32px, 4.6vw, 48px);
  --t-display: clamp(40px, 6.4vw, 72px);
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px; --s8: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #161617;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: #424245;
    --accent: #2997ff;
    --accent-hover: #47a5ff;
    --on-accent: #000000;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #161617;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: #424245;
  --accent: #2997ff;
  --accent-hover: #47a5ff;
  --on-accent: #000000;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--t19)/1.58 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
@media (max-width: 680px) { body { font-size: var(--t17); } html { scroll-padding-top: 72px; } }
a { color: var(--accent); text-decoration: none; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
@media (hover: hover) { a:hover .u, .mail:hover, .addr-left a:hover { text-decoration: underline; text-underline-offset: 3px; } }
img { max-width: 100%; height: auto; }
p { margin: 0 0 var(--s3); }
.nw { white-space: nowrap; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(22px, env(safe-area-inset-left, 0px)); padding-right: max(22px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 756px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 20; background: var(--bg); padding: 12px 16px; }

/* navigation: slim, translucent, blurred; 44 px tap targets */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 11; background: var(--bg); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.topbar-inner { display: flex; align-items: center; gap: var(--s3); min-height: 48px; }
.brand { color: var(--text); font-size: var(--t17); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; }
nav { display: flex; gap: 0 var(--s3); margin-left: auto; }
nav a { color: var(--text); opacity: .8; font-size: var(--t14); letter-spacing: 0; white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; transition: opacity .2s var(--ease); }
nav a:hover { opacity: 1; }
@media (max-width: 680px) {
  .topbar-inner { flex-direction: row; align-items: center; gap: 0; }
  nav { flex: 1; min-width: 0; }
  .nav-cv { display: none !important; }
  .brand { display: none; }
  .nav-about { display: none !important; }
  nav a { min-width: 44px; justify-content: center; padding: 0 4px; }
  nav {
    margin: 0 -16px; padding: 0 16px; gap: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  }
  nav::-webkit-scrollbar { display: none; }
}

/* hero: the person is the product */
.hero { text-align: center; padding: clamp(72px, 11vw, 136px) 0 clamp(48px, 7vw, 80px); }
.hero-name { font-size: clamp(48px, 9vw, 96px); line-height: 1.02; letter-spacing: -.03em; font-weight: 700; margin: 0 0 var(--s2); text-wrap: balance; }
.hero-sub { font-size: clamp(22px, 3.6vw, 36px); line-height: 1.15; letter-spacing: -.02em; font-weight: 600; margin: 0 0 var(--s2); }
.hero-line { color: var(--muted); font-size: var(--t19); margin: 0 0 var(--s4); text-wrap: balance; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin: 0 0 clamp(48px, 7vw, 72px); }
.btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 980px;
  font-size: var(--t17); border: 1px solid var(--accent); color: var(--accent);
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .1s var(--ease);
}
.btn:hover { background: var(--accent); color: var(--on-accent); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 980px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.hero-figure { margin: 0 auto; width: min(440px, 100%); }
.portrait { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 24px; }

/* one idea per section; one background, whitespace separates */
.feature { padding: clamp(96px, 12vw, 160px) 0; text-align: center; }
.display { font-size: var(--t-display); line-height: 1.05; letter-spacing: -.025em; font-weight: 700; margin: 0 0 var(--s3); text-wrap: balance; }
.feature-text { font-size: var(--t24); line-height: 1.42; letter-spacing: -.015em; color: var(--muted); max-width: 640px; margin: 0 auto var(--s4); text-wrap: balance; }
.links { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); justify-content: center; margin: 0; }
.links.left, .profiles { justify-content: flex-start; }
.links.inline { display: inline-flex; gap: 0 var(--s3); vertical-align: baseline; }
.more { font-size: var(--t17); white-space: nowrap; cursor: pointer; }
.chev { display: inline-block; margin-left: .2em; transition: transform .2s var(--ease); }
@media (hover: hover) { .more:hover .chev { transform: translateX(3px); } }

/* reference sections */
.section { padding: clamp(80px, 10vw, 128px) 0; border-top: 1px solid var(--line); }
h2 { font-size: var(--t-h2); line-height: 1.08; letter-spacing: -.022em; font-weight: 700; margin: 0 0 var(--s4); text-wrap: balance; }
h3 { font-size: var(--t24); line-height: 1.25; letter-spacing: -.015em; font-weight: 600; margin: var(--s6) 0 var(--s2); }
.lead { color: var(--muted); }
.count { color: var(--muted); font-weight: 400; }
.profiles { margin-top: var(--s4); }

/* projects: one column on the reading edge */
.projects { display: grid; gap: var(--s3); }
.project { background: var(--bg-alt); border-radius: 18px; padding: clamp(24px, 4vw, 40px); }
.status { font-size: var(--t14); font-weight: 600; color: var(--muted); margin: 0 0 var(--s1); letter-spacing: 0; }
.project h3 { margin: 0 0 4px; }
.project .subtitle { font-size: var(--t17); color: var(--muted); line-height: 1.4; margin: 0 0 var(--s3); }
.project dl { margin: 0 0 var(--s2); }
.project .summary { font-size: var(--t17); line-height: 1.5; margin: 0 0 var(--s3); }
.project dt { font-size: var(--t14); font-weight: 600; color: var(--muted); margin-top: var(--s2); letter-spacing: 0; }
.project dd { margin: 4px 0 0; font-size: var(--t17); line-height: 1.5; }
.project .links { justify-content: flex-start; }

/* publications */
h4.year { font-size: var(--t14); font-weight: 600; color: var(--muted); margin: var(--s4) 0 0; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.pubs .pub:last-child { border-bottom: 0; }
.pub-title { font-size: var(--t17); font-weight: 600; line-height: 1.4; margin: 0 0 4px; text-wrap: pretty; }
.tr { font-weight: 400; color: var(--muted); }
.pub-meta { font-size: var(--t14); line-height: 1.5; color: var(--muted); margin: 0; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.pub-meta strong { color: var(--text); font-weight: 600; }
.pub-links { display: flex; flex-wrap: wrap; gap: 0 var(--s3); align-items: baseline; margin-top: var(--s1); }
.pub-links .more { font-size: var(--t14); }
.cite summary { list-style: none; color: var(--accent); }
.cite summary::-webkit-details-marker { display: none; }
.cite { min-width: 0; max-width: 100%; }
.cite[open] { flex-basis: 100%; }
.cite pre { margin: var(--s1) 0 0; padding: var(--s2); background: var(--bg-alt); border-radius: 12px; font: var(--t12)/1.5 var(--mono); overflow-x: auto; white-space: pre; letter-spacing: 0; }

/* teaching */
h4.sub { font-size: var(--t14); font-weight: 600; color: var(--muted); margin: var(--s4) 0 0; letter-spacing: 0; }
.teach { list-style: none; margin: 0; padding: 0; }
.teach li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.teach li:last-child { border-bottom: 0; }
.course { font-size: var(--t17); font-weight: 600; line-height: 1.4; margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.tctx { font-size: var(--t14); color: var(--muted); line-height: 1.5; margin: 0; letter-spacing: 0; }
.cover {
  display: inline-block; white-space: nowrap; margin-left: 0; padding: 0 6px;
  border: 1px solid var(--line); border-radius: 5px; font-size: var(--t12); font-weight: 500; line-height: 1.6; color: var(--muted); letter-spacing: 0;
}

/* contact */
.contact { text-align: center; }
.mail-line { font-size: clamp(20px, 3vw, 28px); font-weight: 600; letter-spacing: -.015em; margin: 0 0 var(--s3); overflow-wrap: anywhere; }
.addr { color: var(--muted); font-size: var(--t17); line-height: 1.55; margin: 0; }

/* legal page */
.page-title { font-size: var(--t-h2); line-height: 1.08; letter-spacing: -.022em; font-weight: 700; margin: 0 0 var(--s6); }
.legal h2 { font-size: var(--t24); margin: var(--s6) 0 var(--s2); }
.legal p { font-size: var(--t17); }
.addr-left { color: var(--muted); }
.addr-left a { text-decoration: underline; text-underline-offset: 3px; }

.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: var(--t12); letter-spacing: 0; padding: var(--s3) 0 calc(var(--s4) + env(safe-area-inset-bottom, 0px)); }
.footer-inner { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--text); }

/* one quiet entrance for the three theme sections only (site.js) */
.reveal.pending { opacity: 0; transform: translateY(16px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal:focus-within { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal.pending { opacity: 1; transform: none; }
  * { transition: none !important; }
}
@media (max-height: 500px) { .topbar { position: static; } }
@media (max-width: 340px) { nav { flex-wrap: wrap; overflow: visible; justify-content: flex-start; -webkit-mask-image: none; mask-image: none; } }
@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] { --bg: #fff; --bg-alt: #f5f5f7; --text: #000; --muted: #555; --line: #ccc; --accent: #0066cc; color-scheme: light; }
  .reveal.pending { opacity: 1; transform: none; }
  .topbar, .actions, .feature, .hero-figure, .cite, .skip { display: none; }
  .pub-links .more .chev { display: none; }
  .pub-links a[href*="doi.org"]::after { content: " " attr(href); color: #000; }
  body { background: #fff; color: #000; }
}

/* tap targets: 44 px hit areas without changing the look */
.pub-links .more { padding: 11px 6px; margin: -11px -6px; }
.links .more { padding: 9px 0; margin: -9px 0; }
.pub-links .more:focus-visible { outline-offset: -2px; }
.mail-line a { display: inline-block; padding: 10px 0; }
.footer a { padding: 13px 0; margin: -13px 0; }
@media (min-width: 681px) { nav a { padding: 0 12px; margin: 0 -12px; } }

.cover-label { font-size: var(--t14); font-weight: 600; color: var(--muted); margin: var(--s2) 0 0; letter-spacing: 0; }
.project dd a { text-decoration: underline; text-underline-offset: 3px; }
.bio a { text-decoration: underline; text-underline-offset: 3px; }

/* light/dark switch: small, instant, follows the system until clicked */
.theme-toggle { display: none; flex: none; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -10px; padding: 0; border: 0; background: transparent; color: var(--text); opacity: .8; cursor: pointer; }
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { opacity: 1; }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; border-radius: 50%; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
@media print { .theme-toggle { display: none; } }
