/* mathisweil.github.io
   The page shares its chrome with the three profile GIFs
   (mathisweil/scripts/render_thesis_gif.py): palette, STIX Two Text
   headlines with one italic key phrase, Source Code Pro caps labels,
   1px hairlines and 6px corner ticks. Two chrome colours stay unused
   on purpose: FAINT #6e7681 and HARM #e66767 (red means "worse"). */

:root {
  --bg: #0d1117;
  --ink: #e6edf3;
  --muted: #8b949e;
  --rule: #30363d;
  --cell: #21262d;
  --accent: #3987e5;
  --tick: var(--rule);
  --serif: "STIX Two Text", "STIX Fallback", Georgia, serif;
  --mono: "Source Code Pro", ui-monospace, Menlo, Consolas, monospace;
}

/* Fonts: self-hosted variable fonts, SIL Open Font License (assets/fonts/) */
@font-face { font-family: "STIX Two Text"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("assets/fonts/stix-two-text.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Text"; font-style: italic; font-weight: 400; font-display: swap; src: url("assets/fonts/stix-two-text-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Code Pro"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("assets/fonts/source-code-pro.woff2") format("woff2"); }
/* Metric-matched fallback so a late swap barely moves the text */
@font-face { font-family: "STIX Fallback"; src: local("Times New Roman"), local("Tinos"), local("Liberation Serif"); size-adjust: 105.3%; ascent-override: 72.4%; descent-override: 22.6%; line-gap-override: 0%; }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 clamp(1.0625rem, 1rem + 0.25vw, 1.125rem) / 1.6 var(--serif);
  font-synthesis: none;
}
h1, h2, h3, p, ul, dl, dd, figure, pre { margin: 0; }
h1, h2, h3 { font-weight: 400; }
strong { font-weight: 600; }
small { font-size: 0.875rem; line-height: 1.5; color: var(--muted); }
img { display: block; max-width: 100%; height: auto; }
a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover, a:focus-visible { color: var(--accent); }
a.primary { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[id] { scroll-margin-top: 2rem; }

/* Mono caps labels, kickers and dates: the GIFs' 13px labels */
.label, .kicker, .dated dt {
  font: 500 0.8125rem / 1.6 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.label.ink { color: var(--ink); }
p > span.label { margin-right: 0.5em; }

/* Page bands: 1128px container, label rail + 848px content on desktop */
.hero, .band, .colophon {
  max-width: 1128px;
  margin: 0 auto;
  padding-inline: clamp(1rem, 4vw, 1.5rem);
}
.band { padding-block: 4rem; border-top: 1px solid var(--rule); }
.band > h2 { margin-bottom: 1.5rem; }
.entry > p, .findings li, .dated dd, figcaption { max-width: 40rem; }

/* Hero */
.hero { padding-block: 4.5rem 3.5rem; }
.hero-text > * + * { margin-top: 1.25rem; }
h1 { font-size: clamp(2.5rem, 1.8rem + 3vw, 4rem); line-height: 1; letter-spacing: -0.015em; }
.tagline { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem); line-height: 1.2; }
.lede, .status { max-width: 40rem; }
.portrait { display: inline-block; padding: 4px; }
.portrait img { width: 120px; height: 120px; object-fit: cover; }

/* Link rows */
.links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.5rem;
  row-gap: 0.25rem;
  list-style: none;
  padding: 0;
  font: 400 0.8125rem / 1.6 var(--mono);
}
.links li { padding-block: 0.25rem; }
.links li:not(:last-child)::after { content: " ·"; color: var(--muted); }
.links .muted { color: var(--muted); }

/* Entries: paper, thesis and project rows share one shape */
.entry > * + * { margin-top: 1rem; }
.entry + .entry { margin-top: 2.5rem; padding-top: 2.5rem; border-top: 1px solid var(--rule); }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.entry-head h3 { font-size: 1.75rem; line-height: 1.2; flex: 1 1 100%; min-width: 0; }
.entry-head h3.small { font-size: 1.25rem; line-height: 1.3; }
.kicker { white-space: nowrap; }
.authors { font-size: 1rem; }
.venue { font-size: 1rem; color: var(--muted); }
.note, .meta { font: 400 0.8125rem / 1.6 var(--mono); }
.note { white-space: nowrap; }
.meta { color: var(--muted); }
.findings { list-style: none; padding: 0; }
.findings li { border-left: 1px solid var(--rule); padding-left: 1rem; }
.findings li + li { margin-top: 0.75rem; }
.projects { list-style: none; padding: 0; }
.projects > .entry + .entry { margin-top: 1.5rem; padding-top: 1.5rem; }
.projects .entry > * + * { margin-top: 0.75rem; }

/* Dated lists (Background) */
.dated {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 1.5rem;
  row-gap: 0.75rem;
  align-items: baseline;
}
.dated small { display: block; }
.dated + .dated { margin-top: 2rem; }

/* Corner ticks: eight 6px strokes, two per corner, no extra markup */
.ticks {
  background:
    linear-gradient(var(--tick), var(--tick)) 0 0 / 6px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 0 0 / 1px 6px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 0 / 6px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 0 / 1px 6px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 0 100% / 6px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 0 100% / 1px 6px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 100% / 6px 1px no-repeat,
    linear-gradient(var(--tick), var(--tick)) 100% 100% / 1px 6px no-repeat;
}

/* Figures: the 840x480 GIFs, 1:1 inside the 848px column */
.fig { padding: 4px; }
.entry > .fig { margin-top: 1.5rem; }
.fig > a { display: block; }
.fig img { width: 100%; max-width: 840px; background: var(--cell); }
figcaption { margin-top: 0.75rem; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }
.fig:hover, .fig:focus-within { --tick: var(--accent); }
@supports (animation-timeline: view()) {
  .fig { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Disclosure and BibTeX */
summary { width: max-content; cursor: pointer; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
summary:hover { color: var(--accent); }
summary::marker { color: var(--muted); }
details[open] summary { margin-bottom: 0.75rem; }
pre {
  padding: 1rem;
  overflow-x: auto;
  font: 400 0.75rem / 1.5 var(--mono);
  background: var(--cell);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

/* Hero plan panel: the MiniHack GIF's token grid, 16 x 4, three fills */
.plan-panel { width: 100%; max-width: 406px; padding: 12px; margin-top: 2.5rem; }
.plan-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.plan-ctl { display: flex; gap: 0.75rem; margin-left: auto; }
.plan-ctl button { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; }
.plan { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; margin-block: 12px; }
.plan i { position: relative; display: block; aspect-ratio: 1; background: var(--rule); transition: background-color 0.25s; }
.plan i::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  clip-path: polygon(20.5% 43.2%, 52.3% 43.2%, 52.3% 27.3%, 79.5% 50%, 52.3% 72.7%, 52.3% 56.8%, 20.5% 56.8%);
  transform: rotate(var(--a, 0deg));
  transition: opacity 0.25s;
}
.plan .m { background: var(--cell); }
.plan .m::before { opacity: 0; }
.plan .n { background: var(--accent); }
.plan [data-d="0"] { --a: -90deg; }
.plan [data-d="1"] { --a: 0deg; }
.plan [data-d="2"] { --a: 90deg; }
.plan [data-d="3"] { --a: 180deg; }
.plan [data-d="4"] { --a: -45deg; }
.plan [data-d="5"] { --a: 45deg; }
.plan [data-d="6"] { --a: 135deg; }
.plan [data-d="7"] { --a: -135deg; }
.plan-panel figcaption { margin-top: 0; }

/* Footer */
.colophon { padding-block: 2rem 3rem; border-top: 1px solid var(--rule); }

/* Desktop: two-column hero, label rail beside each band */
@media (min-width: 900px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) 406px; column-gap: 48px; align-items: center; }
  .plan-panel { margin-top: 0; }
  .band { display: grid; grid-template-columns: 184px minmax(0, 1fr); column-gap: 48px; }
  .band > h2 { margin-bottom: 0; }
  .entry-head { flex-wrap: nowrap; }
  .entry-head h3 { flex: 1 1 0; }
  .kicker { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .plan i, .plan i::before { transition: none; }
  .fig { animation: none; }
}

@media print {
  :root {
    --bg: #fff;
    --ink: #000;
    --muted: #444;
    --rule: #999;
    --cell: #eee;
    --accent: #0b4f9c;
    color-scheme: light;
  }
  body { font-size: 11pt; }
  .hero { padding-block: 1rem 2rem; }
  .band { padding-block: 2rem; }
  .plan-panel, details { display: none; }
  .fig { animation: none; }
  .fig img { max-width: 600px; }
  .fig, .entry-head, .findings li, .dated dt, .dated dd, .projects > li { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .links a[href^="http"]::after, .links a[href$=".pdf"]::after { content: " (" attr(href) ")"; color: var(--muted); overflow-wrap: anywhere; }
}
