/* victorklemm.com
   Colours: tokens below. Background stops must match BACKGROUND in js/theme.js
   (the WebGL composite paints exactly those behind the blobs). */

:root {
  --gutter: 28px;
  --card-w: 400px;
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

html[data-mode="dark"] {
  color-scheme: dark;
  --bg-top: #0b0624; --bg-mid: #24093f; --bg-bot: #05020e;
  --text: #eeecf8;
  --muted: #a7a1c4;
  --faint: #8e88b0;
  --panel: rgba(18, 11, 40, 0.62);
  --panel-strong: rgba(20, 12, 44, 0.86);
  --border: rgba(255, 255, 255, 0.10);
  --hover: rgba(255, 255, 255, 0.08);
  --accent: #c4a7ff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --text-shadow: 0 1px 14px rgba(5, 2, 14, 0.9);
}

html[data-mode="light"] {
  color-scheme: light;
  --bg-top: #e4eaf4; --bg-mid: #f6f7fb; --bg-bot: #d6deeb;
  --text: #161a26;
  --muted: #4a5061;
  --faint: #5d6477;
  --panel: rgba(255, 255, 255, 0.66);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(22, 30, 60, 0.10);
  --hover: rgba(22, 30, 60, 0.06);
  --accent: #5a3fd0;
  --shadow: 0 18px 50px rgba(40, 52, 90, 0.16);
  --text-shadow: 0 1px 12px rgba(246, 247, 251, 0.95);
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(to bottom, var(--bg-top) 0%, var(--bg-mid) 58%, var(--bg-bot) 100%) fixed;
  background-color: var(--bg-mid);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.js body { height: 100dvh; overflow: hidden; overscroll-behavior: none; }

a { color: inherit; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: var(--gutter); top: -60px; z-index: 50;
  padding: 10px 14px; border-radius: 10px; background: var(--panel-strong);
  border: 1px solid var(--border); text-decoration: none;
}
.skip-link:focus { top: 12px; }

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

/* ── Stage ──────────────────────────────────────────────────────────────── */

.stage {
  position: fixed; inset: 0;
  touch-action: pinch-zoom;     /* one-finger drags scrub the ring, pinch still zooms */
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.stage.dragging { cursor: grabbing; }
.stage.hovering { cursor: pointer; }
.stage canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 0.9s var(--ease); }
.stage.ready canvas { opacity: 1; }

.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leader { fill: none; stroke: var(--text); stroke-opacity: 0.35; stroke-width: 1; stroke-dasharray: 2 4; transition: opacity .3s; }
.reticle { fill: none; stroke: var(--text); stroke-opacity: 0.4; stroke-width: 1; transition: opacity .3s; }
.overlay.hidden .leader, .overlay.hidden .reticle { opacity: 0; }

.tooltip {
  position: fixed; left: 0; top: 0; z-index: 5;
  max-width: 280px; padding: 8px 11px;
  background: var(--panel-strong); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12.5px; line-height: 1.35;
  pointer-events: none;
  opacity: 0; transform: translate(-50%, -100%) translateY(4px);
  transition: opacity .15s, transform .15s var(--ease);
}
.tooltip.show { opacity: 1; transform: translate(-50%, -100%); }
.tooltip b { display: block; font-weight: 600; }
.tooltip span { color: var(--muted); }

/* ── Masthead ───────────────────────────────────────────────────────────── */

.masthead {
  position: fixed; top: var(--gutter); left: var(--gutter); z-index: 3;
  max-width: 440px;
  text-shadow: var(--text-shadow);
  pointer-events: none;
}
.masthead a, .masthead button { pointer-events: auto; }
.name { margin: 0; font-size: 30px; line-height: 1.1; font-weight: 680; letter-spacing: -0.015em; }
.role { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.role a { text-decoration: none; border-bottom: 1px solid var(--border); }
.role a:hover { color: var(--text); }
.blurb { margin: 10px 0 0; font-size: 14.5px; max-width: 400px; }
.hint { display: block; color: var(--faint); font-size: 13px; margin-top: 2px; }

.links { display: flex; gap: 4px; margin: 12px 0 0 -8px; }
.links a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  color: var(--muted); transition: color .15s, background .15s;
}
.links a:hover { color: var(--text); background: var(--hover); }
.links svg { width: 19px; height: 19px; }

.news {
  display: inline-block; margin-top: 8px; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; color: var(--muted); text-decoration: none; text-shadow: none;
  background: var(--panel); border: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.news:hover { color: var(--text); }

/* ── Controls ───────────────────────────────────────────────────────────── */

.controls { position: fixed; top: var(--gutter); right: var(--gutter); z-index: 3; display: flex; gap: 8px; }

.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; transition: background .15s, transform .1s;
}
.ctl:hover { background: var(--panel-strong); }
.ctl:active { transform: translateY(1px); }
.ctl svg { width: 19px; height: 19px; flex: none; }
.ctl[aria-pressed="true"] { background: var(--panel-strong); border-color: var(--accent); }
.ctl-label { font-size: 13.5px; font-weight: 550; }

#btn-pause .i-play { display: none; }
#btn-pause[aria-pressed="true"] .i-play { display: block; }
#btn-pause[aria-pressed="true"] .i-pause { display: none; }
html[data-mode="dark"] #btn-mode .i-moon,
html[data-mode="light"] #btn-mode .i-sun { display: none; }

/* ── Theme chips ────────────────────────────────────────────────────────── */

.chips {
  position: fixed; left: var(--gutter); bottom: calc(var(--gutter) + 52px); z-index: 3;
  display: flex; flex-wrap: wrap; gap: 8px;
  max-width: calc(100vw - var(--card-w) - 3 * var(--gutter));
}
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 13px 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .15s, opacity .2s, border-color .15s;
}
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.chip small { color: var(--faint); font-size: 12px; }
.chip:hover { background: var(--panel-strong); }
.chip[aria-pressed="true"] { border-color: var(--c); background: var(--panel-strong); }
.chips.filtering .chip[aria-pressed="false"] { opacity: 0.55; }

/* ── Year scrubber ──────────────────────────────────────────────────────── */

.scrubber {
  position: fixed; left: var(--gutter); bottom: var(--gutter); z-index: 3;
  right: calc(var(--card-w) + 2 * var(--gutter));
  height: 40px;
}
.scrubber ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-end; gap: 14px; height: 100%; }
.scrubber li { display: flex; flex-direction: column; justify-content: flex-end; }
.yr-ticks { display: flex; gap: 1px; align-items: flex-end; height: 24px; }
.yr-label { font: 11px/1 var(--mono); color: var(--muted); margin-top: 5px; letter-spacing: .02em; }
.tick {
  width: 11px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center;
}
.tick::before {
  content: ""; width: 3px; height: 10px; border-radius: 2px; background: var(--c); opacity: .75;
  transition: height .25s var(--ease), opacity .2s, box-shadow .2s;
}
.tick:hover::before { height: 16px; opacity: 1; }
.tick[aria-current="true"]::before { height: 24px; opacity: 1; box-shadow: 0 0 10px var(--c); }
.tick.dim::before { opacity: .18; }

