/* ==========================================================================
   juncheng.page — styles modeled on the OpenReview profile page.
   No frameworks. Sections below follow the page from top to bottom.
   To change the look, start with the variables in :root.
   ========================================================================== */

/* === Variables ========================================================== */

:root {
  /* Colours */
  --color-bg: #fffdfa; /* off-white page background */
  --color-text: #333;
  --color-muted: #666; /* dates, schools, descriptions, footer */
  --color-name: #2c3a4a; /* h1 name, paper titles */
  --color-accent: #8c1b13; /* section titles, venue tags */
  --color-link: #4d6b8a;
  --color-rule: #ddd; /* hairlines and dashed separators */

  /* Font sizes. Everything is in rem, i.e. relative to the base size set on
     <html> below (14px desktop, 15px phone), so that one number scales all. */
  --fs-xs: 0.8rem; /* venue tag, [PAPER], Education dates and notes */
  --fs-sm: 0.85rem; /* other dates, footer, "+N more", Oral badge */
  --fs-md: 0.92rem; /* author lists, descriptions, school names */
  --fs-h2: 1.2rem; /* section titles */
  --fs-h1: 2.6rem; /* name */

  /* Page width and columns: main : sidebar. Bigger first number = narrower
     sidebar. 2 1 = sidebar 1/3 (original); 7 3 = 30%; 5 2 = 2/7. */
  --max-width: 1100px;
  --main-cols: 7fr;
  --side-cols: 3fr;
  --gutter: 24px; /* left/right page padding (16px on phones) */

  /* Vertical spacing around the header. Smaller = About / Contact move up. */
  --header-top: 32px; /* page top edge → name */
  --header-bottom: 20px; /* name (or photo) bottom → About */
}

/* === Base =============================================================== */

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

/* Base text size: 14px ≈ OpenReview (browser default is 16px). */
html {
  -webkit-text-size-adjust: 100%;
  font-size: 14px;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "Noto Sans", "Noto Sans SC", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover,
a:focus-visible {
  text-decoration: underline;
}

p {
  margin: 0 0 0.6em;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}
img {
  display: block;
  max-width: 100%;
}

/* Visually hidden but read by screen readers (e.g. "at" in emails) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Native <details>/<summary> toggles (author lists, more publications):
   no default triangle, pointer cursor, visible keyboard focus. */
summary {
  display: block;
  list-style: none;
  cursor: pointer;
}
summary::-webkit-details-marker {
  display: none;
}
summary:focus-visible {
  outline: 1px dotted var(--color-link);
}

/* === Shared building blocks ============================================ */

/* Header, two-column body and footer share the same centred frame */
.site-header,
.layout,
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

section {
  margin-bottom: 30px;
}

h2 {
  margin: 0 0 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--color-rule);
  color: var(--color-accent);
  font-size: var(--fs-h2);
  font-weight: 700;
}

/* Dates in lists: italic, never broken across lines */
.date,
.news time {
  font-style: italic;
  white-space: nowrap;
}

/* Running text: flush left and right; hyphenation avoids wide word gaps */
#about p,
#elsewhere p,
.entry-desc {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* === Header ============================================================= */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-top: var(--header-top);
  padding-bottom: var(--header-bottom);
}

h1 {
  margin: 0 0 0.2em;
  color: var(--color-name);
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.15;
}

/* 🐾 after the name (profile.yaml → name_mark) */
.name-mark {
  margin-left: 0.15em;
  font-size: 0.7em;
  vertical-align: 0.1em;
}

/* Optional — only rendered when set in profile.yaml (name_zh / position / photo) */
.name-zh {
  margin-left: 0.3em;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 0.55em;
  font-weight: 400;
  color: var(--color-muted);
  vertical-align: middle;
}

.position {
  margin: 0;
  color: var(--color-muted);
  font-size: 1.3rem;
}

.photo {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%; /* 0 for a square photo */
}

/* === Two-column layout ================================================== */

.layout {
  display: grid;
  grid-template-columns: var(--main-cols) var(--side-cols);
  align-items: start; /* columns start together, then flow independently */
}

main {
  min-width: 0;
  padding-right: var(--gutter);
}

aside {
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--color-rule); /* the OpenReview divider */
}

aside section {
  margin-bottom: 26px;
}

/* === News =============================================================== */

.news li {
  display: grid;
  grid-template-columns: 5.5em 1fr;
  gap: 8px;
  padding: 3px 0;
}
.news time {
  color: var(--color-muted);
}

/* === Publications ======================================================= */

/* One paper: optional thumbnail + text block, dashed line between papers
   (also inside the "more publications" fold) */
.pub {
  display: flex;
  gap: 18px;
  padding: 10px 0 14px;
}
.pub + .pub {
  border-top: 1px dashed var(--color-rule);
}

.pub-body {
  flex: 1; /* always full width, so links align to the right edge */
  min-width: 0;
}

/* Optional — only rendered when the .bib entry has `thumbnail` */
.pub-thumb {
  flex-shrink: 0;
  width: 160px;
  height: 100px;
  object-fit: cover;
  border: 1px solid var(--color-rule);
}

