/* CSS Reset: http://meyerweb.com/eric/tools/css/reset */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
  display: block;
}
body {
  line-height: 1;
}
ol, ul {
  list-style: none;
}
blockquote, q {
  quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/**************************************************/
/* Light/Dark mode - auto switch by system preference */

:root {
  --color-text: #e4e4e7;
  --color-bg: #0f0f12;
  --color-muted: #6b6b7b;
  --color-muted-alt: #8b8b9b;
  --color-link: #60a5fa;
  --color-link-hover-border: #60a5fa;
  --color-heading: #e4e4e7;
  --color-button-unchecked: #6b6b7b;
  --color-button-checked: #e4e4e7;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-text: #1f2937;
    --color-bg: #f9fafb;
    --color-muted: #6b7280;
    --color-muted-alt: #4b5563;
    --color-link: #2563eb;
    --color-link-hover-border: #2563eb;
    --color-heading: #111827;
    --color-button-unchecked: #6b7280;
    --color-button-checked: #111827;
  }
}

/* Manual theme override */
#body[data-theme="light"] {
  --color-text: #1f2937;
  --color-bg: #f9fafb;
  --color-muted: #6b7280;
  --color-muted-alt: #4b5563;
  --color-link: #2563eb;
  --color-link-hover-border: #2563eb;
  --color-heading: #111827;
  --color-button-unchecked: #6b7280;
  --color-button-checked: #111827;
}
#body[data-theme="dark"] {
  --color-text: #e4e4e7;
  --color-bg: #0f0f12;
  --color-muted: #6b6b7b;
  --color-muted-alt: #8b8b9b;
  --color-link: #60a5fa;
  --color-link-hover-border: #60a5fa;
  --color-heading: #e4e4e7;
  --color-button-unchecked: #6b6b7b;
  --color-button-checked: #e4e4e7;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  padding: 0.4em 0.75em;
  border: 1px solid var(--color-muted);
  border-radius: 0.25em;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  border-color: var(--color-link);
  background: var(--color-muted);
}

#body {
  font-family: 'Asap', roboto, sans-serif;
  font-size: 1em;
  line-height: 1.5em;
  color: var(--color-text);
  background-color: var(--color-bg);
}

#main {
  width: 54em;
  margin: 0px auto;
  position: relative;
  min-height: 100vh;
}

.job-banner-text {
  color: #dc2626;
  /* 不设 font-size，继承父级，与 intro 段落一起随视口/缩放变化 */
}

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

a:hover {
  text-decoration: none;
  border-bottom: 1px solid var(--color-link-hover-border);
}

i {
  font-style: italic;
}

b {
  font-weight: 700;
}

h1 {
  font-size: 2.4em;
  line-height: 2.4em;
  font-weight: 500;
}

/**************************************************/
/* Profile image and description. */

#intro {
  padding-top: 6em;
}

#intro-text {
  /* 无固定宽度，文字绕排照片后会在照片下方延申至整行 */
}

.mcgill-logo {
  height: 1.2em;
  vertical-align: -0.2em;
  margin-right: 0.3em;
}

.mcgill-logo-sm {
  height: 1.08em;
  vertical-align: -0.2em;
  margin-right: 0.3em;
}

.abaka-logo {
  height: 0.9em;
  vertical-align: -0.1em;
  margin-right: 0.3em;
}

.intro-deepmind-logo {
  height: 1.15em;
  vertical-align: -0.2em;
  margin-right: 0.3em;
}

.social-logo {
  height: 1em;
  vertical-align: -0.15em;
  margin-right: 0.25em;
}

#intro-image {
  margin: 3em 0 0 2em;
  width: 12em;
  float: right;
  border-radius: 1em;
}

/* 无照片时：隐藏右侧照片栏，intro 文字占满整行。在 #intro 上加 class="no-photo" 即可 */
#intro.no-photo #intro-image {
  display: none;
}
#intro.no-photo #intro-text {
  width: auto;
  max-width: 100%;
}

#intro-image img {
  width: 12em;
}
#intro-image .photo-caption {
  margin: 0.5em 0 0 0;
  font-size: 0.85em;
  color: var(--color-muted);
  font-style: italic;
  line-height: 1.3;
  text-align: center;
}

#footer .footer-stat {
  color: var(--color-muted);
  font-size: 0.9em;
}
#footer .footer-sep {
  color: var(--color-muted);
}

/**************************************************/
/* Section buttons. */

#menu {
  display: flex;
}

.menu-item {
  float: left;
  margin-right: 2em;
}

h2 {
  font-size: 1.6em;
  line-height: 2.4em;
  margin-top: 0.5em;
  color: var(--color-muted);
}

.selected h2 {
  color: var(--color-heading);
}

.button {
  display: inline-block;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-button-unchecked);
  font-size: 1.6em;
  line-height: 2.4em;
  margin-top: 0.5em;
  margin-right: 1em;
  float: left;
  padding: 0;
}

.button:hover {
  color: var(--color-heading);
}

.button:active,
.button.is-checked {
  color: var(--color-button-checked);
}

.button-group:after {
  content: '';
  display: block;
  clear: both;
}

/**************************************************/
/* Isotope grid list of items. */

.grid {
  padding-bottom: 6em;
}

/* clear fix */
.grid:after {
  content: '';
  display: block;
  clear: both;
}