/* ── Card ───────────────────────────────────────────────────────────────── */

.card {
  position: fixed; z-index: 3;
  top: calc(var(--gutter) + 60px); right: var(--gutter); bottom: var(--gutter);
  width: var(--card-w);
  display: flex; flex-direction: column;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px 6px; scrollbar-width: thin; }
.card-body.enter { animation: card-in .45s var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } }

.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); }
.card-theme { display: inline-flex; align-items: center; gap: 8px; }
.card-theme i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 10px var(--c, var(--accent)); }
.card-count { font: 12px var(--mono); color: var(--faint); }

.card-teaser {
  margin: 14px 0 0; border-radius: 12px; overflow: hidden;
  background: #fff; border: 1px solid var(--border);
  display: grid; place-items: center;
}
.card-teaser[hidden] { display: none; }
.card-teaser img { width: 100%; height: auto; max-height: min(260px, 26vh); object-fit: contain; display: block; }

.card-venue { margin: 14px 0 0; font: 600 12px/1.4 var(--mono); letter-spacing: .04em; color: var(--accent); text-transform: uppercase; }
.card-title { margin: 6px 0 0; font-size: 19px; line-height: 1.3; font-weight: 650; letter-spacing: -0.01em; }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.card-authors { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); }
.card-authors strong { color: var(--text); font-weight: 600; }
.card-authors button { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; }
.card-tldr { margin: 0 0 16px; font-size: 14.5px; line-height: 1.55; }
.card-tldr:empty { display: none; }

.card-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 14px; }
.card-links a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--hover);
  font-size: 13px; font-weight: 550; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.card-links a:hover { border-color: var(--accent); }
.card-links a.primary { background: var(--text); color: var(--bg-mid); border-color: transparent; }
.card-links svg { width: 15px; height: 15px; }

.card-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-top: 1px solid var(--border);
}
.card-cites { font-size: 12.5px; color: var(--muted); text-align: center; }

/* ── List view ──────────────────────────────────────────────────────────── */

