/* ==========================================================================
   "Signal" theme for Weiyi Wang's homepage (layered on top of al-folio v1.2)

   Idea: the research turns everyday device signals into sensing, so the look
   borrows from measurement instruments: a graphite base, one signal colour,
   monospace read-outs and hairline grids. Everything is static; the only
   motion is short hover/focus feedback. Dark is the default, light is optional.

   This file lives outside assets/css/ on purpose: PurgeCSS only processes
   assets/css/*.css, so classes added at runtime here are never stripped.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-wght.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  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: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  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;
}

/* ---------- tokens: dark (default, also without JS) ---------- */
html:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", var(--font-sans);
  --wrap: 1120px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 10px;
  --nav-h: 60px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
  --bg: #0a0d12;
  --bg-2: #0d1118;
  --surface: #10151d;
  --surface-2: #161c26;
  --line: #212934;
  --line-2: #303a48;
  --text: #e7ecf3;
  --text-2: #b6c0cd;
  --muted: #8a95a6;
  --accent: #4fd1e0;
  --accent-2: #8be6f0;
  --accent-soft: rgba(79, 209, 224, 0.1);
  --accent-line: rgba(79, 209, 224, 0.4);
  --on-accent: #03141a;
  --warm: #f0b955;
  --warm-soft: rgba(240, 185, 85, 0.1);
  --warm-line: rgba(240, 185, 85, 0.38);
  --grid: rgba(148, 163, 184, 0.075);
  --plate: #eef1f4;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.75);

  /* al-folio components (CV, figures, ToC, search) follow the same palette */
  --global-bg-color: var(--bg);
  --global-code-bg-color: var(--surface-2);
  --global-text-color: var(--text);
  --global-text-color-light: var(--muted);
  --global-theme-color: var(--accent);
  --global-hover-color: var(--accent);
  --global-hover-text-color: var(--on-accent);
  --global-footer-bg-color: var(--bg);
  --global-footer-text-color: var(--muted);
  --global-footer-link-color: var(--text-2);
  --global-divider-color: var(--line);
  --global-card-bg-color: var(--surface);
  --global-highlight-color: var(--accent);
}

/* ---------- tokens: light ---------- */
html:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --bg-2: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --line: #dde3ea;
  --line-2: #c3ccd7;
  --text: #0e1621;
  --text-2: #344050;
  --muted: #5a6676;
  --accent: #0b7285;
  --accent-2: #095c6b;
  --accent-soft: rgba(11, 114, 133, 0.09);
  --accent-line: rgba(11, 114, 133, 0.38);
  --on-accent: #ffffff;
  --warm: #935800;
  --warm-soft: rgba(147, 88, 0, 0.08);
  --warm-line: rgba(147, 88, 0, 0.35);
  --grid: rgba(15, 23, 42, 0.055);
  --plate: #ffffff;
  --shadow: 0 16px 36px -24px rgba(15, 23, 42, 0.35);
}

/* ---------- base ---------- */
html {
  scroll-padding-top: calc(var(--nav-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body.tech {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html[lang="zh-CN"] body.tech {
  line-height: 1.8;
}

body.tech main.tmain {
  flex: 1 0 auto;
  width: 100%;
  margin: 0;
  padding: 0;
}

body.tech a {
  color: var(--accent);
  text-decoration: none;
}

body.tech a:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.tech :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

body.tech ::selection {
  background: var(--accent-soft);
  color: var(--text);
}

body.tech h1,
body.tech h2,
body.tech h3,
body.tech h4 {
  color: var(--text);
  text-wrap: balance;
}

.wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mono {
  font-family: var(--font-mono);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 400;
  padding: 0.45rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 6px;
}

.skip-link:focus {
  left: 0.5rem;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- header / navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.tnav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--nav-h);
}

body.tech a.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  color: var(--accent);
}

.tnav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

body.tech .tnav-links a {
  display: block;
  padding: 0.38rem 0.62rem;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

body.tech .tnav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

body.tech .tnav-links a.is-active {
  color: var(--text);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 -2px 0 var(--accent);
}

.tnav-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

body.tech .tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 34px;
  min-width: 34px;
  padding: 0 0.6rem;
  margin: 0;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 0.8rem/1 var(--font-mono);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

body.tech .tool-btn:hover {
  border-color: var(--accent-line);
  color: var(--text);
  text-decoration: none;
}

body.tech #search-shortcut {
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.12rem 0.32rem;
  box-shadow: none;
}

#light-toggle .icon-sun,
#light-toggle .icon-moon {
  display: none;
}

html[data-theme="dark"] #light-toggle .icon-sun,
html:not([data-theme]) #light-toggle .icon-sun,
html[data-theme="light"] #light-toggle .icon-moon {
  display: inline-block;
}

