/*
  ================================================================
  MANUAL DESIGN CONTROLS
  The defaults closely follow the scale and typography of
  nageebali.com. Change these variables first when fine-tuning.
  Add ?debug=1 to the URL to show layout boundaries.
  ================================================================
*/
:root {
  color-scheme: light;

  --background: #fcfcfb;
  --ink: #23221f;
  --name-color: #1c2b3a;
  --blue: #2c4a72;
  --body-muted: #55524b;
  --quiet: #8d877b;
  --line: #d8d2c4;
  --link-underline: #b9b3a6;

  --font-serif: "Source Serif 4", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;

  --page-width: 1060px;
  --page-padding-x: 32px;
  --page-padding-top: 56px;
  --page-padding-bottom: 80px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue);
}

::selection {
  background: #e8e2d6;
  color: var(--ink);
}

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--page-padding-top) var(--page-padding-x) var(--page-padding-bottom);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.masthead {
  display: flex;
  align-items: flex-start;
  gap: 56px;
  padding: 0 0 56px;
}

.photo {
  flex-shrink: 0;
  /* Align the portrait top with the first “Welcome” line. */
  margin-top: 66px;
  margin-right: 18px;
  margin-left: auto;
}

.photo-placeholder,
.portrait-image {
  width: 210px;
  height: 263px;
  display: block;
  border-radius: 4px;
}

.photo-placeholder {
  position: relative;
  overflow: hidden;
  border: 1px solid #ddd7ca;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.5), rgba(228, 223, 212, 0.58)),
    #f0ede5;
  color: #9a958a;
}

.photo-placeholder > span {
  position: absolute;
  top: 48%;
  left: 50%;
  font-size: 44px;
  letter-spacing: -0.04em;
  transform: translate(-50%, -50%);
}

.photo-placeholder small {
  position: absolute;
  right: 10px;
  bottom: 8px;
  left: 10px;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.portrait-image {
  object-fit: cover;
}

.bio {
  flex: 1;
  min-width: 0;
}

h1 {
  margin: 0 0 20px;
  color: var(--name-color);
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.16;
}

h1 span {
  color: inherit;
  font-family: "Kaiti SC", STKaiti, "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 1em;
  font-weight: 400;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.introduction {
  max-width: 66ch;
  color: #33312c;
  font-size: 16.5px;
  line-height: 1.65;
  text-wrap: pretty;
}

.introduction p {
  margin: 0 0 12px;
}

.introduction p:last-child {
  margin-bottom: 16px;
}

.contact {
  color: var(--body-muted);
  font-size: 16px;
  line-height: 1.85;
}

.contact a[href^="mailto:"] {
  color: var(--blue);
  font-size: 17px;
  font-weight: 600;
}

.cv-link {
  color: var(--blue);
  font-size: 17px;
  font-weight: 600;
}

[hidden] {
  display: none !important;
}

.paper-group + .paper-group {
  margin-top: 48px;
}

.research {
  padding-top: 2px;
}

.research > h2 {
  margin: 0 0 26px;
  color: var(--blue);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.paper-section-title {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 20.5px;
  font-weight: 600;
  line-height: 1.3;
}

.paper-list {
  display: grid;
  gap: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.paper-heading {
  line-height: 1.55;
}

.paper-title {
  color: var(--blue);
  font-size: 18.9px;
  font-weight: 600;
  text-decoration: none;
}

.paper-title-static {
  display: inline;
  color: var(--name-color);
}

.paper-meta {
  margin-left: 8px;
  color: #6b675e;
  font-size: 15.1px;
}

.coauthor-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 3px;
}

.coauthor-link:hover,
.coauthor-link:focus-visible {
  color: var(--blue);
}

.abstract {
  width: 100%;
  margin-top: 3px;
  max-width: none;
}

.abstract summary {
  width: max-content;
  color: #45423b;
  cursor: pointer;
  font-size: 16.2px;
  font-style: italic;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.abstract summary::-webkit-details-marker {
  display: none;
}

.abstract summary::after {
  margin-left: 6px;
  color: var(--quiet);
  content: "+";
  font-family: var(--font-sans);
  font-size: 12px;
  font-style: normal;
}

.abstract[open] summary::after {
  content: "−";
}

.abstract summary:hover,
.abstract summary:focus-visible {
  color: var(--blue);
  text-decoration-color: var(--link-underline);
}

.abstract-text {
  width: 100%;
  margin-top: 7px;
  max-width: none;
  color: var(--body-muted);
  font-size: 15.1px;
  line-height: 1.65;
}

.paper-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  letter-spacing: 0.05em;
}

.paper-links a {
  color: var(--blue);
  text-decoration: none;
}

.paper-links a:hover,
.paper-links a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid rgba(44, 74, 114, 0.65);
  outline-offset: 3px;
}

/* Debug mode: open the site with ?debug=1. */
html[data-debug="true"] .page {
  outline: 1px dashed rgba(160, 55, 55, 0.5);
  outline-offset: -1px;
}

html[data-debug="true"] section,
html[data-debug="true"] article,
html[data-debug="true"] .photo {
  box-shadow: inset 0 0 0 1px rgba(44, 74, 114, 0.16);
}

@media (max-width: 760px) {
  .page {
    padding: 26px 20px 60px;
  }

  .masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 30px;
    padding: 0 0 44px;
  }

  .photo {
    align-self: flex-start;
    margin-top: 0;
    margin-right: 0;
    margin-left: 0;
  }

  .bio {
    width: 100%;
    text-align: left;
  }

  h1 {
    font-size: 32px;
  }

  .research > h2,
  .paper-section-title,
  .paper-list {
    text-align: left;
  }
}

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