/* ============================================================
   Palette & tokens
   Colors adapted from graceluo.net; layout metrics from
   pingchuan.ma's template.
   Dark theme is the site default; light is the toggle choice.
   ============================================================ */
:root {
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;
  --bg: #121414;
  --bg-band: #17191a;          /* band behind the Research section */
  --link: #8fb3c9;             /* steel blue (lightened for dark bg) */
  --link-hover: #f8b364;       /* warm apricot */
  --award: #ff8fa3;            /* award / highlight red */
  --toggle-track: #24282a;
  --toggle-thumb: #628ea7;
  --code-bg: #1d2022;
  --thumb-ring: rgba(143, 179, 201, 0.55);
  --ph-bg: #1e2426;            /* placeholder image background */
  --ph-fg: #4a5d68;            /* placeholder image foreground */
  --card-border: rgba(255, 255, 255, 0.08);

  --page-width: 768px;
  --font-size: 15px;
  --line-height: 1.65;
  --name-size: 32px;
  --section-title-size: 20px;
  --code-size: 12px;
}

:root[data-theme="light"] {
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --bg: #ffffff;
  --bg-band: #fafafa;
  --link: #628ea7;
  --link-hover: #f8b364;
  --award: #f14668;
  --toggle-track: #f1f1ee;
  --toggle-thumb: #628ea7;
  --code-bg: #f1f1ee;
  --thumb-ring: rgba(98, 142, 167, 0.55);
  --ph-bg: #e7edf1;
  --ph-fg: #9db6c4;
  --card-border: rgba(31, 41, 55, 0.12);
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Libre Franklin", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--text);
  background: var(--bg);
}

::selection { background: rgba(248, 179, 100, 0.35); }

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--link-hover); }

img { max-width: 100%; }

sup { font-size: 0.7em; }

.section { padding: 40px 0; }

.container {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 20px;
}

.section-title {
  font-size: var(--section-title-size);
  font-weight: 700;
  margin: 0;
}

.section-sub {
  color: var(--text-muted);
  font-size: 0.9em;
}

/* ============================================================
   Home / header
   ============================================================ */
#home { padding-top: 56px; }

.home-row {
  display: flex;
  align-items: center;
  gap: 36px;
}

.home-photo {
  flex: 0 0 180px;
}
.home-photo img,
.home-photo svg {
  width: 100%;
  border-radius: 3px;
  display: block;
}

.home-info .name {
  font-size: var(--name-size);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 14px;
}

.home-info > div { margin: 2px 0; }

/* Contact icon row (from graceluo.net) */
.profile-links {
  display: flex;
  gap: 14px;
  margin-top: 12px;
}
.profile-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--link);
  transition:
    transform 0.25s cubic-bezier(0.68, -0.4, 0.265, 1.4),
    color 0.2s ease;
}
.profile-links a:hover {
  color: var(--link-hover);
  transform: translateY(-2px) rotate(-6deg);
}
.profile-links svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 4px;
  margin-left: 6px;
  line-height: 1;
  vertical-align: middle;
  transition: color 0.15s ease, transform 0.25s cubic-bezier(0.68, -0.4, 0.265, 1.4);
}
.theme-toggle-btn:hover {
  color: var(--link-hover);
  transform: translateY(-2px) rotate(-12deg);
}
.theme-toggle-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  vertical-align: 1px;
}

/* Icon reflects the current theme (as on pingchuan.ma):
   moon while dark (the site default), sun while light */
.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn .icon-moon { display: inline; }
:root[data-theme="light"] .theme-toggle-btn .icon-sun { display: inline; }
:root[data-theme="light"] .theme-toggle-btn .icon-moon { display: none; }

.bio { margin-top: 26px; }
.bio p { margin: 0 0 10px; }

/* Ph.D.-seeking announcement */
.hiring-note {
  color: var(--award);
  font-weight: 600;
}
.hiring-note a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hiring-note a:hover { color: var(--link-hover); }

/* ============================================================
   Research statement selector ("How do you see AI?")
   Interaction pattern from akoepke.github.io/cave_umwelten
   ============================================================ */
