/* ============================================================
   KMnO4-zx — personal homepage
   Palette: Kimi ambassador-wall inspired
   bg #E1E3E6 · ink #002F5B · accent #007CFF / #00A1FF / #00F6FF
   ============================================================ */

:root {
  --bg: #e3e5e9;
  --bg-deep: #d8dbe0;
  --surface: #ffffff;
  --ink: #002f5b;
  --ink-soft: rgba(0, 47, 91, 0.68);
  --ink-faint: rgba(0, 47, 91, 0.45);
  --accent: #007cff;
  --accent-2: #00a1ff;
  --accent-3: #00f6ff;
  --hairline: rgba(0, 47, 91, 0.12);
  --card-shadow: 0 1px 2px rgba(0, 47, 91, 0.05), 0 4px 14px rgba(0, 47, 91, 0.06);
  --card-shadow-hover: 0 2px 4px rgba(0, 47, 91, 0.07), 0 14px 34px rgba(0, 47, 91, 0.14);
  --serif: "Sentient", "LXGW WenKai", Georgia, "Times New Roman", serif;
  --sans: "Inter Variable", "Inter", "LXGW WenKai", -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  --mono: "Geist Mono Variable", "Geist Mono", "LXGW WenKai", "SFMono-Regular", Consolas, "Courier New", monospace;
  --sidebar-w: minmax(300px, 5fr);
  --content-w: minmax(0, 7fr);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(0, 124, 255, 0.22); }

.mono { font-family: var(--mono); font-feature-settings: "ss01"; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover { color: var(--accent-2); border-bottom-color: currentColor; }

a:focus-visible, .note:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- mouse spotlight ---------- */
.spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    560px circle at var(--mx, 50%) var(--my, 30%),
    rgba(0, 161, 255, 0.10),
    rgba(0, 246, 255, 0.045) 42%,
    transparent 68%
  );
}

/* ---------- layout ---------- */
.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--content-w);
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(3rem, 9vh, 6rem) 0 clamp(2rem, 5vh, 3.5rem);
}

.eyebrow-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 2.6rem;
  margin-bottom: 0.9rem;
}
.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.eyebrow::before { content: "● "; color: var(--accent-2); }

/* language toggle */
.lang-toggle { font-size: 0.78rem; letter-spacing: 0.04em; white-space: nowrap; }
.lang-btn {
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0.1rem;
  font: inherit;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.lang-btn:hover { color: var(--accent); }
.lang-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.lang-sep { color: var(--ink-faint); margin: 0 0.15rem; }

.identity {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 1.3rem 0 0.9rem;
}
.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(0, 124, 255, 0.35);
  box-shadow: 0 6px 18px rgba(0, 47, 91, 0.16);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.avatar:hover { transform: scale(1.05); border-color: var(--accent); }

.name {
  font-family: "LXGW WenKai", var(--serif);
  font-size: clamp(2rem, 3.2vw, 2.4rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.name sub { font-size: 0.55em; }

.role {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--accent);
  margin-top: 0.55rem;
}
.role .amp { color: var(--accent); font-style: normal; }

.tagline {
  margin-top: 1.1rem;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* nav */
.nav { margin-top: clamp(2rem, 6vh, 3.5rem); }
.nav ul { list-style: none; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  color: var(--ink-faint);
  border: none;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}
.nav-num { font-size: 0.72rem; color: var(--accent-2); opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .25s; }
.nav-line { display: inline-block; width: 2rem; height: 1px; background: currentColor; transition: width 0.3s ease, background 0.3s ease; }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link:hover .nav-line, .nav-link.active .nav-line { width: 3.5rem; background: var(--accent); }
.nav-link:hover .nav-num, .nav-link.active .nav-num { opacity: 1; transform: translateX(0); }

/* sidebar bottom */
.social { list-style: none; display: flex; align-items: center; gap: 1.15rem; }
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--ink-soft);
  border: none;
  transition: color 0.2s ease, transform 0.2s ease;
}
.social a:hover { color: var(--accent); transform: translateY(-2px); }
.social svg { display: block; }
.motto-line {
  margin-top: 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-faint);
}

/* ---------- content ---------- */
.content { padding: clamp(3rem, 9vh, 6rem) 0 2rem; min-width: 0; }

.section { margin-bottom: clamp(4.5rem, 12vh, 8rem); scroll-margin-top: 3rem; }

