/* ---------- Tokens ---------- */
:root {
  --bg: #fbf8f3;
  --surface: #ffffff;
  --surface-2: #f2eee8;
  --text: #1b1a17;
  --muted: #5d5952;
  --faint: #78736b;
  --line: #e7e1d8;
  --accent: #0f5466;
  --link: #0f5466;
  --on-accent: #ffffff;
  --accent-inverse: #6fc3d1;
  --tint: #e2eef0;

  --radius: 20px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-y: clamp(64px, 9vw, 112px);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --shadow: 0 1px 0 rgba(27, 26, 23, 0.04), 0 24px 48px -32px rgba(27, 26, 23, 0.28);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141210;
    --surface: #1c1a17;
    --surface-2: #25221e;
    --text: #f2eee8;
    --muted: #b6aea3;
    --faint: #8e877d;
    --line: #2e2a25;
    --accent: #6fc3d1;
    --link: #8fd3de;
    --on-accent: #06222a;
    --accent-inverse: #0f5466;
    --tint: #15303a;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 24px 48px -32px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141210;
  --surface: #1c1a17;
  --surface-2: #25221e;
  --text: #f2eee8;
  --muted: #b6aea3;
  --faint: #8e877d;
  --line: #2e2a25;
  --accent: #6fc3d1;
  --link: #8fd3de;
  --on-accent: #06222a;
  --accent-inverse: #0f5466;
  --tint: #15303a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 24px 48px -32px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { text-decoration-thickness: 2.5px; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { margin: 0; font-family: var(--display); text-wrap: balance; }

img { max-width: 100%; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.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 {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); text-decoration: none;
}
.skip:focus { top: 12px; }

section[id], [id="academic"] { scroll-margin-top: 80px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }

.nav-inner { position: relative; display: flex; align-items: center; gap: 12px; height: 68px; }

.brand {
  margin-right: auto;
  font: 800 25px/1 var(--display); letter-spacing: -0.04em;
  color: var(--text); text-decoration: none;
}
.brand span { color: var(--accent); }

.menu { display: flex; align-items: center; gap: 2px; }
.menu a {
  padding: 8px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: color 0.15s, background-color 0.15s;
}
.menu a:hover, .menu a.active { color: var(--text); background: var(--surface-2); }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-cta {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); text-decoration: none; font-size: 15px; font-weight: 600;
  transition: background-color 0.15s, color 0.15s;
}
.nav-cta:hover { background: var(--accent); color: var(--on-accent); }

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color 0.15s;
}
.icon-btn:hover { border-color: var(--text); }
.menu-toggle { display: none; }
.menu .menu-contact { display: none; }
@media (max-width: 420px) {
  .nav-cta { display: none; }
  .menu .menu-contact { display: block; }
}

.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

@media (max-width: 1100px) {
  .menu-toggle { display: grid; }
  .menu {
    display: none; position: absolute; top: 64px; left: var(--gutter); right: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  }
  .menu.open { display: flex; }
  .menu a { padding: 12px 14px; font-size: 16px; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(36px, 7vw, 88px) 0 clamp(48px, 7vw, 88px); overflow-x: clip; }

.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px); align-items: center;
}

.pill {
  display: inline-block; margin: 0 0 22px; padding: 8px 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--muted);
}

h1 {
  font-size: clamp(2.6rem, 7.4vw, 5.4rem); line-height: 0.95;
  letter-spacing: -0.045em; font-weight: 800; margin-bottom: 26px;
}

.nowrap { white-space: nowrap; }
.hl { position: relative; white-space: nowrap; }
.hl svg {
  position: absolute; left: -2%; bottom: -0.1em; width: 104%; height: 0.3em;
  fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; overflow: visible;
}
.js .hl path { stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw 0.9s 0.3s cubic-bezier(0.6, 0, 0.3, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.wave { display: inline-block; transform-origin: 70% 75%; }
.js .wave { animation: wave 1.8s 0.9s ease-in-out 2; }
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  10%, 30% { transform: rotate(16deg); }
  20%, 40% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg); }
}

.lede {
  font-size: clamp(1.1rem, 1.9vw, 1.35rem); line-height: 1.5;
  color: var(--muted); max-width: 40ch; margin: 0 0 28px;
}

.meta { margin: 22px 0 0; font-size: 15px; color: var(--faint); font-weight: 500; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 24px; border-radius: 999px;
  border: 1.5px solid var(--text); background: transparent; color: var(--text);
  font: 600 16px/1.2 var(--font); text-decoration: none; cursor: pointer; text-align: center;
  transition: background-color 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 0 var(--text); text-decoration: none; }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.portrait { position: relative; margin: 0; justify-self: center; width: min(100%, 390px); rotate: 2deg; }
