/* Shared homepage and miscellaneous-page layout. Loaded after the theme. */
:root {
  --page-bg: #fff;
  --surface: #fff;
  --ink: #595959;
  --heading: #043361;
  --muted: #596671;
  --accent: #0077cc;
  --hover: #004c99;
  --line: #dce3e6;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--page-bg);
  color: var(--ink);
  font-size: 20px;
  line-height: 1.7;
  letter-spacing: 0;
  padding: 0;
}
p, li { font-size: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--hover); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; border-radius: 3px; }
strong { color: inherit; font-weight: 600; }
h1, h2, h3 { color: var(--heading); line-height: 1.25; }
h2 { font-size: 30px; margin: 48px 0 22px; scroll-margin-top: 24px; }
h3 { font-size: 24px; }
p { margin-bottom: 22px; }
.site-nav {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  justify-content: flex-end;
  gap: 32px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
}
.site-nav a { color: var(--muted); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
div.wrapper {
  width: calc(100% - 80px);
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 72px;
  align-items: start;
  padding: 56px 0 72px;
}
header {
  position: sticky;
  top: 36px;
  float: none;
  width: auto;
  padding: 0;
  text-align: left;
}
.image.avatar img {
  display: block;
  width: 180px;
  height: 180px;
  padding: 0;
  margin-bottom: 24px;
  object-fit: cover;
  border-radius: 20px;
}
header h1 { font-size: 36px; margin-bottom: 12px; }
header autocolor { color: var(--ink); }
header email { font-size: 16px; color: var(--muted); }
header .social-icons { display: flex; flex-wrap: wrap; gap: 4px; }
header .social-icons a { color: var(--accent) !important; }
main { min-width: 0; }
main > h2:first-child { margin-top: 0; }
main > ul { padding-left: 24px; }
main > ul li { padding-left: 4px; margin-bottom: 10px; }
main > p, main > ul { max-width: 76ch; }
main small { font-size: 15px; color: var(--muted); }
footer:empty { display: none; }
.publications { margin-top: 0; }
.publications ol.bibliography { margin: 0; padding: 0; }
.publications ol.bibliography > li {
  padding: 28px 0;
  margin: 0;
  border-top: 1px solid var(--line);
  min-height: 0;
}
.publications .pub-row {
  display: grid;
  grid-template-columns: minmax(0, 44%) minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  margin: 0;
}
.publications .pub-row-text-only { grid-template-columns: 1fr; }
.publication-figure {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #456070;
}
.publications ol.bibliography li .teaser {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  object-fit: contain;
  margin: 0;
  padding: 12px;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
  transform: none;
}
.publication-details { min-width: 0; overflow-wrap: anywhere; }
.publications ol.bibliography li .title { font-size: 22px; line-height: 1.35; font-weight: 600; margin: 0 0 12px; }
.publications .author { font-size: 18px; line-height: 1.6; margin-bottom: 10px; }
.publications .periodical { color: var(--muted); font-size: 17px; line-height: 1.5; margin-bottom: 16px; }
.publications .links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.publications ol.bibliography li .links a.btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  font-size: 16px;
  line-height: 1.4;
}
.publications ol.bibliography li .links a.btn:hover { border-color: var(--accent); }
.publication-note { color: var(--accent); font-size: 17px; }
@media (prefers-color-scheme: dark) {
  .auto-dark .publications .author strong {
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
  }
  body.auto-dark {
    --page-bg: #20212b;
    --surface: #222c36;
    --ink: #e4e9ef;
    --muted: #b0becb;
    --accent: #3eb7f0;
    --heading: #3eb7f0;
    --hover: #a0dfff;
    --line: #384552;
  }
}
@media (max-width: 1320px) { .site-nav { margin: 0 40px; } }
@media (max-width: 1050px) {
  div.wrapper { grid-template-columns: 210px minmax(0, 1fr); gap: 40px; }
  .publications .pub-row { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 760px) {
  body { font-size: 19px; }
  .site-nav { margin: 0 24px; padding: 18px 0; justify-content: flex-start; gap: 26px; }
  div.wrapper { width: calc(100% - 48px); display: block; padding-top: 32px; }
  header { position: static; text-align: center; padding-bottom: 24px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
  .image.avatar img { width: 160px; height: 160px; margin-bottom: 18px; }
  header .social-icons { justify-content: center; }
  h2 { font-size: 28px; margin-top: 40px; }
  .publications ol.bibliography li .title { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } a, img { transition: none !important; } }
@media print {
  body { background: #fff; color: #222; font-size: 12pt; }
  .site-nav { display: none; }
  div.wrapper { display: block; width: 100%; padding: 0; }
  header { position: static; margin-bottom: 24px; }
  .publications .pub-row { break-inside: avoid; }
}

/* Keep school marks legible without interrupting the introduction. */
.school-icon { display: inline-block; width: 24px; height: 24px; object-fit: contain; vertical-align: -5px; margin-right: 5px; background: white; border-radius: 3px; padding: 2px; }
.bazi-form { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }
.bazi-form input, .bazi-form select, .bazi-form button { font: inherit; max-width: 100%; }
.bazi-pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 25px; width: 100%; }
.bazi-pillar { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bazi-label, .bazi-pinyin { color: var(--muted); }
.bazi-label { font-size: .9em; margin-top: 6px; }
.bazi-pinyin { display: block; font-size: .55em; }
.bazi-legend { text-align: center; margin-top: 12px; font-size: .85em; color: var(--muted); }
@media (max-width: 600px) { .bazi-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; } }