.description {
  margin-bottom: 1em;
  padding-bottom: 0.5em;
}

.list-item {
  width: 100%;
  line-height: 1em;
  margin-top: 1em;
}

.list-item p.date {
  display: inline-block;
  width: 3em;
  color: var(--color-muted);
}
.list-item p.date.date-wide {
  width: auto;
}

/* Tighter spacing after Awards / Academic Service headings */
.list-item.misc.description h2 {
  line-height: 1.25em;
  margin-bottom: 0;
}
.list-item.misc.description.misc-heading-spaced {
  margin-top: 1.5em;
}
.list-item.misc.description + .list-item.misc {
  margin-top: 0.1em;
}

/* Experience – LinkedIn-style layout */
.list-item.experience.exp-card {
  display: flex;
  gap: 1.25em;
  margin-top: 0;
  margin-bottom: 0;
  padding: 1.25em 0;
  line-height: 1.5em;
  border-bottom: 1px solid var(--color-muted);
}
.list-item.experience.exp-card:first-of-type {
  padding-top: 0.5em;
}
.list-item.experience.exp-card:last-of-type {
  border-bottom: none;
  padding-bottom: 0.5em;
}
.list-item.experience .exp-logo {
  flex-shrink: 0;
  width: 3.5em;
  height: 3.5em;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-bg);
}
.list-item.experience .exp-logo a {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}
.list-item.experience .exp-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
}
.list-item.experience .exp-content {
  flex: 1;
  min-width: 0;
}
.list-item.experience .exp-role {
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 0.15em;
}
.list-item.experience .exp-company {
  font-size: 1em;
  margin-bottom: 0.2em;
}
.list-item.experience .exp-meta {
  color: var(--color-muted);
  font-size: 0.9em;
  margin-bottom: 0.5em;
}
.list-item.experience .exp-desc {
  margin: 0 0 0.5em 0;
  line-height: 1.55em;
  color: var(--color-text);
  font-size: 0.98em;
}
.list-item.experience .exp-desc:last-child {
  margin-bottom: 0;
}

/* Reviewer list (Academic Service) */
.reviewer-list {
  list-style-type: disc;
  padding-left: 1.5em;
  margin: 0.4em 0 1em 0;
  line-height: 1.5em;
}
.reviewer-list li {
  margin-bottom: 0.2em;
}
.list-item.misc p.date.date-wide:not(:first-of-type) {
  margin-top: 0.35em;
}

/* Misc section – spacing between lines */
.list-item.misc-extra p {
  margin-bottom: 0.75em;
}
.list-item.misc-extra p:last-child {
  margin-bottom: 0;
}
/* WeChat modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.modal-open {
  display: flex;
}
.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
}
.modal-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 8px;
  display: block;
}
.modal-close {
  position: absolute;
  top: -2em;
  right: 0;
  background: transparent;
  border: none;
  color: var(--color-text);
  font-size: 2em;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.list-item.misc-extra .misc-cat-img {
  display: block;
  width: 11.2em;
  height: auto;
  max-height: 11.2em;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 0.5em;
}

/**************************************************/
/* Gallery of 3 preview videos. */

.previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  grid-auto-rows: minmax(100px, auto);
  height: 12.5em;
}

.previews video {
  border-radius: 5px;
}

.previews a:hover {
  border: none;
}

.preview1 {
  grid-column: 1;
  width: 100%;
}
.preview2 {
  grid-column: 2;
  width: 100%;
}
.preview3 {
  grid-column: 3;
  width: 100%;
}

/**************************************************/
/* Buttons for showing more or less highlights. */

.toggle-button {
  margin-top: 1em;
}

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

.toggle-button a:hover {
  color: var(--color-link);
}

/**************************************************/
/* Publication details (thumbnail media, title, and description). */

.thumbnail {
/*  width: 21%;*/
  width: 18%;
  float: left;
  margin-right: 2%;
}

.thumbnail:hover {
  border-bottom: none;
}

.thumbnail img {
  margin-top: 0.4em;
  border-radius: 5px;
  width: 100%;
  aspect-ratio: 5 / 3;
  object-fit: cover;
}

.thumbnail video {
  margin-top: 0.4em;
  border-radius: 5px;
  width: 100%;
  height: 100%;
}

h3 {
  font-size: 1em;
  line-height: 1.5em;
}

h3 a {
  color: var(--color-heading);
}

h3 a:hover {
  color: var(--color-link);
}

.publication {
  margin-bottom: 0.5em;
}

.publication-topic-heading {
  width: 100%;
  clear: both;
  margin-top: 1em;
  margin-bottom: 0;
}
.publication-topic-heading:first-of-type {
  margin-top: 0;
}
.pub-topic-title {
  font-size: 1.25em;
  line-height: 1.25em;
  margin: 0.5em 0 0 0;
  padding: 0;
  color: var(--color-muted);
  font-weight: inherit;
}
.selected .pub-topic-title {
  color: var(--color-heading);
}

.publication p {
  font-size: 1em;
  line-height: 1.5em;
  color: var(--color-muted-alt);
}

.project-description {
  width: 80%;
  float: left;
}

/**************************************************/
/* Subtle footer at the bottom of the page. */

#footer {
  color: var(--color-muted);
  position: absolute;
  bottom: 0;
  line-height: 2.5em;
}