.site-header #progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  display: block;
  width: 100%;
  height: 2px;
  margin: 0;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: var(--accent);
  pointer-events: none;
}

.site-header #progress::-webkit-progress-bar {
  background: transparent;
}

.site-header #progress::-webkit-progress-value {
  background: var(--accent);
}

.site-header #progress::-moz-progress-bar {
  background: var(--accent);
}

@media (max-width: 900px) {
  .tnav-inner {
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
    padding-block: 0.55rem 0.35rem;
  }

  .tnav-tools {
    margin-left: auto;
  }

  .tnav-links {
    order: 3;
    width: 100%;
    margin: 0 0 0 -0.5rem;
  }

  body.tech .tnav-links a {
    padding: 0.32rem 0.5rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 600px) {
  .tnav-inner {
    padding-block: 0.45rem 0.2rem;
  }

  .tnav-links {
    gap: 0;
    margin-left: -0.4rem;
  }

  body.tech .tnav-links a {
    padding: 0.28rem 0.4rem;
    font-size: 0.84rem;
  }
}

@media (max-width: 420px) {
  body.tech #search-shortcut {
    display: none;
  }

  body.tech .tool-btn {
    height: 32px;
    min-width: 32px;
    padding: 0 0.5rem;
  }
}

@media (max-width: 360px) {
  body.tech .tnav-links a {
    padding: 0.26rem 0.3rem;
    font-size: 0.8rem;
  }
}

/* ---------- shared bits ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.16rem 0.55rem;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font: 500 0.75rem/1.5 var(--font-mono);
  white-space: nowrap;
}

.chip-accent {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.chip-warm {
  color: var(--warm);
  border-color: var(--warm-line);
  background: var(--warm-soft);
}

.chip-venue {
  color: var(--text);
}

body.tech .tbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 34px;
  padding: 0 0.8rem;
  margin: 0;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 500 0.8rem/1 var(--font-mono);
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

body.tech .tbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

body.tech .tbtn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

body.tech .tbtn-primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--on-accent);
}

body.tech .tbtn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

body.tech .tbtn-sm {
  height: 30px;
  padding: 0 0.65rem;
  font-size: 0.76rem;
}

body.tech .link-arrow {
  font: 500 0.8rem/1.4 var(--font-mono);
  white-space: nowrap;
}

.sub-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 2.25rem 0 1rem;
  font: 600 0.78rem/1.4 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sub-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- home: hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(2.5rem, 7vw, 5rem) 0;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.hero::before,
.page-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(130% 95% at 78% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(130% 95% at 78% 0%, #000 30%, transparent 78%);
  pointer-events: none;
}

.hero > .wrap,
.page-band > .wrap {
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  grid-template-areas:
    "head photo"
    "rest photo";
  column-gap: clamp(1.5rem, 5vw, 4rem);
  row-gap: 0;
  align-items: start;
}

.hero-head {
  grid-area: head;
  min-width: 0;
}

.hero-rest {
  grid-area: rest;
  min-width: 0;
}

.hero-photo {
  grid-area: photo;
}

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  color: var(--text-2);
  font: 500 0.8rem/1.55 var(--font-mono);
  letter-spacing: 0.02em;
}

.eyebrow .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}

.hero-name {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 6.2vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.hero-alt {
  display: block;
  margin-top: 0.6rem;
  font: 500 clamp(0.95rem, 1.7vw, 1.08rem)/1.3 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hero-tagline {
  margin: 0 0 0.9rem;
  max-width: 36ch;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.15rem, 2.1vw, 1.42rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--text);
}

html[lang="zh-CN"] .hero-tagline {
  max-width: 26em;
  letter-spacing: 0.01em;
}

.hero-summary {
  margin: 0 0 1.25rem;
  max-width: 64ch;
  color: var(--text-2);
}

html[lang="zh-CN"] .hero-summary {
  max-width: 40em;
}

.readout {
  display: grid;
  gap: 0.35rem;
  margin: 1.5rem 0 0;
  padding: 0.15rem 0 0.15rem 0.95rem;
  border-left: 2px solid var(--accent);
  font: 400 0.86rem/1.55 var(--font-mono);
}

.readout > div {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
}

.readout dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.readout dd {
  margin: 0;
  overflow-wrap: anywhere;
}

body.tech .readout a {
  color: var(--text);
  border-bottom: 1px dashed var(--line-2);
}

body.tech .readout a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.frame {
  position: relative;
  padding: 10px;
}

.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--accent);
  pointer-events: none;
}

.frame::before {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}

.frame::after {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
}

.frame figure,
.frame picture {
  display: block;
  margin: 0;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-2);
}

.frame-cap {
  margin: 0.45rem 0 0;
  text-align: right;
  font: 500 0.68rem/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.trace {
  display: flex;
  align-items: center;
  margin-top: clamp(2rem, 5vw, 3rem);
  color: var(--accent);
}

.trace svg {
  flex: none;
  display: block;
}

.trace::after {
  content: "";
  flex: 1;
  height: 1.4px;
  background: linear-gradient(90deg, var(--accent-line), var(--line) 60%);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 1.1rem 1.25rem 1.5rem 0;
}

.stat + .stat {
  padding-left: 1.25rem;
  border-left: 1px solid var(--line);
}

.stat-value {
  font: 600 clamp(1.9rem, 3.3vw, 2.45rem)/1.05 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text);
}

.stat-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.stat-note {
  font: 400 0.74rem/1.5 var(--font-mono);
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 180px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 104px;
    grid-template-areas:
      "head photo"
      "rest rest";
    column-gap: 1.1rem;
    align-items: end;
  }

  .hero-name {
    margin-bottom: 0.4rem;
  }

  .hero-rest {
    padding-top: 1.1rem;
  }

  .hero-name {
    font-size: clamp(2.1rem, 10vw, 2.6rem);
  }

  .frame {
    padding: 6px;
  }

  .frame::before,
  .frame::after {
    width: 14px;
    height: 14px;
  }

  .frame-cap {
    display: none;
  }

  .stat,
  .stat + .stat {
    padding: 0.9rem 0.8rem 1.1rem 0;
  }

  .stat:nth-child(even) {
    padding-left: 0.9rem;
  }
}

/* ---------- home: sections ---------- */
.section {
  padding-block: clamp(2.75rem, 6vw, 4.25rem);
}