.portrait::before {
  content: ""; position: absolute; inset: 6% -5% -5% 8%;
  border-radius: 32px; background: var(--tint); rotate: -6deg; z-index: -1;
}
.portrait img {
  display: block; width: 100%; height: auto; aspect-ratio: 510 / 645; object-fit: cover;
  border-radius: 28px; border: 6px solid var(--surface); box-shadow: var(--shadow);
}

.sticker {
  position: absolute; padding: 9px 14px; border-radius: 999px; white-space: nowrap;
  font: 700 14px/1 var(--display); letter-spacing: -0.01em;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--text); box-shadow: var(--shadow);
}
.sticker-phd { right: -6%; top: 7%; rotate: 9deg; }
.sticker-oss { left: -7%; top: 27%; rotate: -5deg; }
.sticker-std { left: -9%; bottom: 17%; rotate: -7deg; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sticker-geo { right: -3%; bottom: 5%; rotate: 5deg; background: var(--tint); border-color: transparent; color: var(--link); }

@media (max-width: 1100px) {
  .portrait::before { inset: 6% -3% -5% 8%; }
  .sticker-phd { right: -2%; }
}
@media (max-width: 860px) {
  .sticker { font-size: 12px; padding: 7px 11px; }
  .sticker-oss, .sticker-std { left: -3%; }
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { width: min(62%, 250px); justify-self: start; margin-left: 6px; }
}

/* ---------- Shared section pieces ---------- */
.section { padding-block: var(--section-y) 0; }
main > .section:last-child { padding-bottom: var(--section-y); }

h2 {
  font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.04;
  letter-spacing: -0.04em; font-weight: 800; margin-bottom: 32px; max-width: 20ch;
}
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; margin-bottom: 32px; }
.section-head h2 { margin-bottom: 0; }
.now-label {
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--link); padding: 6px 12px; border-radius: 999px; background: var(--tint);
}
.section-sub { margin: -14px 0 32px; color: var(--muted); max-width: 60ch; font-size: 1.08rem; }
.note { color: var(--muted); font-size: 15px; margin: 24px 0 0; max-width: 70ch; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(20px, 2.4vw, 28px);
}
.card p { margin: 0; color: var(--muted); }
.kicker {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--link);
}
.card .kicker { color: var(--link); margin-bottom: 10px; }
.label {
  font: 700 13px/1 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
  margin: 0 0 16px;
}
.card h3:not(.label) { font-size: 1.3rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin-bottom: 10px; }
.more-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  font-weight: 600; text-decoration: none; color: var(--link);
}
.more-link:hover { text-decoration: underline; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--text);
}
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; color: var(--muted); }
.plain-list b { color: var(--text); font-weight: 600; }

/* ---------- What I do ---------- */
.do-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.do-card { display: flex; flex-direction: column; }
.do-card .more-link { margin-top: auto; padding-top: 16px; }
.do-primary { background: var(--tint); border-color: transparent; }
.do-primary p { color: var(--text); }

.facts {
  list-style: none; margin: 40px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px;
}
.facts strong {
  display: block; font: 800 clamp(1.8rem, 3.4vw, 2.5rem)/1 var(--display); letter-spacing: -0.04em;
  color: var(--accent); font-variant-numeric: tabular-nums; margin-bottom: 6px;
}
.facts span { font-size: 14.5px; color: var(--muted); font-weight: 500; }

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

