/* ============================================================
   Zhenhao Li — personal site
   Shared stylesheet for: index / publications / cv / teaching
   ------------------------------------------------------------
   Design notes (edit freely):
   - Type: SF Pro Display (display) / SF Pro Text (UI & body) /
           JetBrains Mono (BibTeX, metadata)
   - Palette: near-white page, ink body, Prussian blue accent,
              slate blue for secondary metadata
   - Layout: two-column on desktop, single column on mobile
   ============================================================ */

:root {
  /* Palette */
  --ink:        #111111;
  --ink-soft:   #333333;
  --muted:      #888888;
  --hair:       #e2e2de;
  --hair-soft:  #ebebea;
  --paper:      #ffffff;
  --paper-2:    #f2f2f0;
  --accent:     #1a3a5c;        /* Prussian blue */
  --accent-ink: #0f2540;
  --slate:      #4a7090;        /* secondary blue */

  /* Type */
  --serif: "SF Pro Display", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans:  "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* Rhythm */
  --measure: 36rem;
  --gap:     2rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.47;
  font-weight: 400;
  letter-spacing: -0.374px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle page grain via layered gradients */
body {
  background-image:
    radial-gradient(1200px 700px at 85% -10%, rgba(26,58,92,0.04), transparent 60%),
    radial-gradient(900px 600px at -5% 110%, rgba(74,112,144,0.04), transparent 60%);
  background-attachment: fixed;
}

::selection { background: rgba(26,58,92,0.15); color: var(--ink); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(26,58,92,0.30);
  transition: color .15s, border-color .15s, background .15s;
}
a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent-ink);
  background: rgba(26,58,92,0.05);
}

strong { font-weight: 600; }

/* ============================================================
   Layout: two-column page shell
   ============================================================ */
.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 3rem 2.5rem 4rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  column-gap: 5rem;
  align-items: start;
}

@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    padding: 2rem 1.4rem 3rem;
    column-gap: 0;
    row-gap: 2rem;
  }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: sticky;
  top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    top: auto;
    border-bottom: 1px solid var(--hair);
    padding-bottom: 1.5rem;
  }
}

.avatar {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fff 0%, var(--paper-2) 60%, #dde0e4 100%);
  border: 1px solid var(--hair);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.03),
    0 14px 30px -18px rgba(20,40,60,0.18);
}

/* Swap this span with <img src="assets/img/ZhenhaoLi.jpg" alt="Zhenhao Li"> */
.avatar .initials {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 600;
  letter-spacing: -0.28px;
  color: var(--ink);
  line-height: 1.07;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.identity .name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.13rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
  margin: 0 0 0.35rem;
  color: var(--ink);
}
.identity .role {
  font-family: var(--sans);
  font-size: 1.06rem;
  color: var(--muted);
  line-height: 1.47;
  letter-spacing: -0.374px;
  margin: 0;
}
.identity .role a {
  color: var(--muted);
  border-bottom-color: rgba(136,136,136,0.35);
}
.identity .role a:hover {
  color: var(--accent-ink);
  border-bottom-color: var(--accent-ink);
  background: transparent;
}

/* Sidebar nav */
.nav {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.nav li {
  border-top: 1px solid var(--hair-soft);
}
.nav li:first-child { border-top: 0; }

.nav a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0.7rem 0;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: -0.224px;
  color: var(--ink-soft);
  border-bottom: none;
}
.nav a:hover {
  color: var(--accent-ink);
  background: transparent;
}
.nav a .num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}
.nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}
.nav a[aria-current="page"] .num {
  color: var(--accent);
}

.sidebar .meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  line-height: 1.33;
}
.sidebar .meta a {
  color: var(--muted);
  border-bottom-color: rgba(136,136,136,0.3);
}

/* ============================================================
   Main column
   ============================================================ */
.main {
  min-width: 0;
  max-width: 760px;
}

.kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

h1.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.75rem, 5vw, 3.5rem);
  line-height: 1.07;
  letter-spacing: -0.28px;
  margin: 0 0 2rem;
  color: var(--ink);
}

h2.section {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.1;
  color: var(--ink);
  margin: 3rem 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--hair);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
h2.section .rule-count {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
}

/* Body prose */
.prose p {
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
  margin: 0 0 1.1rem;
  max-width: var(--measure);
  color: var(--ink);
}
.prose p.lede {
  font-size: 1.06rem;
  line-height: 1.47;
}

/* ============================================================
   News table (index)
   ============================================================ */
.news {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
}
.news tr {
  border-bottom: 1px solid var(--hair-soft);
}
.news tr:last-child { border-bottom: 0; }
.news td {
  padding: 0.9rem 0;
  vertical-align: top;
  font-size: 1.06rem;
}
.news td.when {
  width: 130px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding-right: 1.2rem;
  padding-top: 1.1rem;
  white-space: nowrap;
}
.news td.what {
  color: var(--ink);
  line-height: 1.47;
  letter-spacing: -0.374px;
}

