/* ─────────────────────────────────────────────────────────────
   Jason Jisen Li — shared stylesheet
   ───────────────────────────────────────────────────────────── */

:root {
  --canvas:    #e7ebf1;   /* outer backdrop  */
  --surface:   #f6f8fb;   /* document column */
  --ink:       #12151a;
  --ink-soft:  #454c58;
  --ink-dim:   #79828f;
  --line:      #dce2ea;
  --line-soft: #e9edf2;
  --accent:    #1f6feb;
  --accent-dim: #e6effd;

  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;

  --nav-h: 58px;
  --maxw: 1140px;
  --gut: 44px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background-color: var(--canvas);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* the document column — a defined surface, not a floating block of text */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut) 64px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: calc(100vh - var(--nav-h));
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

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

/* ───────────────────────── Sticky header ───────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(231, 235, 241, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gut);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.wordmark {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.84rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}
.wordmark::before { content: "› "; color: var(--accent); }
.wordmark:hover { color: var(--accent); }

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: block;
  color: var(--ink-dim);
  padding: 6px 11px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links a:hover { color: var(--ink); background: rgba(255,255,255,0.75); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }

/* ───────────────────────── Page head ───────────────────────── */
.masthead {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}
.masthead.compact { padding: 44px 0 34px; }

h1 {
  font-weight: 700;
  font-size: clamp(2.2rem, 5.2vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--ink);
}
h1.page-title { font-size: clamp(2rem, 4.4vw, 2.6rem); }

.lede {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-top: 15px;
  max-width: 66ch;
}

.intro {
  margin-top: 18px;
  max-width: 78ch;
  color: var(--ink-soft);
}
.intro a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.intro a:hover { border-bottom-color: var(--accent); }

/* ───────────────────────── Section blocks ───────────────────────── */
.block {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px 44px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.block:last-of-type { border-bottom: none; }

/* a section with no left-rail label */
.plain-block { padding: 34px 0; }

.block-label {
  position: sticky;
  top: calc(var(--nav-h) + 34px);
  align-self: start;
  height: max-content;
}
.block-label h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.24rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: var(--ink);
}

/* ───────────────────────── Entries ───────────────────────── */
.entry + .entry {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.entry-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  margin-bottom: 7px;
}
.entry-title {
  font-weight: 600;
  font-size: 1.14rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.entry-org {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 5px;
}
.entry-org .sep { color: var(--line); }
.entry-note { color: var(--ink-dim); }

.bullets { list-style: none; margin-top: 14px; }
.bullets li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.62;
  max-width: 84ch;
}
.bullets li:last-child { margin-bottom: 0; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 9px; height: 1px;
  background: #c3ccd8;
}
.lead-line { color: var(--ink); }

/* ───────────────────────── Running lists ───────────────────────── */
.interests, .course-list {
  list-style: none;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.9;
  max-width: 76ch;
}
.interests li, .course-list li { display: inline; }
.interests li:not(:last-child)::after,
.course-list li:not(:last-child)::after {
  content: " · ";
  color: #b4bfcd;
}

/* ───────────────────────── Publication ───────────────────────── */
.pub-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.35;
  color: var(--ink);
  max-width: 54ch;
}
.pub-authors {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 0.97rem;
}
.pub-authors .me { color: var(--ink); font-weight: 600; }
.pub-venue {
  font-size: 0.97rem;
  color: var(--ink-dim);
  margin-top: 2px;
}
.pub-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-top: 12px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.pub-link:hover { border-bottom-color: var(--accent); }

/* ───────────────────────── Buttons ───────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 7px;
  padding: 12px 20px;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.button:hover { background: var(--accent); border-color: var(--accent); }
.button .arrow { transition: transform 0.16s ease; }
.button:hover .arrow { transform: translateX(3px); }

.button.ghost {
  color: var(--ink-soft);
  background: transparent;
  border-color: #c5cedb;
}
.button.ghost:hover { color: var(--accent); border-color: var(--accent); background: transparent; }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.note {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  margin-top: 14px;
}

/* ───────────────────────── Contact ───────────────────────── */
.contact-list { list-style: none; max-width: 62ch; }
.contact-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.contact-list li:first-child { border-top: none; padding-top: 0; }
.contact-list .k {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
}
.contact-list .v {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.contact-list a.v { color: var(--accent); }
.contact-list a.v:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ───────────────────────── Footer ───────────────────────── */
footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-dim);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
footer a:hover { color: var(--accent); }

/* ───────────────────────── Motion ───────────────────────── */
.rise { opacity: 0; transform: translateY(10px); }
.load .rise { animation: rise 0.5s cubic-bezier(.2,.7,.2,1) forwards; }
.masthead .rise:nth-child(1) { animation-delay: .02s; }
.masthead .rise:nth-child(2) { animation-delay: .08s; }
.masthead .rise:nth-child(3) { animation-delay: .14s; }
.masthead .rise:nth-child(4) { animation-delay: .20s; }
.masthead .rise:nth-child(5) { animation-delay: .26s; }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .45s ease, transform .45s ease; }
.reveal.in { opacity: 1; transform: none; }

@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .rise, .reveal { opacity: 1 !important; transform: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

/* ───────────────────────── Responsive ───────────────────────── */
@media (max-width: 900px) {
  :root { --gut: 24px; }
  .block { grid-template-columns: 150px 1fr; gap: 12px 28px; }
}

@media (max-width: 700px) {
  :root { --gut: 20px; }
  body { font-size: 15.5px; }
  .page { border-left: none; border-right: none; padding-bottom: 56px; }
  .masthead { padding: 34px 0 28px; }
  .masthead.compact { padding: 30px 0 26px; }
  .block { grid-template-columns: 1fr; gap: 16px; padding: 26px 0; }
  .block-label { position: static; }
  .contact-list li { grid-template-columns: 1fr; gap: 3px; }
}

@media (max-width: 460px) {
  .nav-inner { gap: 12px; }
  .wordmark { font-size: 0.78rem; }
}