/* ---------- Standards contributions ---------- */
.section.std {
  background: var(--surface-2); border-block: 1px solid var(--line);
  padding-bottom: var(--section-y); margin-top: var(--section-y);
}
.std-stats {
  list-style: none; margin: 0 0 32px; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
.std-stats li { border-top: 3px solid var(--accent); padding-top: 14px; }
.std-stats strong { display: block; font: 800 clamp(2rem, 4vw, 2.8rem)/1 var(--display); letter-spacing: -0.04em; margin-bottom: 6px; }
.std-stats span { color: var(--muted); font-size: 15px; font-weight: 600; line-height: 1.35; display: block; }

.std-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.std-card-wide { grid-column: span 2; }
.std-card p:not(.kicker) { font-size: 15.5px; line-height: 1.6; }

.std-docs { display: grid; gap: 10px; }
.std-docs details { border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.std-docs summary {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer; list-style: none;
  font: 700 1.05rem/1.3 var(--display); letter-spacing: -0.01em;
}
.std-docs summary::-webkit-details-marker { display: none; }
.std-docs summary::after { content: "+"; margin-left: auto; font: 600 1.4rem/1 var(--font); color: var(--faint); transition: transform 0.2s; }
.std-docs details[open] summary::after { transform: rotate(45deg); }
.std-docs summary span {
  font: 700 12px/1 var(--font); padding: 5px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
}
.std-docs ul { list-style: none; margin: 0; padding: 0 20px 14px; }
.std-docs li { padding: 9px 0; border-top: 1px dashed var(--line); font-size: 15px; line-height: 1.5; }
.std-docs li a, .std-docs li b {
  display: inline-block; margin-right: 8px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.std-docs li em { display: block; font-style: normal; color: var(--faint); font-size: 13.5px; }
.std-note { margin: 0; padding: 0 20px 16px; color: var(--muted); font-size: 14px; }

.std-logos { margin-top: 40px; }
.std-logos-title {
  margin: 0 0 14px; font: 700 13px/1.3 var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint);
}
.standards-logos {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px;
}
.standards-logos img { display: block; width: 100%; height: auto; border-radius: 12px; }

@media (max-width: 980px) {
  .std-stats, .std-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .std-cards { grid-template-columns: minmax(0, 1fr); }
  .std-card-wide { grid-column: auto; }
  .standards-logos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Experience ---------- */
.journey { list-style: none; margin: 0; padding: 0; position: relative; }
.journey::before {
  content: ""; position: absolute; left: 180px; top: 12px; bottom: 12px;
  border-left: 2px dashed var(--line);
}
.stop { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0 40px; padding: 0 0 36px; position: relative; }
.stop:last-child { padding-bottom: 0; }
.stop::before {
  content: ""; position: absolute; left: 174px; top: 8px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--bg); border: 2.5px solid var(--faint);
}
.stop.current::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); }
.stop-when { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding-right: 24px; }
.stop-years { font: 700 15px/1.4 var(--display); color: var(--text); }
.stop-place {
  font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.stop.current .stop-place { background: var(--accent); color: var(--on-accent); }
.stop-body h3 { font-size: 1.3rem; line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; margin-bottom: 8px; }
.stop-body h3 span { color: var(--muted); font-weight: 600; }
.stop-body p { margin: 0; color: var(--muted); max-width: 66ch; }

.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 48px; }

@media (max-width: 760px) {
  .journey::before { left: 6px; }
  .stop { grid-template-columns: minmax(0, 1fr); padding-left: 32px; gap: 10px; }
  .stop::before { left: 0; top: 4px; }
  .stop-when { flex-direction: row; align-items: center; gap: 10px; padding: 0; }
  .skills { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Projects ---------- */
.std-stats.proj-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; }
.proj-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.proj-academic {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; margin-top: 16px;
}
.proj-list { list-style: none; margin: 0; padding: 0; }
.proj-list li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-top: 1px dashed var(--line); }
.proj-list li:first-child { border-top: 0; padding-top: 0; }
.proj-when { font: 700 14px/1.45 var(--display); color: var(--link); font-variant-numeric: tabular-nums; }
.proj-list b { display: block; font-weight: 600; line-height: 1.4; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.proj-list div > span { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.proj-list .pi {
  font-style: normal; font-weight: 700; font-size: 12.5px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
}

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

/* ---------- Talks ---------- */
.talk-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px;
}
.talk-list li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); }
.talk-year { font: 800 1.25rem/1.3 var(--display); color: var(--accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.talk-list b { display: block; font-weight: 600; line-height: 1.4; }
.talk-list div > span { display: block; margin-top: 3px; color: var(--muted); font-size: 14.5px; }

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

/* ---------- Publications ---------- */
.featured { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 28px; }
.featured:empty { display: none; }
.feat {
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.feat:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.feat-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--link); text-transform: uppercase; letter-spacing: 0.05em; }
.feat-top span:last-child { font: 800 1.25rem/1 var(--display); letter-spacing: -0.02em; color: var(--text); text-transform: none; }
.feat-title { font: 700 1.15rem/1.3 var(--display); letter-spacing: -0.015em; }
.feat-venue { margin-top: auto; color: var(--muted); font-size: 14px; }

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

.pub-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 8px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--muted);
  font: 600 14px/1 var(--font); cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); border-color: var(--text); }
.chip .n { font-size: 12px; color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip[aria-pressed="true"] .n { color: color-mix(in srgb, var(--bg) 65%, transparent); }

.search { position: relative; flex: 1 1 220px; max-width: 300px; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input {
  width: 100%; height: 42px; padding: 0 16px 0 40px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); font: 400 15px var(--font);
}
.search input::placeholder { color: var(--faint); }

@media (max-width: 640px) { .search { max-width: none; flex-basis: 100%; } }

.pub-year {
  display: flex; align-items: center; gap: 14px; margin: 36px 0 6px;
  font: 800 1.4rem/1 var(--display); letter-spacing: -0.03em; color: var(--text);
}
.pub-year::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }

