/* =========================================================
   Xin Yao — academic homepage
   Colors and sizes live in the variables below; change them
   here and the whole site follows.
   ========================================================= */

:root {
  --sidebar-width: 168px;
  --content-max: 1100px;

  --text: #1a1a1a;
  --text-muted: #555;
  --link: #2b5aa8;
  --heading-name: #24478f;     /* name at the top of the page */
  --heading-section: #9b2c2c;  /* section headings */
  --rule: #c8c8c8;
  --sidebar-bg: #f4f4f4;
  --sidebar-border: #d8d8d8;

  --font-body: Georgia, "Times New Roman", Times, serif;
  --size-body: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.5;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ==================== Left navigation ==================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  overflow-y: auto;
  padding: 14px 12px 30px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
}

.nav-group {
  margin-bottom: 16px;
}

.nav-group h2 {
  margin: 0 0 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid #999;
  font-size: 0.95rem;
  font-weight: 700;
  color: #000;
}

.nav-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-group li {
  margin: 0;
}

.nav-group a {
  display: block;
  padding: 2px 0 2px 10px;
  font-size: 0.92rem;
}

/* ==================== Main content ==================== */

main {
  max-width: var(--content-max);
  margin-left: var(--sidebar-width);
  padding: 14px 30px 60px;
}

h1 {
  margin: 0 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--heading-name);
}

/* Section headings: dark red with a rule underneath */
h3 {
  margin: 26px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--rule);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--heading-section);
}

/* Sub-headings inside a section */
h4 {
  margin: 16px 0 2px;
  font-size: 1.02rem;
  font-weight: 700;
  color: #000;
}

p {
  margin: 0 0 8px;
  text-align: justify;
}

.note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==================== Photo and contact block ==================== */

.intro {
  margin-top: 10px;
}

.photo {
  float: left;
  width: 152px;
  margin: 2px 18px 8px 0;
  border: 1px solid #ddd;
}

.contact p {
  margin: 0;
  text-align: left;
}

.bio {
  clear: none;
  margin-top: 12px;
}

/* ==================== Table-style lists (news, papers, talks) ==================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 0;
}

table td {
  padding: 3px 0;
  vertical-align: top;
}

/* Left column: date */
td.date {
  width: 108px;
  padding-right: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Left column: reference tag such as [C1] */
td.tag {
  width: 78px;
  padding-right: 10px;
  white-space: nowrap;
}

.news td,
.pubs td {
  text-align: left;
}

/* ==================== Footer ==================== */

footer {
  margin-top: 34px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--text-muted);
}

footer p {
  margin: 0;
  text-align: left;
}

/* ==================== Phones and tablets ==================== */

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 0 26px;
  }

  .nav-group {
    margin-bottom: 8px;
  }

  main {
    margin-left: 0;
    padding: 14px 16px 44px;
  }

  .photo {
    width: 124px;
    margin-right: 14px;
  }

  p {
    text-align: left;
  }

  td.date,
  td.tag {
    width: 92px;
    padding-right: 8px;
  }
}

@media (max-width: 480px) {
  :root {
    --size-body: 15px;
  }

  .photo {
    float: none;
    display: block;
    margin: 0 0 10px;
  }

  td.date,
  td.tag {
    width: 78px;
  }
}

/* ==================== Print ==================== */

@media print {
  .sidebar {
    display: none;
  }

  main {
    margin-left: 0;
    max-width: none;
  }

  a {
    color: #000;
  }
}