.sec-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 2rem;
}
.sec-head h2 {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.sec-num { color: var(--accent-2); font-size: 1rem; }
.sec-line { flex: 1; height: 1px; background: var(--hairline); }
/* align the first content row with the sidebar's eyebrow row */
.content > .section:first-child > .sec-head { min-height: 2.6rem; }

/* about */
.about-body p { color: var(--ink-soft); margin-bottom: 1.1rem; max-width: 62ch; }
.about-body strong { color: var(--ink); font-weight: 600; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.chip {
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.chip:hover { transform: translateY(-2px); border-color: var(--accent-2); }

/* experience */
.xp-list { list-style: none; }
.xp-item {
  display: grid;
  grid-template-columns: 8.75rem 1fr;
  gap: 1.2rem;
  align-items: center;
  padding: 1.1rem 0;
  border-top: 1px solid var(--hairline);
}
.xp-item:first-child { border-top: none; }
.xp-period { font-size: 0.78rem; color: var(--ink-faint); letter-spacing: 0.02em; text-align: center; }
.xp-card h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 0.45rem; }
.xp-org { color: var(--accent); }
.xp-card ul { list-style: none; }
.xp-card li {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.95rem;
  padding-left: 1.1rem;
  margin-bottom: 0.3rem;
}
.xp-card li::before { content: "▹"; position: absolute; left: 0; color: var(--accent-2); }

/* publications */
.pubs { margin-top: 2.4rem; }
.pubs-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 1rem;
}
.pub-list { list-style: none; }
.pub-list li {
  padding: 0.85rem 0;
  border-top: 1px solid var(--hairline);
}
.pub-list a { font-weight: 500; color: var(--ink); }
.pub-list a:hover { color: var(--accent); }
.pub-venue { display: block; font-size: 0.76rem; color: var(--ink-faint); margin-top: 0.25rem; }

/* projects */
.proj-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}
.proj-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  color: var(--ink);
  box-shadow: var(--card-shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.proj-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(0, 124, 255, 0.35);
  color: var(--ink);
}
.proj-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.7rem; }
.proj-folder { color: var(--accent-2); font-size: 0.9rem; }
.proj-stars { font-size: 0.75rem; color: var(--ink-faint); min-height: 1em; }
.proj-stars:not(:empty)::before { content: "★ "; color: var(--accent-2); }
.proj-card h3 { font-family: var(--mono); font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.proj-card p { font-size: 0.9rem; color: var(--ink-soft); }
.proj-more { margin-top: 1.4rem; font-size: 0.85rem; }

/* ---------- notes wall ---------- */
.notes-hint { color: var(--ink-soft); max-width: 58ch; margin-bottom: 1.6rem; }
.notes-hint strong { color: var(--ink); }

.notes-wall {
  position: relative;
  height: 640px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(0, 47, 91, 0.035), rgba(0, 47, 91, 0) 22%),
    var(--surface);
  border: 1px solid var(--hairline);
  box-shadow:
    inset 0 2px 10px rgba(0, 47, 91, 0.07),
    inset 0 0 60px rgba(0, 47, 91, 0.03);
  overflow: hidden;
}

.note {
  position: absolute;
  width: 205px;
  min-height: 150px;
  padding: 2.1rem 1.05rem 1rem;
  background: #ffffff;
  border-radius: 3px;
  box-shadow:
    0 1px 2px rgba(0, 47, 91, 0.10),
    0 6px 16px rgba(0, 47, 91, 0.12),
    0 16px 38px rgba(0, 47, 91, 0.10);
  transform: rotate(var(--rot, 0deg));
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: box-shadow 0.2s ease;
}
.note:hover {
  box-shadow:
    0 2px 4px rgba(0, 47, 91, 0.12),
    0 12px 28px rgba(0, 47, 91, 0.18),
    0 26px 60px rgba(0, 47, 91, 0.16);
}
.note.dragging {
  cursor: grabbing;
  transition: none;
  box-shadow:
    0 4px 8px rgba(0, 47, 91, 0.16),
    0 20px 46px rgba(0, 47, 91, 0.26),
    0 40px 90px rgba(0, 47, 91, 0.22);
}
/* semi-transparent paper tape */
.note::before {
  content: "";
  position: absolute;
  top: -0.55rem;
  left: 50%;
  width: 5.4rem;
  height: 1.5rem;
  transform: translateX(-50%) rotate(var(--tape-rot, -1.5deg));
  background: linear-gradient(180deg, rgba(0, 161, 255, 0.28), rgba(0, 124, 255, 0.20));
  border-left: 2px dashed rgba(255, 255, 255, 0.65);
  border-right: 2px dashed rgba(255, 255, 255, 0.65);
  box-shadow: 0 1px 3px rgba(0, 47, 91, 0.10);
}
.note p {
  font-family: var(--serif);
  font-size: 0.94rem;
  line-height: 1.6;
  color: #173a5e;
}
.note .note-tag {
  display: block;
  margin-top: 0.55rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* footer */
.footer {
  border-top: 1px solid var(--hairline);
  padding-top: 1.4rem;
  margin-top: 2rem;
}
.footer p { font-size: 0.76rem; color: var(--ink-faint); letter-spacing: 0.03em; }

/* ---------- scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar {
    position: static;
    height: auto;
    padding: 3.2rem 0 0;
  }
  .tagline { max-width: 52ch; }
  .nav { display: none; }
  .sidebar-bottom { margin-top: 1.6rem; }
  .content { padding-top: 3rem; }
}

@media (max-width: 640px) {
  .xp-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .proj-grid { grid-template-columns: 1fr; }
  .notes-wall {
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    padding: 2.4rem 1rem;
  }
  .note {
    position: static;
    width: min(250px, 88%);
    cursor: default;
    touch-action: auto;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .spotlight { display: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
