/* benlonnqvist.github.io: midnight palette with seafoam accents and sparse pixel motifs.
   Colour roles:
   --bg      midnight         page, nav bar, hero, research section
   --panel   raised midnight  About band, research cards, footer, filter box
   --fg      soft white       name, headings, card titles
   --text    blue-gray        paragraphs, subtitles, nav links, counts
   --line    quiet border     dividers, card borders, secondary buttons, portrait frame
   --signal  seafoam          primary button, category labels, markers, link underlines
   --signal2 pale seafoam     inline link text, hover highlights */
:root {
  --bg: #101B24;
  --panel: #172731;
  --fg: #EDF3F2;
  --text: #C0CED4;
  --muted: #C0CED4;
  --line: #344953;
  --soft: #344953;
  --rule: #344953;
  --signal: #A7E6CE;
  --signal2: #B9EBDD;
  --signal-mid: #7DBFA6;
  --signal-ink: #101B24;
  --signal-soft: rgba(167, 230, 206, .10);
  --pixels: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='576' height='576' shape-rendering='crispEdges'%3E%3Crect x='144' y='336' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='144' y='344' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='144' y='360' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='408' y='144' width='8' height='8' fill='rgba(192,206,212,0.04)'/%3E%3Crect x='408' y='152' width='8' height='8' fill='rgba(192,206,212,0.04)'/%3E%3Crect x='416' y='152' width='8' height='8' fill='rgba(192,206,212,0.04)'/%3E%3Crect x='416' y='160' width='8' height='8' fill='rgba(192,206,212,0.04)'/%3E%3Crect x='424' y='160' width='8' height='8' fill='rgba(192,206,212,0.04)'/%3E%3Crect x='288' y='456' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='288' y='464' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='288' y='480' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='192' y='48' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='192' y='56' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='192' y='72' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='480' y='360' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='496' y='360' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='488' y='368' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='480' y='376' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='496' y='376' width='8' height='8' fill='rgba(192,206,212,0.06)'/%3E%3Crect x='24' y='120' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='32' y='120' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='24' y='128' width='8' height='8' fill='rgba(167,230,206,0.07)'/%3E%3Crect x='168' y='168' width='8' height='8' fill='rgba(167,230,206,0.1)'/%3E%3Crect x='176' y='168' width='8' height='8' fill='rgba(167,230,206,0.1)'/%3E%3Crect x='168' y='176' width='8' height='8' fill='rgba(167,230,206,0.1)'/%3E%3Crect x='24' y='384' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='32' y='384' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='24' y='392' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='464' y='480' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='456' y='488' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='464' y='488' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='472' y='488' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3Crect x='464' y='496' width='8' height='8' fill='rgba(167,230,206,0.13)'/%3E%3C/svg%3E");
  /* title face: swap this one line to change the big titles (e.g. 'Instrument Serif', Georgia, serif) */
  --title: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --display: 'Bricolage Grotesque', 'IBM Plex Sans', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --maxw: 1120px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body {
  margin: 0; background-color: var(--bg); color: var(--text);
  background-image: var(--pixels);
  background-size: 576px 576px;
  font: 400 17px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--signal2); text-decoration-color: var(--signal); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
h1, h2, h3 { color: var(--fg); font-family: var(--display); font-weight: 650; line-height: 1.1; text-wrap: balance; margin: 0; }
p { margin: 0; }
/* All titles use Bricolage Grotesque; big ones are heavier and tighter */
h1, .prose h2 { font-family: var(--title); font-weight: 750; letter-spacing: -.02em; }
.wrap { max-width: var(--maxw); margin-inline: auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--fg); color: var(--bg); padding: 6px 10px; z-index: 50; }
.skip:focus { left: 12px; }
.eyebrow, .section-label, .stage, .tag, .chips-label, .count, time, .t-year, .pub-year {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow { color: var(--muted); }
.eyebrow a { color: var(--fg); }
.section-label { font-size: 13px; font-weight: 500; color: var(--fg); display: flex; align-items: center; gap: 10px; }
.section-label::before { content: ""; width: 10px; height: 10px; background: var(--signal); display: inline-block; box-shadow: 10px 0 0 var(--signal-mid); margin-right: 10px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1.5px solid var(--line); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { color: var(--fg); font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: .02em; text-decoration: none; }
.site-header nav { display: flex; align-items: center; gap: 18px; }
.site-header ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 20px; flex-wrap: wrap; font-family: var(--mono); font-size: 14px; }
.site-header ul a { color: var(--text); text-decoration: none; }
.site-header ul a:hover { color: var(--signal); }
.brand:hover { color: var(--signal); }
.site-header ul a[aria-current="page"] { color: var(--signal); }
.site-header ul a[aria-current="page"]::before { content: "["; } .site-header ul a[aria-current="page"]::after { content: "]"; }
@media (max-width: 600px) {
  .bar { padding-block: 10px; gap: 8px; }
  .site-header nav { width: 100%; justify-content: space-between; }
  .site-header ul { gap: 14px; font-size: 13px; flex-wrap: nowrap; }
}

/* Hero */
.hero { padding-block: 56px 40px; display: grid; gap: 22px; position: relative; }
.hero-art { position: absolute; right: max(28px, env(safe-area-inset-right, 0px)); top: calc(50% + 8px); transform: translateY(-50%); width: 260px; max-width: 26%; aspect-ratio: 30 / 22; pointer-events: none; }
.hero-art svg { position: absolute; display: block; will-change: transform; }
.art-net { width: 133%; left: -16%; top: -20%; opacity: .9; }
.art-brain { width: 100%; left: 0; top: 0; }
/* travelling waves: every cortex pixel has a highlight that flashes as the wave front passes (delay set per pixel) */
/* the front crosses the whole brain in about 200 ms (per-pixel delays are scaled down), then waits for the next wave */
.hero-art .w { opacity: 0; animation: wave 2.4s linear infinite; animation-delay: calc(var(--d) * 0.075); }
@keyframes wave { 0% { opacity: 0; } 2% { opacity: .95; } 7% { opacity: .2; } 10%, 100% { opacity: 0; } }
@media (max-width: 1000px) { .hero-art { position: relative; right: auto; top: auto; transform: none; width: 180px; max-width: 50%; order: -1; margin: 10px 0 16px 8%; } }
@media (prefers-reduced-motion: reduce) { .hero-art .w { animation: none; opacity: 0; } }
.hero-id { display: grid; gap: 10px; }
.hero h1 { font-size: clamp(48px, 8.4vw, 104px); line-height: .95; letter-spacing: -.005em; font-weight: 700; text-transform: uppercase; }
.hero-role { font-family: var(--mono); font-size: clamp(14px, 1.6vw, 18px); letter-spacing: .04em; color: var(--muted); }
.hero-role { color: var(--text); }
.lede { font-size: 19px; max-width: 60ch; color: var(--text); }
.page-head .lede { color: var(--muted); font-size: 18px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { font-family: var(--mono); font-size: 14px; text-decoration: none; padding: 9px 16px; border: 2px solid var(--line); background: transparent; color: var(--fg); transition: background-color .15s, color .15s, border-color .15s; }
.btn:hover { background: var(--panel); color: var(--signal); border-color: var(--signal); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--bg); }
.btn.primary:hover { background: var(--signal2); border-color: var(--signal2); color: var(--bg); }

.instrument { margin: 12px 0 0; border: 2px solid var(--rule); background: var(--panel); }
.instrument-foot { display: grid; gap: 10px; padding: 12px 16px 14px; border-top: 1.5px solid var(--rule); }
.goals { display: flex; flex-wrap: wrap; gap: 6px; }
.readout { font-size: 15px; color: var(--muted); max-width: 80ch; min-height: 1.6em; }
#flappy { display: block; width: 100%; height: 340px; cursor: crosshair; touch-action: manipulation; image-rendering: pixelated; }
#flappy:focus-visible { outline-offset: -3px; }

/* Bands & blocks */
.band { border-block: 1.5px solid var(--line); background: var(--panel); padding-block: 44px; }
.about { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }
.portrait { width: 200px; height: 200px; object-fit: cover; border: 2px solid var(--line); filter: grayscale(1) contrast(1.05); transition: filter .3s; }
.portrait:hover { filter: none; }
@media (max-width: 640px) { .about { grid-template-columns: minmax(0, 1fr); } .portrait { width: 140px; height: 140px; } }
.prose { display: grid; gap: 14px; max-width: 68ch; min-width: 0; }
.prose h2 { margin-bottom: 4px; }
.prose img { border: 2px solid var(--line); }
.prose ul { margin: 0; padding-left: 20px; }
.block { padding-block: 48px 8px; display: grid; gap: 20px; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.more { color: var(--text); font-family: var(--mono); font-size: 13px; text-decoration: none; }
.more:hover { color: var(--signal); }
.more:hover { text-decoration: underline; }

/* Research themes */
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1.5px solid var(--line); background: var(--panel); }
.theme { padding: 22px; display: grid; gap: 10px; align-content: start; border-left: 1.5px solid var(--soft); min-width: 0; }
.theme:first-child { border-left: 0; }
.theme h3 { font-size: 24px; }
.theme p:not(.stage) { color: var(--text); font-size: 16px; }
.stage { color: var(--signal); }
@media (max-width: 860px) { .themes { grid-template-columns: minmax(0, 1fr); } .theme { border-left: 0; border-top: 1.5px solid var(--soft); } .theme:first-child { border-top: 0; } }

/* Publications */
.pubs { display: grid; border-top: 1.5px solid var(--line); }
.pub { display: grid; grid-template-columns: 64px minmax(0, 1fr) 128px; gap: 18px; padding: 20px 0; border-bottom: 1.5px solid var(--soft); align-items: start; }
.pub-year { color: var(--muted); padding-top: 4px; }
.pub-title { font-size: 22px; line-height: 1.2; }
.pub-title a { color: var(--fg); text-decoration: none; }
.pub-title a:hover { text-decoration: underline; }
.pub-authors { margin-top: 6px; font-size: 15px; color: var(--muted); }
.pub-authors .me, .talks .me { color: var(--fg); font-weight: 600; }
.pub-venue { font-size: 15px; font-style: italic; color: var(--muted); }
.pub-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip-btn, .chip { font-family: var(--mono); font-size: 12px; line-height: 1; padding: 6px 9px; border: 1.5px solid var(--line); background: transparent; color: var(--text); text-decoration: none; cursor: pointer; border-radius: 0; }
.chip-btn:hover, .chip:hover { border-color: var(--signal); color: var(--signal); }
.chip-btn[aria-expanded="true"] { background: var(--signal); color: var(--bg); border-color: var(--signal); }
.pub-more { margin-top: 12px; padding: 14px 16px; background: var(--signal-soft); border-left: 3px solid var(--signal); font-size: 15px; max-width: 72ch; position: relative; }
.pub-more.bib { background: var(--panel); border: 1.5px solid var(--soft); border-left: 3px solid var(--signal); }
.pub-more pre { margin: 0; overflow-x: auto; font: 12.5px/1.5 var(--mono); padding-right: 64px; }
.pub-more .copy { position: absolute; top: 10px; right: 10px; background: var(--panel); }
.pub-venue-tag { text-align: right; padding-top: 3px; min-width: 0; }
.pub-venue-tag .tag { white-space: normal; text-align: center; }
.tag { display: inline-block; font-size: 11px; padding: 3px 7px; background: var(--fg); color: var(--bg); white-space: nowrap; }
.tag.t-preprint, .tag.t-thesis { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--fg); }
.tag.t-conference { background: var(--signal); color: var(--signal-ink); }
@media (max-width: 640px) {
  .pub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pub-venue-tag { order: -1; text-align: left; display: flex; gap: 8px; }
  .pub-year { order: -2; padding: 0; }
  .pub-title { font-size: 20px; }
}

