/* ===========================================================================
   Refinements to an existing theme, not a new one.

   Loaded after /css/yucss.css and only ever overrides: same palette, same
   structure, same components. Three things the original does not do, plus a
   light reduction of ornament:

     1. A reading measure. The card is ~950px wide inside, so a paragraph runs
        to nearly 130 characters. Prose is capped at ~74ch, lists at ~82ch.
     2. Room to breathe where it was tight. Two long-form blocks were set at
        line-height 1.2, which for a list of editorships is a caption rhythm,
        not a reading one.
     3. Quieter furniture. One shadow instead of three levels of it, a hairline
        heading rule instead of a blue bar, a calmer sticky bar, and a link you
        can see before you hover it.

   Layout deltas live inside `min-width: 769px` on purpose. A stylesheet that
   loads later beats the theme's own media queries at equal specificity, so a
   bare `.container { padding: ... }` here would quietly undo the considered
   phone layout the theme already has.
   =========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  --page-background: #f5f6f8;
  --text-primary: #17222e;
  --text-secondary: #51606f;
  --border-color: #dde3ea;
  --border-light: #e9eef3;
  --radius: 6px;
  --max-width: 1160px;
  --shadow-md: 0 1px 2px rgba(23, 34, 46, 0.04), 0 8px 24px -12px rgba(23, 34, 46, 0.12);
  /* One measure for prose, images and captions, so every right edge lines up. */
  --measure: 900px;
}

/* -------------------------------------------------------------------- nav */
#layout-menu {
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.logo a {
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.015em;
}

.nav-links {
  gap: 24px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-links a::after {
  height: 1.5px;
  transform: none;
}

.nav-links a.active {
  font-weight: 600;
}

/* ---------------------------------------------------------------- reading */
body {
  font-size: 1rem;
  line-height: 1.7;
}

/*
 * Width is set in px, not ch. A ch-based cap drifts with each page's font size --
 * measured 600px on the homepage and 638px on a post -- which is not what a cap is
 * for. One number, the same everywhere.
 *
 * The width is wider than the 65-75ch that long-form reading usually wants. That is a
 * deliberate choice: the owner asked for a wider column twice, and an academic page is
 * skimmed and cross-checked more than it is read line by line. The biography is
 * narrower than this by construction -- it shares a grid row with the portrait.
 */
.container p,
.profile-bio,
blockquote {
  max-width: var(--measure);
}

/* Lists and tables use the whole column; a long editorship line should not wrap
   just to satisfy a measure meant for prose. */
.container li {
  max-width: none;
}

.container table,
.paper-list,
.paper-card,
.social-links,
.infoblock,
.stats-row {
  max-width: none;
}

p {
  margin: 0 0 1.05rem;
}

/* A link you can see before you hover it; the underline darkens on hover rather
   than appearing from nothing. */
.container a:not(.button):not(.social-link):not(.stat-badge) {
  text-decoration: underline;
  text-decoration-color: rgba(30, 96, 145, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.19em;
  transition: text-decoration-color var(--transition), color var(--transition);
}

.container a:not(.button):not(.social-link):not(.stat-badge):hover {
  text-decoration-color: currentColor;
}

/* -------------------------------------------------------------- headings */
/*
 * The blue bar before every heading competes with the accent colour used
 * elsewhere; a hairline rule separates a section well enough.
 */
h3::before {
  display: none;
}

h3 {
  padding-bottom: 0.5rem;
  font-size: 1.12rem;
  font-weight: 640;
  letter-spacing: -0.005em;
  border-bottom-color: var(--border-color);
}

h2 {
  margin: 2.4rem 0 0.8rem;
  font-size: 1.32rem;
  font-weight: 640;
  letter-spacing: -0.01em;
}

h4 {
  margin: 1.6rem 0 0.55rem;
  font-size: 1rem;
}

/* --------------------------------------------------------- long-form lists */
/*
 * The service list was set at line-height 1.2, which is a caption rhythm; a list of
 * editorial boards is read, so it gets room.
 */
#academic-services + ul {
  line-height: 1.55;
}

#academic-services + ul > li {
  margin: 0.28rem 0;
}

/*
 * The teaching block is a register -- twenty-odd one-line entries naming cohorts of
 * students. Giving it the same room as prose doubled its height for no gain, so it
 * keeps a tighter rhythm and a smaller gap between entries.
 */
.teaching-compact {
  line-height: 1.38;
}

.teaching-compact p {
  margin-bottom: 0.25rem;
}

ul,
ol {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
}

li {
  margin: 0.36rem 0;
}

li::marker {
  color: #a9b4bf;
}

/* ---------------------------------------------------------------- papers */
.paper-item {
  padding: 0.6rem 0;
}

.paper-date {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

.paper-title {
  font-weight: 600;
}

.paper-authors,
.paper-journal {
  color: var(--text-secondary);
  font-size: 0.92rem;
}

/* ------------------------------------------------------------ components */
.infoblock {
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}

.social-link {
  padding: 6px 13px;
  border-radius: 999px;
}

hr {
  margin: 2.2rem 0;
}

img {
  border-radius: var(--radius-sm);
}

/* The name's Chinese half sits a step down from the Latin one at every width. */
.profile-details h1 span[lang] {
  font-size: 0.62em;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-left: 0.3em;
}

/* --------------------------------------------------- layout (desktop only) */
@media (min-width: 769px) {
  #layout-content {
    padding: 40px 32px 72px;
  }

  .container {
    padding: 48px 56px 56px;
    box-shadow: var(--shadow-md);
  }

  /*
   * The portrait floats rather than sharing a grid row with the text.
   *
   * In a grid the biography lives in the second column, so its right edge sat exactly one
   * portrait-plus-gap short of every other paragraph -- visible as two different right
   * margins on the same page. Floated, the biography is a full-width block that simply
   * wraps around the image, so its right edge lines up with the text below it, and it
   * keeps doing so at every width without a magic number for the offset.
   */
  .profile {
    display: block;
    margin-bottom: 34px;
    padding-bottom: 34px;
  }

  .profile::after {
    display: block;
    clear: both;
    content: "";
  }

  .profile-photo-wrap {
    float: left;
    width: 160px;
    margin: 0 34px 6px 0;
  }

  .profile-photo {
    width: 100%;
  }

  .profile-details h1 {
    font-size: clamp(1.85rem, 2.7vw, 2.05rem);
    font-weight: 650;
    letter-spacing: -0.015em;
  }

  .profile-role {
    margin: 0 0 14px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
  }

  .profile-bio {
    font-size: 0.94rem;
    line-height: 1.7;
  }

  h3 {
    margin: 2.4rem 0 0.8rem;
  }
}

/* ----------------------------------------------------------------- print */
@media print {
  #layout-menu {
    display: none;
  }

  #layout-content {
    padding: 0;
    max-width: none;
  }

  .container {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

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

/*
 * Lead image in a post: framed with a hairline like the screenshots on the project
 * page, so a news entry and the product page look like the same hand.
 */
.post-figure {
  max-width: var(--measure);
  margin: 0 0 1.5rem;
}

.post-figure a {
  display: block;
}

.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.post-figure figcaption {
  margin-top: 0.6rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