.pub-title {
  margin: 0 0 4px;
  color: var(--color-name);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.pub-authors {
  margin: 0 0 4px;
  font-size: var(--fs-md);
}

/* --- Author list fold: short list + "+N more" ⇄ full list + "show less".
       Scoped to details.pub-authors so opening the outer publications fold
       doesn't also open every author list inside it. */
.authors-toggle {
  margin-left: 0.4em;
  color: var(--color-link);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
details.pub-authors > summary:hover .authors-toggle {
  text-decoration: underline;
}

.authors-full,
.authors-less,
details.pub-authors[open] .authors-short,
details.pub-authors[open] .authors-more {
  display: none;
}

details.pub-authors[open] .authors-full,
details.pub-authors[open] .authors-less {
  display: inline;
}

/* --- Venue tag (left) + [PAPER] [ARXIV] … (right) on one row */
.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
}

.pub-venue {
  margin: 0;
}

.venue-tag {
  display: inline-block;
  padding: 3px 6px; /* height comes from padding, not line-height */
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
}

/* Optional — BibTeX `note` field, e.g. Oral / Highlight */
.venue-note {
  margin-left: 6px;
  color: var(--color-accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-style: italic;
}

/* Same size / weight / line-height as the venue tag; uppercase so the
   letters sit on the same centre line as "MSSP 2025". */
.pub-links {
  position: relative;
  top: 1px; /* optical nudge: caps otherwise sit ~1px high */
  margin: 0 0 0 auto;
  font-size: var(--fs-xs);
  line-height: 1;
}
.pub-links a {
  display: inline-block;
  margin-left: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.pub-links a::before {
  content: "[";
  color: var(--color-muted);
  font-weight: 400;
}
.pub-links a::after {
  content: "]";
  color: var(--color-muted);
  font-weight: 400;
}

/* --- "Show N more publications" fold */
details.pubs-more > summary {
  padding: 8px 0 4px;
  border-top: 1px dashed var(--color-rule);
  color: var(--color-link);
  font-size: var(--fs-md);
  font-weight: 600;
}
details.pubs-more > summary:hover {
  text-decoration: underline;
}
details.pubs-more > summary::before {
  content: "▸ ";
}
details.pubs-more[open] > summary::before {
  content: "▾ ";
}

.pubs-less-label,
details.pubs-more[open] .pubs-more-label {
  display: none;
}
details.pubs-more[open] .pubs-less-label {
  display: inline;
}

/* === Experience / Awards / Projects ===================================== */

.entries li {
  padding: 4px 0 8px;
}

/* Title | organisation ………… date (or link) */
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.entries .date {
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

.entry-desc {
  margin: 2px 0 0;
  color: var(--color-muted);
  font-size: var(--fs-md);
}

/* === Sidebar: Contact =================================================== */

.emails {
  margin-bottom: 8px;
}
.emails li {
  padding: 1px 0;
}

/* Google Scholar  GitHub  X  CV (PDF) — one row, semi-bold */
.link-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 14px;
  row-gap: 2px;
}
.link-list li {
  white-space: nowrap;
}
.link-list a {
  font-weight: 600;
}

/* === Sidebar: Education ================================================= */

/* Title and school full width; date small + grey at the bottom right */
.edu li {
  padding: 9px 0;
}
.edu li:first-child {
  padding-top: 2px;
}
.edu li + li {
  border-top: 1px dashed var(--color-rule);
}

.edu-title {
  font-weight: 700;
  line-height: 1.35;
}

.edu-school,
.edu-note {
  margin-top: 2px;
}

.edu-school {
  font-size: var(--fs-md);
}

.edu-note {
  color: var(--color-muted);
  font-size: var(--fs-xs);
}

/* Last text line + date share a line when there is room; otherwise the
   date wraps below, still right-aligned. */
.edu-last {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
}
.edu-last > .edu-school,
.edu-last > .edu-note {
  display: block;
}

.edu-date {
  margin-left: auto;
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-style: italic;
  white-space: nowrap;
}

/* === Footer ============================================================= */

.site-footer {
  padding-top: 18px;
  padding-bottom: 32px;
  color: var(--color-muted);
  font-size: var(--fs-sm);
}

/* Full-width hairline above the footer */
.site-footer::before {
  content: "";
  display: block;
  margin-bottom: 14px;
  border-top: 1px solid var(--color-rule);
}

/* "© 2026 Jun Cheng 🐾" left, "Last updated" right; wraps on narrow screens */
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

/* === Narrow screens (< 768px): single column ============================ */

@media (max-width: 767px) {
  :root {
    --gutter: 16px;
  }
  html {
    font-size: 15px;
  } /* slightly larger on phones */

  .site-header {
    padding-top: 28px;
  }
  h1 {
    font-size: 2rem;
  }
  .position {
    font-size: 1.05rem;
  }
  .photo {
    width: 88px;
    height: 88px;
  }

  .layout {
    grid-template-columns: 1fr;
  }
  main {
    padding-right: 0;
  }
  aside {
    padding-left: 0;
    border-left: 0;
  }

  .pub {
    flex-direction: column;
    gap: 10px;
  }
  .pub-thumb {
    width: 100%;
    max-width: 320px;
    height: auto;
    aspect-ratio: 16 / 10;
  }

  .entry-head {
    flex-direction: column;
    gap: 0;
  }
}