/* Timeline mode: a vertical signal line with a node per paper */
.timeline .pub { position: relative; }
@media (min-width: 641px) {
  .timeline .pub::before { content: ""; position: absolute; left: 52px; top: 0; bottom: 0; width: 2px; background: var(--soft); }
  .timeline .pub::after { content: ""; position: absolute; left: 48px; top: 27px; width: 10px; height: 10px; background: var(--bg); border: 2px solid var(--text); }
  .timeline .pub[data-first="1"]::after { background: var(--signal); border-color: var(--signal); }
  .timeline .pub { grid-template-columns: 76px minmax(0, 1fr) 128px; }
}
/* Compact mode */
.compact .pub { padding: 10px 0; gap: 14px; align-items: baseline; }
.compact .pub-title { font-size: 17px; }
.compact .pub-authors { margin-top: 2px; font-size: 13px; }
.compact .pub-venue, .compact .pub-actions, .compact .pub-more { display: none; }
.compact .pub::before, .compact .pub::after { display: none; }

.controls { display: grid; gap: 12px; padding: 18px; border: 1.5px solid var(--line); background: var(--panel); margin-top: 24px; }
.search input { width: 100%; font: 16px var(--body); padding: 10px 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--fg); border-radius: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-label { color: var(--muted); width: 52px; }
.chip[aria-pressed="true"] { background: var(--signal); color: var(--bg); border-color: var(--signal); }
.chip .n { opacity: .6; margin-left: 4px; }
.count { color: var(--muted); padding-block: 16px 8px; }
.pub { transition: opacity .35s ease, filter .35s ease; }
.pub.dim { opacity: .3; filter: grayscale(1); }
.pub.dim:hover, .pub.dim:focus-within { opacity: .75; }
.pub:not(.dim):hover .pub-title a { color: var(--signal); }
.pub-sep { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 26px 0 8px; border-bottom: 1.5px dashed var(--soft); }
.chip { transition: background-color .15s, color .15s, border-color .15s; }
.chip:disabled { opacity: .4; cursor: default; }
.empty { padding: 24px 0; color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--fg); text-decoration: underline; text-decoration-color: var(--signal); cursor: pointer; }
.page-head { padding-block: 48px 0; display: grid; gap: 14px; }
.page-head h1 { font-size: clamp(40px, 6vw, 68px); text-transform: uppercase; letter-spacing: -.005em; font-weight: 700; line-height: .98; }