.section + .section {
  border-top: 1px solid var(--line);
}

.sec-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin-bottom: 0.5rem;
}

.sec-num {
  font: 500 0.8rem/1 var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.sec-title {
  margin: 0;
  font: 600 clamp(1.5rem, 2.8vw, 2rem)/1.15 var(--font-display);
  letter-spacing: -0.02em;
}

.sec-more {
  margin-left: auto;
}

.sec-sub {
  margin: 0 0 1.6rem;
  max-width: 70ch;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- publications (bib.liquid) ---------- */
body.tech ol.bibliography {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.tech ol.bibliography > li {
  margin: 0;
  padding: 0;
}

body.tech h2.bibliography {
  margin: 2rem 0 0.75rem;
  font: 600 0.8rem/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  color: var(--muted);
}

.pub {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  gap: 1.4rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.pub:hover {
  border-color: var(--line-2);
}

.pub-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  aspect-ratio: 4 / 3;
  padding: 8px;
  background: var(--plate);
  border-radius: 6px;
  overflow: hidden;
}

.pub-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.pub-preprint {
  grid-template-columns: 168px minmax(0, 1fr);
  padding: 1rem 1.25rem;
}

.pub-preprint .pub-thumb {
  aspect-ratio: 16 / 10;
}

.pub-body {
  min-width: 0;
}

.pub-chips {
  margin-bottom: 0.65rem;
}

.pub-system {
  display: block;
  margin-bottom: 0.15rem;
  font: 600 0.8rem/1.4 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--accent);
}

.pub-title {
  margin: 0 0 0.45rem;
  font: 600 1.08rem/1.42 var(--font-display);
  letter-spacing: -0.005em;
}

body.tech .pub-title a {
  color: var(--text);
}

body.tech .pub-title a:hover {
  color: var(--accent);
}

.pub-tldr {
  margin: 0 0 0.55rem;
  color: var(--text-2);
  font-size: 0.95rem;
}

.pub-authors {
  margin: 0 0 0.1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.pub-authors .me {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.pub-venue {
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.pub-venue em {
  font-style: normal;
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pub-panel {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 0.9rem;
}

.pub-panel[hidden] {
  display: none;
}

.pub-panel p {
  margin: 0;
}

.pub-panel figure.highlight,
.pub-panel .highlight,
.pub-panel pre {
  position: relative;
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 400 0.78rem/1.6 var(--font-mono);
  color: var(--text-2);
}

.pub-panel pre code {
  font: inherit;
  background: transparent;
  color: inherit;
}

body.tech .pub-panel button.copy {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  opacity: 1;
}

@media (max-width: 720px) {
  .pub,
  .pub-preprint {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding: 1rem;
  }

  .pub-thumb,
  .pub-preprint .pub-thumb {
    aspect-ratio: auto;
    max-height: 200px;
  }

  .pub-thumb img {
    max-height: 184px;
  }
}

/* ---------- demos ---------- */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.demo-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.demo-card:hover {
  border-color: var(--accent-line);
}

body.tech a.demo-media {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #05070a;
  overflow: hidden;
  text-decoration: none;
}

.demo-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
  transition: transform 0.35s var(--ease), opacity 0.2s;
}

.demo-media:hover img,
.demo-media:focus-visible img {
  opacity: 1;
  transform: scale(1.02);
}

.demo-play {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.95rem;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.7);
}

.demo-play i {
  transform: translateX(1px);
}

.demo-dur {
  position: absolute;
  right: 10px;
  bottom: 12px;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font: 500 0.72rem/1.4 var(--font-mono);
}

.demo-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.1rem 1.15rem;
}

.demo-tag {
  margin: 0;
  font: 600 0.7rem/1.4 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.demo-title {
  margin: 0;
  font: 600 1.06rem/1.35 var(--font-display);
}

.demo-desc {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: var(--text-2);
}

.demo-body .link-arrow {
  margin-top: auto;
}

@media (max-width: 980px) {
  .demo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .demo-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* video dialog */
dialog.demo-dialog {
  width: min(960px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  overflow: hidden;
}

dialog.demo-dialog[data-orientation="portrait"] {
  width: min(460px, calc(100vw - 2rem));
}

dialog.demo-dialog::backdrop {
  background: rgba(3, 6, 10, 0.74);
}

.demo-dialog-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
}

.demo-dialog-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font: 600 1rem/1.35 var(--font-display);
}

.demo-dialog-head form {
  margin: 0;
}

.demo-dialog video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 11rem);
  background: #000;
}

.demo-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem 0.9rem;
}

.demo-dialog-foot p {
  flex: 1 1 18rem;
  margin: 0;
  color: var(--text-2);
  font-size: 0.9rem;
}

/* inline videos on project pages */
.video-figure {
  margin: 1.25rem 0 1.75rem;
}

.video-figure video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.video-figure.is-portrait video {
  width: min(360px, 100%);
  aspect-ratio: 9 / 16;
}

.video-figure figcaption {
  margin-top: 0.55rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.video-figure figcaption .mono {
  color: var(--accent);
  margin-right: 0.5rem;
}

/* ---------- experience & honours ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 5vw, 3.5rem);
}

.split .sub-head:first-child {
  margin-top: 0;
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.6rem;
  bottom: 0.9rem;
  width: 1px;
  background: var(--line-2);
}

.tl-item {
  position: relative;
  padding: 0 0 1.35rem 1.75rem;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42rem;
  box-sizing: border-box;
  width: 11px;
  height: 11px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.tl-period {
  margin: 0;
  font: 500 0.78rem/1.5 var(--font-mono);
  letter-spacing: 0.03em;
  color: var(--accent);
}

.tl-org {
  margin: 0.1rem 0 0.05rem;
  font: 600 1.02rem/1.4 var(--font-display);
  color: var(--text);
}

.tl-role {
  margin: 0;
  color: var(--text-2);
  font-size: 0.93rem;
}

.tl-detail {
  margin: 0.2rem 0 0;
  font: 400 0.78rem/1.55 var(--font-mono);
  color: var(--muted);
}

.honor-list,
.award-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.honor-list li,
.award-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding: 0.68rem 0;
  border-bottom: 1px solid var(--line);
}

.honor-name,
.award-name {
  color: var(--text);
  font-size: 0.95rem;
}

.honor-year,
.award-year {
  font: 500 0.78rem/1.5 var(--font-mono);
  color: var(--muted);
  white-space: nowrap;
}

.lead-note {
  margin: 1rem 0 0;
  color: var(--text-2);
  font-size: 0.9rem;
}

.lead-note .mono {
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 0.5rem;
}

.award-group + .award-group {
  margin-top: 2.25rem;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- news ---------- */
.news-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.news-item {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--line);
}

.news-date {
  padding-top: 0.12rem;
  font: 500 0.82rem/1.6 var(--font-mono);
  color: var(--accent);
}

.news-body {
  min-width: 0;
  color: var(--text-2);
}

.news-body p {
  margin: 0;
}

.news-body strong {
  color: var(--text);
}

.news-photos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  max-width: 600px;
  margin-top: 0.8rem;
}

