:root {
  --body-font: Arial, "Noto Sans CJK SC",
               "Microsoft YaHei", sans-serif;
  --heading-font: Arial, "Noto Sans CJK SC",
                  "Microsoft YaHei", sans-serif;

  --text: #263342;
  --muted: #64748b;
  --accent: #205b91;
  --rule: #e3e9f0;
  --max-width: 850px;
}

/* Global */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font: 18px/1.7 var(--body-font);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 52px 26px 32px;
}

/* Headings */
h1, h2, h3 {
  font-family: var(--heading-font);
  line-height: 1.35;
}

h1 {
  font-size: 2rem;
  letter-spacing: -.02em;
  margin: 0 0 4px;
}

h2 {
  font-size: 1.4rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  margin: 0 0 14px;
}

h3 {
  font-size: 1.15rem;
  margin: 22px 0 10px;
}

section {
  margin-top: 32px;
}

p {
  margin: 8px 0 12px;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.subtitle,
.hint {
  color: var(--muted);
}

.subtitle {
  margin: 0 0 8px;
}

.hint {
  font-size: .88rem;
  margin-top: -4px;
}

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

/* Publications */
.pub {
  display: grid;
  grid-template-columns: 2.5em minmax(0, 1fr);
  column-gap: 0.2em;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f5;
}

.pub-number,
.pub-citation {
  font-family: var(--body-font);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.7;
}

.pub-number {
  white-space: nowrap;
  padding: 0;
}

.pub {
  display: grid;
  grid-template-columns: 2.5em minmax(0, 1fr);
  column-gap: 0.2em;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid #f1f3f5;
}

.pub-body {
  min-width: 0;
}

/* Citation.js generated content */
.pub-citation .csl-bib-body,
.pub-citation .csl-entry {
  margin: 0;
  padding: 0;
}

.pub-citation .csl-left-margin {
  display: none;
}

.pub-citation .csl-right-inline {
  display: inline;
}

/* Publication badges and links */
.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  max-width: none;
  padding-top: 7px;
}

.pub-links:empty {
  display: none;
}

.pub-links a,
.pub-links button,
.pub-links .pub-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-sizing: border-box;
  min-height: 28px;
  padding: 4px 8px;

  font-family: var(--heading-font);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;

  border: 1px solid;
  border-radius: 4px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Clickable links */
.pub-links a,
.pub-links button {
  color: var(--accent);
  background: #f4f7fa;
  border-color: #dce5ed;
  cursor: pointer;
}

.pub-links a:hover,
.pub-links button:hover {
  background: #eaf1f8;
  text-decoration: none;
}

/* Custom badges */
.pub-links .pub-badge {
  color: #46515d;
  background: #f4f5f7;
  border-color: #c9ced6;
  cursor: default;
}

/* Email */
.email {
  font-family: "Consolas", "SFMono-Regular",
               "Courier New", monospace;
  font-size: .95em;
  overflow-wrap: anywhere;
}

/* Footer */
footer {
  color: var(--muted);
  font-size: .8rem;
  margin-top: 50px;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}

.error {
  color: #a11e31;
}

/* Responsive layout */
@media (max-width: 650px) {
  .page {
    padding: 30px 18px;
  }

  h1 {
    font-size: 1.7rem;
  }

  .pub {
    grid-template-columns: 2.2em minmax(0, 1fr);
  }
}


/* Profile layout */
.profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  grid-template-areas:
    "intro photo"
    "contacts photo"
    "education photo";
  column-gap: 32px;
  row-gap: 0;
  align-items: start;
}

.profile-intro {
  grid-area: intro;
  min-width: 0;
}

.profile .contacts {
  grid-area: contacts;
  margin: 8px 0 0;
}

.profile .education {
  grid-area: education;
  margin-top: 22px;
}

.profile-photo {
  grid-area: photo;
  display: block;
  width: 160px;
  height: 200px;
  object-fit: cover;
  object-position: center;
  border-radius: 6px;
}

/* Education */
.education {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.education-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.school-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
}

.education-info {
  min-width: 0;
  line-height: 1.45;
}

.school-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.degree {
  font-size: 0.82rem;
  color: var(--muted);
}

/* Mobile profile layout */
@media (max-width: 650px) {
  .profile {
    grid-template-columns: minmax(0, 1fr) 100px;
    grid-template-areas:
      "intro photo"
      "contacts contacts"
      "education education";
    column-gap: 14px;
    row-gap: 12px;
  }

  .profile h1 {
    font-size: 1.5rem;
    line-height: 1.25;
  }

  .profile .subtitle {
    margin: 6px 0 0;
  }

  .profile-photo {
    width: 100px;
    height: 125px;
  }

  .profile .contacts {
    margin: 0;
    gap: 8px 14px;
  }

  .profile .education {
    margin-top: 0;
  }

  .school-logo {
    width: 34px;
    height: 34px;
  }

  .education-item {
    gap: 9px;
  }

  .school-name {
    font-size: 0.82rem;
  }

  .degree {
    font-size: 0.75rem;
  }
}
