/* ============================================
   Yuwen Zhang - Academic Homepage
   Journal-article layout: title block, abstract,
   numbered sections, references, tables, supplements
   ============================================ */

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

:root {
  --ink: #1b1d22;
  --text: #3d414a;
  --muted: #6b6f78;
  --faint: #a3a8b2;
  --accent: #2b4a6f;
  --accent-soft: #b8c6d8;
  --tint: #f5f7fa;
  --line: #d9dbe0;
  --line-light: #eceef1;
  --gold-bg: #fbefd5;
  --gold-ink: #8a5600;
  --gold-line: #e7c98c;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans: 'Source Sans 3', 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-zh: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --num-col: 2.6rem;
  --gutter: 40px;
  color-scheme: light;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-serif);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent);
}

/* --- Masthead --- */
.mast {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 12px max(var(--gutter), calc((100% - 1100px) / 2));
  background: #fff;
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mast-brand {
  color: var(--muted);
  text-decoration: none;
}

.mast-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  letter-spacing: 0.06em;
}

.mast-nav a {
  color: var(--muted);
  text-decoration: none;
}

.mast-nav a:hover,
.mast-nav a.active {
  color: var(--accent);
  font-weight: 700;
}

/* --- Title block --- */
.head {
  position: relative;
  overflow: hidden;
  padding: 34px var(--gutter) 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7f9fc, #fff);
}

.head-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--accent);
  opacity: 0.2;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.35) 45%, #000 100%);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.35) 45%, #000 100%);
}

.head-in {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 36px;
  align-items: center;
}

h1 {
  margin: 0 0 10px;
  font-weight: 400;
  font-size: 3rem;
  line-height: 1.06;
  letter-spacing: -0.01em;
}

h1 .zh {
  margin-left: 0.3em;
  font-family: var(--font-zh);
  font-weight: 400;
  font-size: 0.74em;
  letter-spacing: 0.08em;
  color: var(--text);
  white-space: nowrap;
}

sup {
  font-size: 0.62em;
  color: var(--accent);
}

.by {
  margin: 0;
  font-size: 1.05rem;
}

.affs {
  margin: 6px 0 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}

.ids {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
}

.ids a {
  text-decoration: none;
}

.ids a::before {
  content: "↗ ";
  color: var(--faint);
}

.ids a:hover {
  text-decoration: underline;
}

.head-fig {
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(27, 45, 70, 0.12);
}

.head-fig img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 18%;
}

.head-fig figcaption {
  margin-top: 5px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--muted);
}

.head-fig figcaption b {
  color: var(--ink);
}