.news-list.is-compact .news-photos {
  grid-template-columns: repeat(2, minmax(0, 150px));
  gap: 0.5rem;
}

.news-photos a {
  display: block;
}

.news-photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
}

@media (max-width: 560px) {
  .news-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }
}

/* ---------- inner pages ---------- */
.page-band {
  position: relative;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.page-head {
  padding-block: clamp(2rem, 5vw, 3.25rem) clamp(1.5rem, 3.5vw, 2.25rem);
}

.crumbs {
  margin: 0 0 0.8rem;
  font: 500 0.8rem/1.4 var(--font-mono);
  color: var(--muted);
}

.crumbs .prompt {
  color: var(--accent);
}

body.tech .crumbs a {
  color: var(--muted);
}

body.tech .crumbs a:hover {
  color: var(--accent);
}

.page-title {
  margin: 0 0 0.6rem;
  font: 600 clamp(2rem, 4.6vw, 3rem)/1.08 var(--font-display);
  letter-spacing: -0.025em;
}

.page-desc {
  max-width: 70ch;
  margin: 0;
  color: var(--text-2);
  font-size: 1.04rem;
}

.page-head .chip-row {
  margin-top: 1.1rem;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin: 1.4rem 0 0;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.metric-strip > div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
}

.metric-strip dd {
  margin: 0;
  font: 600 1.5rem/1.1 var(--font-display);
  letter-spacing: -0.015em;
  color: var(--text);
}

.metric-strip dt {
  font: 400 0.74rem/1.45 var(--font-mono);
  color: var(--muted);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.page-body {
  padding-block: clamp(1.75rem, 4vw, 2.75rem) 0;
}

/* long-form text on project / CV / misc pages */
.prose {
  max-width: 860px;
}

.prose > :first-child,
.page-wide > :first-child {
  margin-top: 0;
}

.prose h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 2.6rem 0 0.9rem;
  font: 600 1.42rem/1.25 var(--font-display);
  letter-spacing: -0.015em;
}

.prose h2::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--accent);
}