.stmt-card {
  background: var(--code-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 22px 26px 20px;
  margin-top: 16px;
}

.stmt-question {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.stmt-buttons {
  position: relative;
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 30px;
}

.stmt-hint {
  position: absolute;
  top: 0;
  left: 14%;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--award);
  transform: rotate(-14deg);
  pointer-events: none;
  line-height: 1.1;
}

@keyframes stmt-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

.stmt-btn {
  padding: 7px 22px;
  min-width: 150px;
  text-align: center;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  animation: stmt-pulse 1.8s ease-in-out infinite;
}

.stmt-btn[data-stmt="engineering"] {
  border: 2px solid rgba(98, 142, 167, 0.5);
  background: rgba(98, 142, 167, 0.08);
}
.stmt-btn[data-stmt="engineering"]:hover {
  border-color: rgba(98, 142, 167, 0.9);
  transform: translateY(-1px);
}
.stmt-btn[data-stmt="engineering"].active {
  background: #628ea7;
  border-color: #628ea7;
  color: #fff;
}

.stmt-btn[data-stmt="science"] {
  border: 2px solid rgba(248, 179, 100, 0.55);
  background: rgba(248, 179, 100, 0.08);
}
.stmt-btn[data-stmt="science"]:hover {
  border-color: rgba(248, 179, 100, 0.95);
  transform: translateY(-1px);
}
.stmt-btn[data-stmt="science"].active {
  background: #f8b364;
  border-color: #f8b364;
  color: #1f2937;
}

/* once a pill has been clicked: stop pulsing, hide the hint */
.stmt-card.clicked .stmt-btn { animation: none; }
.stmt-card.clicked .stmt-hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .stmt-btn { animation: none; }
}

.stmt-panel {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}
.stmt-panel p { margin: 0 0 10px; }
.stmt-panel p:last-child { margin-bottom: 0; }

.stmt-topic {
  margin: 12px 0 0;
  padding-left: 14px;
  border-left: 3px solid rgba(98, 142, 167, 0.55);
}
#stmt-science .stmt-topic { border-left-color: rgba(248, 179, 100, 0.6); }
.stmt-topic-name { font-weight: 700; }
.stmt-topic-tag {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95em;
}
.stmt-topic p { margin: 2px 0 0; }

/* ============================================================
   Research
   ============================================================ */
#research { background: var(--bg-band); }

.research-note {
  font-size: 0.9em;
  color: var(--text-muted);
}

/* Author annotation marks (†, ✉) */
.mark-mail {
  width: 0.95em;
  height: 0.95em;
  fill: currentColor;
  vertical-align: -0.1em;
}
sup.author-mark { font-size: 0.7em; }
sup.author-mark .mark-mail {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.15em;
}

/* Selected / All pill toggle (from graceluo.net) */
.project-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 2px;
  margin: 6px 0 6px;
  background-color: var(--toggle-track);
  border-radius: 14px;
}

.project-toggle-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  background-color: var(--toggle-thumb);
  border-radius: 12px;
  transform: translateX(0);
  transition: transform 0.25s ease, width 0.25s ease;
  pointer-events: none;
  z-index: 0;
}

.project-toggle-option {
  position: relative;
  z-index: 1;
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 5px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}
.project-toggle-option:focus { outline: none; }
.project-toggle-option:hover:not(.is-active) { color: var(--text); }
.project-toggle-option.is-active { color: #fff; }

/* Publication entries (text-only, structure from pingchuan.ma) */
.pub-item { margin-top: 20px; }

.pub-title {
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 2px;
}
.pub-title a,
.pub-title span {
  color: var(--text);
  font-weight: 700;
}
.pub-title a:hover { color: var(--link-hover); }

.pub-authors { color: var(--text-muted); }
.pub-authors a { color: var(--text-muted); }
.pub-authors a:hover { color: var(--link-hover); }
.pub-authors .me { font-weight: 700; }

.pub-links .venue {
  font-weight: 700;
  color: var(--text);
}

.pub-award { color: var(--award); }

/* Collapsible abstract */
.abs-panel {
  margin-top: 8px;
  background: var(--code-bg);
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 0.92em;
}
.abs-panel p { margin: 0; }

/* Collapsible BibTeX */
.bibtex {
  position: relative;
  margin-top: 8px;
}
.snippet {
  background: var(--code-bg);
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: var(--code-size);
  line-height: 1.5;
  border-radius: 3px;
  padding: 10px 12px;
  margin: 0;
  overflow-x: auto;
}
.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--thumb-ring);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { opacity: 1; border-color: var(--link); }

/* ============================================================
   Education / Experience (structure from pingchuan.ma)
   ============================================================ */
#education { padding-bottom: 0; }

.exp-item { margin-top: 18px; }

.exp-title { font-weight: 700; }
.exp-title a { color: var(--text); }
.exp-title a:hover { color: var(--link-hover); }

.exp-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.exp-time {
  text-align: right;
  white-space: nowrap;
}
.exp-location { color: var(--text-muted); }

/* ============================================================
   Footer
   ============================================================ */
footer {
  padding: 32px 0 44px;
  color: var(--text-muted);
  font-size: 12px;
}
footer .container p { margin: 2px 0; }

/* ============================================================
   Mobile
   ============================================================ */
@media (max-width: 640px) {
  body { font-size: 16px; }

  #home { padding-top: 36px; }

  .home-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .home-photo { flex: none; width: 180px; }

  .exp-row { flex-direction: column; gap: 0; }
  .exp-time {
    text-align: left;
    color: var(--text-muted);
  }
  .exp-location { display: none; }
}