@media (max-width: 560px) {
  .news td { display: block; width: auto; padding: 0.2rem 0; }
  .news td.when { padding-top: 0.9rem; }
  .news td.what { padding-bottom: 0.9rem; }
}

/* ============================================================
   Publications
   ============================================================ */
.year-group {
  margin: 2.2rem 0 2.6rem;
}
.year-head {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 600;
  font-style: normal;
  color: var(--slate);
  margin: 0 0 1rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.pub-list {
  list-style: none;
  counter-reset: pubs;
  padding: 0;
  margin: 0;
}
.pub {
  display: grid;
  grid-template-columns: 82px 1fr;
  column-gap: 1.4rem;
  padding: 1.3rem 0;
  border-top: 1px solid var(--hair-soft);
}
.pub:first-child { border-top: 1px solid var(--hair); }

.pub .venue {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--paper);
  background: var(--accent);
  padding: 0.4rem 0.5rem;
  text-align: center;
  align-self: start;
  border-radius: 2px;
  text-transform: uppercase;
  line-height: 1.1;
  font-weight: 500;
}
.pub .venue.alt {
  background: var(--slate);
}

.pub .body {
  min-width: 0;
}
.pub .title {
  font-family: var(--serif);
  font-size: 1.31rem;
  font-weight: 700;
  line-height: 1.19;
  color: var(--ink);
  margin: 0 0 0.35rem;
  letter-spacing: 0.231px;
}
.pub .authors {
  font-family: var(--sans);
  font-size: 1.06rem;
  color: var(--ink-soft);
  margin: 0 0 0.2rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
}
.pub .authors .me {
  color: var(--accent);
  font-weight: 500;
  font-style: normal;
}
.pub .venue-full {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
  line-height: 1.29;
  letter-spacing: -0.224px;
}
.pub .venue-full .year {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-left: 0.5rem;
}

/* Action links + BibTeX toggle */
.pub .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  align-items: center;
  font-family: var(--sans);
  font-size: 0.88rem;
  margin-top: 0.3rem;
}
.pub .actions a,
.pub details summary {
  font-family: var(--sans);
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-block;
  background: transparent;
  line-height: 1.2;
  box-sizing: border-box;
}
.pub .actions a { background: transparent; }
.pub .actions a:hover,
.pub details[open] summary,
.pub details summary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(26,58,92,0.04);
}
.pub details {
  margin-top: 0;
  display: inline-block;
  vertical-align: top;
}
.pub details summary {
  list-style: none;
  user-select: none;
}
.pub details summary::-webkit-details-marker { display: none; }
.pub details summary::before {
  content: "＋ ";
  font-family: var(--mono);
  font-size: 0.75rem;
  margin-right: 0.2rem;
}
.pub details[open] summary::before { content: "− "; }

.pub details pre {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  margin: 0.7rem 0 0;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

@media (max-width: 560px) {
  .pub {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }
  .pub .venue { justify-self: start; padding: 0.3rem 0.55rem; }
}

/* ============================================================
   CV
   ============================================================ */
.cv-block { margin: 0 0 2.5rem; }

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  margin-bottom: 1rem;
}
.info-table tr { border-bottom: 1px solid var(--hair-soft); }
.info-table tr:first-child { border-top: 1px solid var(--hair); }
.info-table tr:last-child  { border-bottom: 1px solid var(--hair); }
.info-table th {
  text-align: left;
  padding: 0.8rem 1rem 0.8rem 0;
  width: 180px;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: -0.12px;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: top;
}
.info-table td {
  padding: 0.8rem 0;
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 130px 1fr;
  column-gap: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--hair-soft);
}
.timeline li:first-child { border-top: 1px solid var(--hair); }
.timeline li:last-child  { border-bottom: 1px solid var(--hair); }

.timeline .when {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding-top: 0.35rem;
}
.timeline .what h3 {
  font-family: var(--serif);
  font-size: 1.31rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
  color: var(--ink);
  letter-spacing: 0.231px;
  line-height: 1.19;
}
.timeline .what .where {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
  line-height: 1.29;
  letter-spacing: -0.224px;
}
.timeline .what ul {
  margin: 0.2rem 0 0;
  padding: 0 0 0 1.1rem;
}
.timeline .what ul li {
  display: list-item;
  grid-template-columns: none;
  padding: 0.15rem 0;
  border: 0;
  font-size: 1.06rem;
  color: var(--ink-soft);
  line-height: 1.47;
  letter-spacing: -0.374px;
}
.timeline .what ul li::marker { color: var(--accent); }