/* Talks */
.talks, .news { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--line); }
.talks li { display: grid; grid-template-columns: 64px 76px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1.5px solid var(--soft); align-items: baseline; }
.t-year { color: var(--muted); }
.t-title { font-weight: 500; }
.tag.k-oral { background: var(--signal); color: var(--signal-ink); }
.tag.k-poster { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--fg); }
@media (max-width: 560px) { .talks li { grid-template-columns: 52px minmax(0, 1fr); } .talks li > div { grid-column: 1 / -1; } }

/* News */
.news li { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1.5px solid var(--soft); align-items: baseline; }
.news time { color: var(--muted); }
.news a { color: var(--fg); text-decoration: none; font-weight: 500; }
.news a:hover { color: var(--signal2); }
.news a:hover { text-decoration: underline; }
.news .tag { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--soft); }
.news-year { display: grid; gap: 12px; margin-bottom: 28px; }
@media (max-width: 560px) { .news li { grid-template-columns: minmax(0, 1fr); gap: 2px; } .news .tag { justify-self: start; } }

/* Post */
.post { padding-block: 48px 24px; display: grid; gap: 28px; }
.post-head { display: grid; gap: 12px; }
.post-head h1 { font-size: clamp(32px, 4.6vw, 52px); max-width: 22ch; line-height: 1.05; }
.prose h2 { font-size: 26px; margin-top: 12px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1.5px solid var(--line); padding-top: 16px; }
.post-nav a { display: grid; gap: 2px; text-decoration: none; font-weight: 500; }
.post-nav .muted { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.post-nav .next { text-align: right; }
.contact p { font-size: 19px; max-width: 60ch; }

/* Footer */
.site-footer { margin-top: 64px; border-top: 1.5px solid var(--line); background: var(--panel); }
.foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 32px; padding-block: 28px; align-items: start; }
.foot-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--mono); font-size: 13px; justify-content: flex-end; }
.foot .small { grid-column: 1 / -1; }
@media (max-width: 640px) { .foot { grid-template-columns: minmax(0, 1fr); } .foot-links { justify-content: flex-start; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
