/* Layout: a pixel-art landscape header, then one calm reading column (profile, then publications). */
:root {
  --paper: #f5f2ea;
  --ink: #232d2a;
  --muted: #5d6763;
  --faint: #8e9792;
  --line: #d8d4c7;
  --accent: #b4472e;
  --shadow: #dde4da;
  --thumb-bg: #ffffff;
  --card: #faf8f2;
  --frame: #c9cfc4;
  --pixel: "Pixelify Sans", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141b25;
    --ink: #e6e3da;
    --muted: #a7afb3;
    --faint: #737e88;
    --line: #2d3847;
    --accent: #e8866c;
    --shadow: #222c3a;
    --thumb-bg: #e9e6de;
    --card: #19212d;
    --frame: #334052;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #141b25;
  --ink: #e6e3da;
  --muted: #a7afb3;
  --faint: #737e88;
  --line: #2d3847;
  --accent: #e8866c;
  --shadow: #222c3a;
  --thumb-bg: #e9e6de;
  --card: #19212d;
  --frame: #334052;
  color-scheme: dark;
}

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Colours cross-fade only while the theme is switching (theme.js adds .theme-anim), never on load. */
@media (prefers-reduced-motion: no-preference) {
  .theme-anim body,
  .theme-anim .pub,
  .theme-anim .pub-thumb,
  .theme-anim .theme-toggle {
    transition: background-color 1.2s ease, color 1.2s ease, box-shadow 1.2s ease;
  }
}

/* ---------- header scene ---------- */

.scene {
  position: relative;
  overflow: hidden;
  line-height: 0;
  background: var(--paper);
}

.scene canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.site-nav {
  position: absolute;
  top: 22px;
  right: max(20px, calc((100% - 880px) / 2 + 20px));
  display: flex;
  align-items: center;
  gap: 26px;
  font: 500 15px/1 var(--mono);
  letter-spacing: 0.02em;
}

/* Nav sits on the sky, so it uses fixed sky-safe colours per theme rather than page tokens. */
.site-nav {
  --nav-ink: #2b3633;
  --nav-chip: rgba(245, 242, 234, 0.55);
}

:root[data-theme="dark"] .site-nav {
  --nav-ink: #e6e3da;
  --nav-chip: rgba(20, 27, 37, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .site-nav {
    --nav-ink: #e6e3da;
    --nav-chip: rgba(20, 27, 37, 0.45);
  }
}

.site-nav a {
  color: var(--nav-ink);
  text-decoration: none;
  padding: 6px 2px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: var(--nav-chip);
  color: var(--nav-ink);
  cursor: pointer;
  transition: color 0.15s;
}

.theme-toggle:hover {
  color: var(--accent);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- page ---------- */

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 20px 0;
}

h1,
h2 {
  font-family: var(--pixel);
  font-weight: 500;
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 30px;
  margin-bottom: 36px;
}

h2::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
}

/* ---------- profile ---------- */

.profile {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 52px;
  align-items: start;
  padding-bottom: 80px;
}

.portrait {
  margin: 0;
}

.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  /* stepped "pixel" corners */
  clip-path: polygon(
    0 10px, 5px 10px, 5px 5px, 10px 5px, 10px 0,
    calc(100% - 10px) 0, calc(100% - 10px) 5px, calc(100% - 5px) 5px, calc(100% - 5px) 10px, 100% 10px,
    100% calc(100% - 10px), calc(100% - 5px) calc(100% - 10px), calc(100% - 5px) calc(100% - 5px), calc(100% - 10px) calc(100% - 5px), calc(100% - 10px) 100%,
    10px 100%, 10px calc(100% - 5px), 5px calc(100% - 5px), 5px calc(100% - 10px), 0 calc(100% - 10px)
  );
}

.portrait figcaption {
  margin-top: 12px;
  font: 400 14px/1.4 var(--mono);
  color: var(--muted);
}

.intro {
  min-width: 0;
}