.list-view { display: none; }
.js .list-view {
  position: fixed; inset: 0; z-index: 10;
  overflow-y: auto; overscroll-behavior: contain;
  background: color-mix(in srgb, var(--bg-mid) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.js .list-view.open { display: block; animation: fade-in .25s var(--ease); }
@keyframes fade-in { from { opacity: 0; } }
html:not(.js) .list-view, html.no-gl .list-view { display: block; }

.list-inner { max-width: 820px; margin: 0 auto; padding: 32px var(--gutter) 64px; }
.list-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1; padding: 12px 0; }
.js .list-view .list-head {
  margin: 0 calc(-1 * var(--gutter)); padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg-mid) 95%, transparent);
}
.list-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.pub-year { margin-top: 26px; }
.pub-year-label { margin: 0 0 6px; font: 600 13px var(--mono); color: var(--faint); letter-spacing: .06em; }
.pub-items { list-style: none; margin: 0; padding: 0; }
.pub {
  position: relative; display: grid; gap: 3px;
  padding: 12px 14px 12px 22px; margin: 0 -14px; border-radius: 12px;
  cursor: pointer;
}
.pub::before {
  content: ""; position: absolute; left: 6px; top: 19px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--c, var(--faint));
}
.pub[data-theme="wheeled"]  { --c: #f5a524; }
.pub[data-theme="rl"]       { --c: #a855f7; }
.pub[data-theme="diffsim"]  { --c: #22c7e8; }
.pub[data-theme="planning"] { --c: #3fd17a; }
.pub[data-theme="other"]    { --c: #fb6f8c; }
.pub:hover { background: var(--hover); }
.pub.current { background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); }
.pub.dim { opacity: .35; }
.pub-title { font-weight: 600; text-decoration: none; }
.pub-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.pub-authors { font-size: 13.5px; color: var(--muted); }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { font: 12px var(--mono); color: var(--accent); }
.pub-links { font-size: 13px; display: flex; gap: 12px; }
.pub-links a { color: var(--muted); }
.pub-links a:hover { color: var(--text); }
.list-foot { margin-top: 36px; font-size: 13px; color: var(--faint); }

/* No WebGL: the list is the page, under the masthead. */
html.no-gl .stage, html.no-gl .card, html.no-gl .chips, html.no-gl .scrubber,
html.no-gl #btn-list, html.no-gl #btn-pause, html.no-gl .hint, html.no-gl #btn-list-close { display: none !important; }
html.no-gl body { height: auto; overflow: auto; }
html.no-gl .masthead { position: static; margin: var(--gutter); }
html.no-gl .list-view { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ?poster: scene only (used to render assets/og.jpg) */
html.poster .controls, html.poster .card, html.poster .chips, html.poster .scrubber,
html.poster .overlay, html.poster .tooltip, html.poster .blurb, html.poster .links,
html.poster .news { visibility: hidden; }
html.poster .name { font-size: 40px; }
html.poster .role { font-size: 18px; }

/* No JS at all */
html:not(.js) .stage, html:not(.js) .card, html:not(.js) .chips, html:not(.js) .scrubber,
html:not(.js) .controls, html:not(.js) .hint, html:not(.js) #btn-list-close { display: none; }
html:not(.js) .masthead { position: static; margin: var(--gutter); }
.noscript-note { max-width: 820px; margin: 0 auto 40px; padding: 0 var(--gutter); color: var(--faint); font-size: 13px; }

.debug {
  position: fixed; left: 8px; bottom: 8px; z-index: 20; padding: 6px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, .6); color: #9f9; font: 11px/1.4 var(--mono); pointer-events: none; white-space: pre;
}

/* ── Narrow screens: card becomes a bottom sheet ────────────────────────── */

@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .masthead { max-width: calc(100vw - 2 * var(--gutter) - 3 * 44px - 2 * 6px - 8px); }
  .name { font-size: 22px; }
  .role { font-size: 13px; margin-top: 3px; line-height: 1.35; }
  .blurb, .news { display: none; }
  .links { margin-top: 6px; }
  .links a { width: 36px; height: 36px; }
  .ctl-label { display: none; }
  .controls { gap: 6px; }

  .chips {
    top: calc(var(--mast-bottom, 126px) + 6px); bottom: auto; left: 0; right: 0; max-width: none;
    flex-wrap: nowrap; overflow-x: auto; padding: 0 var(--gutter); scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { height: 32px; }

  .scrubber { display: none; }

  .card {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: 47dvh;                /* fixed: the ring is framed against it */
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .card-body { padding: 14px 16px 4px; }
  .card-teaser { margin-top: 10px; }
  .card-teaser img { max-height: 130px; }
  .card-title { font-size: 17px; }
  .card-tldr { font-size: 14px; }
}

@media (max-width: 860px) and (max-height: 640px) {
  .card-teaser { display: none !important; }
}

/* Short landscape screens (phones on their side): keep a side card. */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --gutter: 14px; --card-w: min(380px, 46vw); }
  .masthead { max-width: calc(100vw - var(--card-w) - 3 * var(--gutter)); }
  .name { font-size: 20px; }
  .role { font-size: 12.5px; }
  .blurb, .news, .hint { display: none; }
  .links { margin-top: 4px; }
  .links a { width: 34px; height: 34px; }
  .ctl-label { display: none; }
  .chips {
    top: auto; bottom: var(--gutter); left: var(--gutter); right: auto;
    max-width: calc(100vw - var(--card-w) - 3 * var(--gutter));
    flex-wrap: nowrap; overflow-x: auto; padding: 0; scrollbar-width: none;
  }
  .scrubber { display: none; }
  .card {
    top: calc(var(--gutter) + 54px); bottom: var(--gutter); left: auto; right: var(--gutter);
    width: var(--card-w); height: auto; max-height: none;
    border-radius: var(--radius); border-bottom: 1px solid var(--border);
  }
  .card-teaser { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html.no-gl .pub.current { background: none; box-shadow: none; }
html.poster .masthead { max-width: none; }