.prose h3 {
  margin: 2rem 0 0.6rem;
  font: 600 1.14rem/1.3 var(--font-display);
}

.prose p,
.prose li {
  color: var(--text-2);
}

.prose strong {
  color: var(--text);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose li::marker {
  color: var(--accent);
}

.prose figure {
  margin: 1.25rem 0;
}

.prose figure img,
.prose figure picture img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--plate);
}

.prose .caption,
.prose figcaption {
  margin: 0.5rem 0 1.5rem;
  text-align: left;
  font-size: 0.86rem;
  color: var(--muted);
}

.prose .row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 0;
}

.prose .row > [class*="col"] {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  margin-top: 0 !important;
  padding: 0;
}

.prose .row > .col-sm-7 {
  flex-grow: 7;
}

.prose .row > .col-sm-5 {
  flex-grow: 5;
}

.prose .row > .col-sm-8 {
  flex: 0 1 66%;
}

.prose .row > .col-sm-9 {
  flex: 0 1 75%;
}

.prose .justify-content-sm-center {
  justify-content: center;
}

.prose .row figure {
  margin: 0;
}

@media (max-width: 575px) {
  .prose .row > [class*="col"],
  .prose .row > .col-sm-8,
  .prose .row > .col-sm-9 {
    flex-basis: 100%;
  }
}

.photo-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.photo-pair figure {
  margin: 0;
}

.photo-pair img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.photo-pair figcaption {
  margin-top: 0.45rem;
  font: 500 0.76rem/1.5 var(--font-mono);
  color: var(--muted);
}

