/* ==========================================================================
   ruishenzhang.com — editorial stylesheet
   Typeset to echo a LaTeX CV: Spectral serif, small-caps section heads,
   hairline rules, warm paper ground, HKU deep green as the single accent.
   ========================================================================== */

:root {
  --paper: #f9f7f1;
  --paper-deep: #f1eee4;
  --ink: #211f1a;
  --ink-soft: #57534a;
  --ink-faint: #8d877a;
  --green: #024638;        /* HKU deep green */
  --green-bright: #0d6b50;
  --rule: #d9d3c4;
  --rule-strong: #b9b2a0;
  --serif: "Spectral", "Palatino Linotype", Palatino, Georgia, serif;
  --caps: "Spectral SC", "Spectral", Palatino, Georgia, serif;
  --measure: 46rem;
}

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

html { font-size: 17px; }

body {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  /* faint paper grain */
  background-image:
    radial-gradient(ellipse at 50% -20%, rgba(2, 70, 56, 0.045), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(33, 31, 26, 0.008) 2px 4px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--green); color: var(--paper); }

.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4.5rem;
}

/* ---------- masthead ------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 2rem;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.masthead .name {
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.masthead .name a { color: var(--ink); text-decoration: none; }
.masthead .name a:hover { color: var(--green); }

.masthead .affiliation {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.45;
  text-align: right;
}

@media (max-width: 620px) {
  .masthead .affiliation { text-align: left; }
}

/* ---------- navigation ------------------------------------------------ */

nav.primary {
  margin-top: 1.4rem;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 0.55rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 1.9rem;
  animation: rise 0.7s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

nav.primary a {
  font-family: var(--caps);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.18s ease;
}

nav.primary a:hover { color: var(--green-bright); }

nav.primary a[aria-current="page"] {
  color: var(--green);
  border-bottom: 2px solid var(--green);
  padding-bottom: 0.1rem;
}

/* ---------- sections --------------------------------------------------- */

main { display: block; }

section.block {
  margin-top: 2.8rem;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

section.block:nth-of-type(1) { animation-delay: 0.16s; }
section.block:nth-of-type(2) { animation-delay: 0.26s; }
section.block:nth-of-type(3) { animation-delay: 0.36s; }
section.block:nth-of-type(4) { animation-delay: 0.44s; }
section.block:nth-of-type(5) { animation-delay: 0.52s; }

h2 {
  font-family: var(--caps);
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: 0.16em;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: 0.35rem;
  margin-bottom: 1.15rem;
}

h2 .annus {
  float: right;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0;
  color: var(--ink-faint);
}

/* ---------- about page ------------------------------------------------- */

.lede {
  display: flex;
  gap: 2.2rem;
  align-items: flex-start;
}

.lede .bio { flex: 1 1 auto; }

.bio p + p { margin-top: 0.9rem; }

.bio .opener::first-letter {
  font-size: 3.1em;
  line-height: 0.82;
  float: left;
  padding-right: 0.09em;
  padding-top: 0.04em;
  font-weight: 500;
  color: var(--green);
}

figure.portrait {
  flex: 0 0 168px;
  margin-top: 0.3rem;
}

figure.portrait img {
  width: 168px;
  display: block;
  border: 1px solid var(--rule-strong);
  padding: 5px;
  background: #fff;
  box-shadow: 4px 5px 0 var(--paper-deep);
}

figure.portrait .monogram {
  width: 168px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rule-strong);
  background:
    linear-gradient(150deg, rgba(2, 70, 56, 0.06), transparent 60%),
    #fff;
  box-shadow: 4px 5px 0 var(--paper-deep);
  font-family: var(--caps);
  font-size: 3rem;
  letter-spacing: 0.08em;
  color: var(--green);
}

figure.portrait figcaption {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-faint);
  text-align: center;
}

.contact-line {
  margin-top: 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px dotted var(--rule-strong);
  font-size: 0.92rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.6rem;
}

.contact-line a { white-space: nowrap; }

/* ---------- entries (papers, courses, awards) -------------------------- */

.entry { margin-bottom: 1.45rem; }
.entry:last-child { margin-bottom: 0; }

.entry .title {
  font-weight: 600;
  font-size: 1.02rem;
}

.entry .title a { color: var(--ink); }
.entry .title a:hover { color: var(--green-bright); }

.entry .outlet {
  font-style: italic;
  color: var(--green);
}

.entry .meta {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.entry ul.notes {
  margin: 0.35rem 0 0 1.1rem;
  list-style: none;
}

.entry ul.notes li {
  position: relative;
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding-left: 0.9rem;
}

.entry ul.notes li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--green-bright);
}

.entry .links {
  display: inline-flex;
  gap: 0.9rem;
  margin-top: 0.15rem;
}

.entry .links a,
a.tag {
  font-family: var(--caps);
  font-size: 0.74rem;
  letter-spacing: 0.13em;
  color: var(--green-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(13, 107, 80, 0.35);
  transition: border-color 0.18s ease, color 0.18s ease;
}

.entry .links a:hover,
a.tag:hover { color: var(--green); border-bottom-color: var(--green); }

/* dated lists (news, awards, teaching) */

dl.dated { display: grid; grid-template-columns: 6.2rem 1fr; row-gap: 0.55rem; }

dl.dated dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--green);
  letter-spacing: 0.02em;
  padding-top: 0.08rem;
}

dl.dated dd { color: var(--ink); }
dl.dated dd .sub { display: block; font-size: 0.9rem; font-style: italic; color: var(--ink-soft); }

/* ---------- generic ----------------------------------------------------- */

a { color: var(--green-bright); text-decoration: none; border-bottom: 1px solid rgba(13, 107, 80, 0.3); transition: border-color 0.18s ease, color 0.18s ease; }
a:hover { color: var(--green); border-bottom-color: var(--green); }

nav.primary a, .masthead a { border-bottom: none; }

em.journal { color: inherit; }

footer {
  margin-top: 4rem;
  border-top: 1px solid var(--rule);
  padding-top: 0.9rem;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

footer a { color: var(--ink-faint); border-bottom-color: var(--rule-strong); }
footer a:hover { color: var(--green); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .masthead, nav.primary, section.block { animation: none; }
}

@media (max-width: 620px) {
  html { font-size: 16px; }
  .sheet { padding-top: 2.2rem; }
  .lede { flex-direction: column-reverse; }
  figure.portrait { margin: 0 auto; }
  dl.dated { grid-template-columns: 4.6rem 1fr; }
  h2 .annus { float: none; display: block; }
}