.pub-group { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px;
  padding: 16px 18px; margin: 0 -18px; border-radius: 16px; transition: background-color 0.15s;
}
.pub:hover { background: var(--surface); }
.pub-title { color: var(--text); font-weight: 600; letter-spacing: -0.01em; line-height: 1.45; text-decoration: none; }
.pub-title:hover { color: var(--link); text-decoration: underline; }
.pub-authors { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.pub-authors b { color: var(--text); font-weight: 700; }
.pub-venue { margin: 2px 0 0; color: var(--faint); font-size: 14.5px; font-style: italic; line-height: 1.5; }
.pub-award { font-style: normal; font-weight: 700; color: var(--link); }
.pub-kind {
  align-self: start; white-space: nowrap;
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: var(--tint); color: var(--link);
}
.pub-empty { color: var(--muted); margin: 32px 0 0; }

@media (max-width: 560px) {
  .pub { grid-template-columns: minmax(0, 1fr); margin-inline: -10px; padding-inline: 10px; }
  .pub-kind { justify-self: start; order: -1; }
}

.more { margin-top: 24px; }

/* ---------- Photos ---------- */
.gallery {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 210px; grid-auto-flow: dense; gap: 14px;
}
.photo { position: relative; margin: 0; border-radius: 18px; overflow: hidden; background: var(--surface-2); }
.photo-tall { grid-row: span 2; }
.photo-wide { grid-column: span 2; }
.gallery.collapsed .photo-more { display: none; }
.photo a { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.photo img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.photo:hover img { transform: scale(1.05); }
.photo figcaption {
  position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px);
  padding: 6px 12px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text); font-size: 13.5px; font-weight: 600; line-height: 1.3;
  pointer-events: none;
}

@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 170px; }
}
@media (max-width: 480px) {
  .gallery { grid-auto-rows: 140px; gap: 10px; }
  .photo figcaption { font-size: 12px; padding: 5px 10px; left: 8px; bottom: 8px; }
}

.lightbox {
  width: min(92vw, 1100px); max-height: 92vh; padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); overflow: hidden;
}
.lightbox::backdrop { background: rgba(10, 9, 8, 0.82); }
.lightbox img { display: block; width: 100%; max-height: calc(92vh - 56px); object-fit: contain; background: #000; }
.lightbox-caption { margin: 0; padding: 14px 18px; font-weight: 600; }
.lightbox-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer;
}

/* ---------- Contact ---------- */
.contact-card {
  position: relative; overflow: hidden;
  border-radius: 32px; padding: clamp(32px, 6vw, 72px);
  background: var(--text); color: var(--bg);
}
.contact-card::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px;
  border-radius: 50%; background: var(--accent); opacity: 0.85;
}
.contact-card > * { position: relative; z-index: 1; }
.contact-card .avatar {
  display: block; width: 104px; height: 104px; margin-bottom: 20px;
  border-radius: 50%; object-fit: cover; object-position: center 30%;
  border: 4px solid var(--accent-inverse);
}
.contact-card h2 { font-size: clamp(2.6rem, 7vw, 5rem); margin-bottom: 18px; }
.contact-card .lede { color: color-mix(in srgb, var(--bg) 78%, transparent); max-width: 42ch; margin-bottom: 30px; }
.contact-card .btn-primary { background: var(--accent-inverse); border-color: var(--accent-inverse); color: var(--text); }
.contact-card .btn-primary:hover { box-shadow: 0 4px 0 var(--bg); }
.contact-card .btn-ghost { color: var(--bg); border-color: color-mix(in srgb, var(--bg) 60%, transparent); }
.contact-card .btn-ghost:hover { border-color: var(--bg); box-shadow: 0 4px 0 var(--bg); }
.links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 34px; }
.links a { color: var(--bg); font-weight: 600; text-decoration: none; opacity: 0.8; }
.links a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Subpages ---------- */
.page-head { padding-top: clamp(32px, 5vw, 56px); }
.back-link { display: inline-flex; gap: 6px; margin-bottom: 20px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.page-title { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1; letter-spacing: -0.045em; font-weight: 800; margin-bottom: 28px; }
.page-head .section-sub { margin-top: 0; }

/* ---------- Footer ---------- */
.footer { padding: 0 0 40px; color: var(--faint); font-size: 14px; }
main > .section:last-child + .footer, .footer { margin-top: 0; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; }
.motto { font-weight: 600; }

/* ---------- Motion ---------- */
.js .reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js .wave { animation: none; }
  .js .hl path { animation: none; stroke-dashoffset: 0; }
  .btn:hover, .feat:hover, .photo:hover img { transform: none; }
}