@media (max-width: 575px) {
  .photo-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

.refs {
  padding-top: 2.5rem;
}

/* ---------- projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s var(--ease);
}

.project-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

body.tech a.project-media {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  padding: 10px;
  background: var(--plate);
}

.project-media img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.project-media.is-photo {
  padding: 0;
}

.project-media.is-photo img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1.1rem 1.2rem;
}

.project-title {
  margin: 0;
  font: 600 1.22rem/1.3 var(--font-display);
}

body.tech .project-title a {
  color: var(--text);
}

body.tech .project-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.project-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-2);
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  margin: auto 0 0;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line-2);
}

.metric-row > div {
  display: flex;
  flex-direction: column-reverse;
}

.metric-row dd {
  margin: 0;
  font: 600 1.02rem/1.25 var(--font-display);
  color: var(--text);
}

.metric-row dt {
  font: 400 0.7rem/1.4 var(--font-mono);
  color: var(--muted);
}

@media (max-width: 980px) {
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- CV page (al_folio_cv output + downloads) ---------- */
.with-toc {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  padding-top: 2rem;
}

.with-toc.toc-right {
  grid-template-columns: minmax(0, 1fr) 210px;
}

body.tech #toc-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
  font-size: 0.86rem;
}

body.tech #toc-sidebar a {
  color: var(--muted);
}

body.tech #toc-sidebar a:hover,
body.tech #toc-sidebar .is-active-link {
  color: var(--accent);
}

.cv-page .post-header {
  display: none;
}

body.tech .cv .card {
  margin-top: 1rem !important;
  padding: 1.1rem 1.25rem !important;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

body.tech .cv .card-title {
  margin: 0 0 0.6rem;
  font: 600 1.15rem/1.3 var(--font-display);
  color: var(--text);
}

body.tech .cv .list-group-item {
  padding-inline: 0;
  background: transparent;
  border-color: var(--line);
}

body.tech .cv .badge {
  font: 600 0.72rem/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  border-radius: 5px;
}

body.tech .cv h6 {
  color: var(--text-2);
}

body.tech .cv h6.title {
  color: var(--text);
}

body.tech .table-dark {
  color: inherit;
  background: transparent;
}

body.tech .table-cv {
  width: 100%;
}

body.tech .table-cv td {
  overflow-wrap: anywhere;
}

.cv-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

body.tech .post-header {
  margin-bottom: 1.5rem;
}

body.tech .post-title {
  margin: 0 0 0.4rem;
  font: 600 clamp(2rem, 4.6vw, 3rem)/1.08 var(--font-display);
  letter-spacing: -0.025em;
  color: var(--text);
}

body.tech .post-description {
  color: var(--text-2);
}

@media (max-width: 860px) {
  .with-toc,
  .with-toc.toc-right {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  body.tech #toc-sidebar {
    position: static;
  }
}

/* ---------- search dialog ---------- */
body.tech #site-search {
  width: min(38rem, calc(100% - 2rem));
  max-height: min(32rem, 88vh);
  padding: 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

body.tech #site-search::backdrop {
  background: rgba(3, 6, 10, 0.6);
}

.search-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}

.search-heading h2 {
  margin: 0;
  font: 600 0.8rem/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

body.tech .search-close {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

body.tech #site-search-input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
}

body.tech #site-search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.search-results {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

body.tech .search-results a {
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  color: var(--text);
}

body.tech .search-results a:hover,
body.tech .search-results a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

#site-search-empty {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

/* ---------- footer ---------- */
.site-footer {
  flex-shrink: 0;
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 1.6rem 2rem;
  border-top: 1px solid var(--line);
  font: 400 0.76rem/1.7 var(--font-mono);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
}

body.tech .site-footer a {
  color: var(--text-2);
}

body.tech .site-footer a:hover {
  color: var(--accent);
}

/* ---------- 404 ---------- */
.notfound-code {
  font: 600 clamp(3.5rem, 12vw, 6rem)/1 var(--font-display);
  letter-spacing: -0.04em;
  color: var(--accent);
  margin: 0;
}

/* ---------- theme switch: quick colour fade instead of al-folio's 750 ms ---------- */
html.transition,
html.transition *,
html.transition *::before,
html.transition *::after {
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease !important;
  transition-delay: 0s !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .trace,
  .demo-play {
    display: none !important;
  }

  body.tech {
    background: #fff;
    color: #000;
  }
}