@media (max-width: 560px) {
  .timeline li { grid-template-columns: 1fr; row-gap: 0.4rem; }
  .info-table th { width: 140px; font-size: 0.7rem; padding-right: 0.6rem; }
}

.interests {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
}
.interests li {
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--ink);
  background: var(--paper-2);
}

/* ============================================================
   Teaching — empty state card
   ============================================================ */
.empty-card {
  border: 1px dashed var(--hair);
  background: var(--paper-2);
  border-radius: 3px;
  padding: 2rem 2rem;
  font-family: var(--sans);
  font-size: 1.06rem;
  color: var(--muted);
  line-height: 1.47;
  letter-spacing: -0.374px;
  max-width: var(--measure);
}
.empty-card .label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  grid-column: 1 / -1;
  margin-top: 4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hair);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer a {
  color: var(--muted);
  border-bottom-color: rgba(136,136,136,0.3);
}

/* ============================================================
   Blog index and post layout
   ============================================================ */

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.4rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  margin: 1.2rem 0 0.4rem;
}
.blog-toolbar .group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.blog-toolbar .label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.blog-toolbar .count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.chip {
  font-family: var(--sans);
  font-size: 0.88rem;
  letter-spacing: 0;
  font-weight: 500;
  padding: 0.32rem 0.65rem;
  border: 1px solid var(--hair);
  border-radius: 2px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  line-height: 1.2;
  transition: color .15s, border-color .15s, background .15s;
}
.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(139,42,42,0.04);
}
.chip[aria-pressed="true"],
.chip.is-active {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}
.chip .n {
  font-family: var(--mono);
  font-size: 0.75rem;
  margin-left: 0.35rem;
  opacity: 0.75;
  letter-spacing: 0;
}

.blog-list {
  list-style: none;
  padding: 0;
  margin: 1.6rem 0 0;
}
.blog-entry {
  display: grid;
  grid-template-columns: 130px 1fr;
  column-gap: 2rem;
  padding: 1.6rem 0;
  border-top: 1px solid var(--hair-soft);
}
.blog-entry:first-child { border-top: 1px solid var(--hair); }
.blog-entry:last-child  { border-bottom: 1px solid var(--hair); }
.blog-entry.is-hidden { display: none; }

.blog-entry .when {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding-top: 0.35rem;
}

.blog-entry .body h3 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.3rem;
  line-height: 1.14;
  letter-spacing: 0.196px;
}
.blog-entry .body h3 a {
  color: var(--ink);
  border-bottom: 1px solid transparent;
}
.blog-entry .body h3 a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}
.blog-entry .excerpt {
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
  max-width: var(--measure);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.45rem;
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
}
.tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--olive);
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--paper-2);
  cursor: pointer;
}
.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.tag::before {
  content: "#";
  opacity: 0.55;
  margin-right: 0.1rem;
}

.blog-empty {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
  display: none;
}
.blog-empty.is-visible { display: block; }

@media (max-width: 560px) {
  .blog-entry {
    grid-template-columns: 1fr;
    row-gap: 0.35rem;
  }
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: -1rem 0 1.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--hair);
}
.post-meta .date { color: var(--accent); }
.post-meta .tags {
  flex-basis: 100%;
  margin-top: 0;
}

.post-body {
  max-width: var(--measure);
}
.post-body p {
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
  margin: 0 0 1.1rem;
  color: var(--ink);
}
.post-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.5rem;
  line-height: 1.1;
  margin: 2.2rem 0 0.9rem;
  letter-spacing: 0;
}
.post-body h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.31rem;
  letter-spacing: 0.231px;
  color: var(--ink);
  margin: 1.8rem 0 0.6rem;
  line-height: 1.19;
}
.post-body blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--accent);
  font-family: var(--sans);
  font-style: normal;
  font-size: 1.06rem;
  color: var(--ink-soft);
  line-height: 1.47;
  letter-spacing: -0.374px;
}
.post-body ul,
.post-body ol {
  font-family: var(--sans);
  font-size: 1.06rem;
  line-height: 1.47;
  letter-spacing: -0.374px;
  padding-left: 1.3rem;
}
.post-body ul li::marker { color: var(--accent); }
.post-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
}
.post-body pre {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

.post-body figure {
  margin: 1.8rem 0;
  padding: 0;
}
.post-body figure img,
.post-body figure svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: var(--paper-2);
}
.post-body figcaption {
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 0.55rem;
  padding-left: 0.6rem;
  border-left: 2px solid var(--hair);
  line-height: 1.29;
  letter-spacing: -0.224px;
}
.post-body figcaption .num {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 0.4rem;
}

.post-back {
  display: inline-block;
  margin-top: 3rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.post-back:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