.intro h1 {
  font-size: 58px;
  margin: 2px 0 26px;
}

.intro p {
  margin: 0 0 16px;
  max-width: 34em;
}

.links {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font: 500 16px/1.4 var(--mono);
}

.links a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.links a::before,
.pub-links a::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  background: var(--faint);
  transition: background 0.15s;
}

.links a:hover::before,
.pub-links a:hover::before {
  background: var(--accent);
}

/* ---------- publications ---------- */

.pubs {
  list-style: none;
  margin: 0;
  padding: 0 4px;
  display: grid;
  gap: 40px;
}

/* Each paper sits in a pixel frame: four offset copies of the box draw a border with notched
   corners, and two more make a stepped drop shadow. */
.pub {
  --px: 4px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  align-items: center;
  padding: 24px;
  background: var(--card);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--frame),
    0 var(--px) 0 0 var(--frame),
    calc(var(--px) * -1) 0 0 0 var(--frame),
    var(--px) 0 0 0 var(--frame),
    var(--px) calc(var(--px) * 2) 0 0 var(--shadow),
    calc(var(--px) * 2) var(--px) 0 0 var(--shadow);
}

.pub > div {
  min-width: 0;
}

.pub-thumb {
  display: block;
  max-width: 100%;
  background: var(--thumb-bg);
  border: 1px solid var(--line);
  aspect-ratio: 11 / 5;
  padding: 8px;
  transition: transform 0.15s;
}

.pub-thumb:hover {
  transform: translate(-2px, -2px);
}

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

.pub-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
  text-wrap: balance;
}

.pub-title a {
  text-decoration: none;
}

.pub-authors {
  margin: 0 0 12px;
  font-size: 16.5px;
  color: var(--muted);
}

.pub-authors a {
  text-decoration-color: transparent;
}

.pub-authors a:hover {
  text-decoration-color: currentColor;
}

.pub-authors .me {
  color: var(--ink);
  font-weight: 600;
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  font-size: 16px;
}

.venue {
  display: flex;
  align-items: center;
  height: 60px;
}

.venue img {
  width: auto;
}

/* The SIGGRAPH Asia lockup is wide and dense; ICASSP's has airy feathers. Sized for equal weight. */
.venue-siggraph img {
  height: 42px;
}

.venue-icassp img {
  height: 60px;
}

/* Wordmarks with dark ink get a light-ink twin for the night theme. */
.venue .on-dark {
  display: none;
}

:root[data-theme="dark"] .venue .on-light {
  display: none;
}

:root[data-theme="dark"] .venue .on-dark {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .venue .on-light {
    display: none;
  }

  :root:not([data-theme="light"]) .venue .on-dark {
    display: block;
  }
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.pub-links a {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

/* ---------- footer ---------- */

.site-footer {
  max-width: 880px;
  margin: 104px auto 0;
  padding: 24px 20px 48px;
  font: 400 14px/1.4 var(--mono);
  color: var(--faint);
}

.site-footer::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--line);
  margin-bottom: 24px;
}

/* ---------- smaller screens ---------- */

@media (max-width: 800px) {
  .profile {
    grid-template-columns: 220px 1fr;
    gap: 36px;
  }

  .intro h1 {
    font-size: 48px;
  }

  .pub {
    grid-template-columns: 280px 1fr;
    gap: 24px;
    padding: 20px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .site-nav {
    top: 14px;
    gap: 18px;
    font-size: 14px;
  }

  .theme-toggle {
    width: 34px;
    height: 34px;
  }

  .page {
    padding-top: 28px;
  }

  .profile {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 60px;
  }

  .portrait {
    width: min(240px, 70%);
  }

  .intro h1 {
    font-size: 42px;
    margin-bottom: 20px;
  }

  h2 {
    font-size: 26px;
    margin-bottom: 28px;
  }

  .pubs {
    gap: 44px;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }

  .pub-title {
    font-size: 18.5px;
  }
}