/* --- Body grid --- */
.body {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 36px;
  max-width: calc(1100px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  align-items: start;
}

main {
  min-width: 0;
}

/* --- Contents --- */
.toc {
  position: sticky;
  top: 64px;
  font-family: var(--font-sans);
  font-size: 0.84rem;
}

.toc b {
  display: block;
  margin-bottom: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  border-left: 2px solid #e3e5ea;
}

.toc li {
  margin-left: -2px;
}

.toc a {
  display: block;
  padding-left: 10px;
  border-left: 2px solid transparent;
  color: #4b4f58;
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
}

.toc a.active {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

/* --- Labels --- */
.lbl {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

/* --- Abstract + Profile --- */
.lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 24px;
  align-items: stretch;
}

.abs,
.info {
  height: 100%;
  background: var(--tint);
  border-top: 2px solid var(--accent);
  padding: 16px 18px;
}

.abs p {
  margin: 6px 0 10px;
}

.abs .kw {
  margin: 0;
  font-size: 0.92rem;
  color: #4b4f58;
}

.kw .lbl {
  margin-right: 6px;
}

.info {
  display: grid;
  gap: 10px;
  align-content: start;
  font-family: var(--font-sans);
  font-size: 0.84rem;
}

.info div {
  display: grid;
  gap: 1px;
}

.info .k {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.info .v {
  color: var(--ink);
  line-height: 1.4;
  overflow-wrap: break-word;
}

.info .sv {
  display: block;
  margin-top: 1px;
  font-family: var(--font-serif);
  font-size: 0.76rem;
  font-style: italic;
  color: var(--muted);
}

.lk {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}

.lk:hover {
  border-bottom-color: var(--accent);
}

.lk::after {
  content: " ↗";
  font-size: 0.8em;
  color: #9aa3b2;
}

.lk.plain::after {
  content: none;
}

/* --- Sections and numbered headings --- */
.sec {
  scroll-margin-top: 64px;
}

h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  margin: 34px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e3e5ea;
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.3;
}

h2 > span:first-child,
h3 > span:first-child {
  flex: 0 0 var(--num-col);
  color: var(--accent);
  font-variant-numeric: tabular-nums lining-nums;
}

h2 .h-note {
  margin-left: 8px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: var(--muted);
}

h3 {
  display: flex;
  align-items: baseline;
  margin: 18px 0 4px;
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.35;
}

.sec > h3 ~ .meta,
.sec > h3 ~ ul.b,
.sec > h3 ~ ol.refs,
.sec > h3 ~ .box {
  margin-left: var(--num-col);
}

.meta {
  margin: 0 0 6px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
}

p {
  margin: 0 0 10px;
}

/* Running text is justified; hyphenation keeps word spacing even */
.abs p,
ul.b li,
ol.refs li,
.box dd,
.supp figcaption,
.tn {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}

ul.b {
  margin: 0 0 8px;
  padding-left: 1.1em;
  font-size: 0.97rem;
  line-height: 1.55;
}

ul.b li {
  margin-bottom: 4px;
}

.box {
  margin-top: 16px;
  margin-bottom: 4px;
  padding: 12px 16px;
  border: 1px solid #c9d2de;
  font-size: 0.93rem;
}

.box .lbl {
  display: block;
  margin-bottom: 6px;
}

.box dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 24px;
}

.box dt {
  font-weight: 600;
}

.box dd {
  margin: 0;
  color: var(--text);
}

/* --- References --- */
ol.refs {
  margin: 8px 0 0;
  padding-left: 1.4em;
  display: grid;
  gap: 12px;
  font-size: 0.96rem;
  line-height: 1.5;
}

ol.refs li::marker {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

ol.refs b {
  font-weight: 600;
}

.rm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-family: var(--font-sans);
}

.rm .dv {
  width: 1px;
  height: 14px;
  margin: 0 4px;
  background: #d3d7de;
}

.q,
.if,
.rl {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.q {
  font-weight: 700;
}

.q1 {
  background: var(--accent);
  color: #fff;
}

.q2 {
  border-color: var(--accent);
  color: var(--accent);
}

.q3,
.qn {
  border-color: #c4c9d1;
  color: var(--muted);
  font-weight: 600;
}

.if {
  border-color: #d3d7de;
  color: #4b4f58;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.if.hi {
  background: var(--gold-bg);
  border-color: var(--gold-line);
  color: var(--gold-ink);
  font-weight: 700;
}

.rl {
  gap: 4px;
  background: #fff;
  border-color: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.rl::after {
  font-size: 0.9em;
  color: #8a9bb0;
  transition: color 0.15s;
}

.rl.pdf::after {
  content: "↓";
}

.rl.web::after {
  content: "↗";
}

.rl:hover,
.rl:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rl:hover::after,
.rl:focus-visible::after {
  color: #cfd9e6;
}

.fn {
  margin-top: 10px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Supplementary figures --- */
.supp {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 18px;
}

.supp figure {
  margin: 0;
  min-width: 0;
}

.supp img,
.supp .vid {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #eef1f5;
}

.supp img {
  height: auto;
  object-fit: cover;
  cursor: zoom-in;
}

.supp img.poster {
  object-position: center 30%;
}

.supp .vid {
  position: relative;
  background: #111;
}

.supp .vid iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.supp figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #5c6069;
}

.supp figcaption b,
.supp figcaption .ct {
  color: var(--ink);
}

.supp figcaption time {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* --- Tables --- */
.tw {
  overflow-x: auto;
  margin: 6px 0 4px;
}

table.t {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.t caption {
  margin-bottom: 6px;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text);
}

table.t caption b {
  color: var(--ink);
}

table.t th {
  padding: 6px 8px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

table.t td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-light);
  vertical-align: top;
  line-height: 1.4;
}

table.t tr:last-child td {
  border-bottom: 2px solid var(--ink);
}

table.t td.y {
  white-space: nowrap;
  color: #4b4f58;
  font-variant-numeric: tabular-nums;
}

table.t td.na {
  color: var(--faint);
}

table.t tr.g td {
  padding-top: 12px;
  border-bottom: 1px solid #c9d2de;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

table.t .dg {
  display: block;
  font-weight: 600;
}

table.t .dm {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
}

.tn {
  margin: 8px 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
}

.tn sup {
  margin-right: 3px;
}

.tn b {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: lining-nums;
}

/* --- Footer --- */
.end {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 0 30px;
  border-top: 2px solid var(--ink);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--muted);
}

.end a {
  color: var(--muted);
}

/* --- Lightbox --- */
.lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(10, 18, 24, 0.88);
}

.lightbox img {
  display: block;
  max-width: min(92vw, 1400px);
  max-height: 88vh;
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

body.lightbox-open {
  overflow: hidden;
}

/* --- Focus --- */
a:focus-visible,
button:focus-visible,
img.zoom:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 1180px) {
  .end {
    margin: 0 var(--gutter);
  }
}

@media (max-width: 980px) {
  .body {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    display: none;
  }

  .supp {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --gutter: 18px;
    --num-col: 2.3rem;
  }

  html {
    font-size: 16px;
  }

  .mast {
    position: static;
  }

  .mast-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
  }

  .mast-nav::-webkit-scrollbar {
    display: none;
  }

  .head {
    padding-top: 24px;
    padding-bottom: 20px;
  }

  h1 {
    font-size: 2.2rem;
  }

  h1 .zh {
    display: block;
    margin: 6px 0 0;
  }

  .head-in {
    grid-template-columns: minmax(0, 1fr) 104px;
    gap: 16px;
    align-items: start;
  }

  .head-fig figcaption {
    display: none;
  }

  .body {
    padding-top: 20px;
    padding-bottom: 32px;
  }

  .lead {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .box dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .box dd {
    margin-bottom: 6px;
  }

  .supp {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* --- Print --- */
@media print {
  .mast,
  .toc,
  .lightbox {
    display: none;
  }

  .body {
    grid-template-columns: 1fr;
  }
}
