/* ---------------------------------------------------------------------------
   Haoyu Li — minimal academic site
   Palette and type sampled from the reference design.
   --------------------------------------------------------------------------- */

:root {
  --ink:      #150C21;  /* headings and body text            */
  --muted:    #5F6B76;  /* secondary text, labels, gutters   */
  --link:     #146EBE;  /* links                              */
  --rule:     #D9DEE3;  /* hairline dividers                  */
  --placeholder: #FFFFFF; /* image wells (kept white)          */
  --bg:       #FFFFFF;
  --wrap:     928px;  /* 864px content + 2 x 32px padding, as on ankile.com */
}

/* Asap's ampersand is stylised and reads oddly in "Texas A&M". This face
   covers only U+0026 and borrows a plain one from the system; every other
   character falls through to Asap. */
@font-face {
  font-family: 'Plain Amp';
  src: local('Helvetica Neue'), local('HelveticaNeue'), local('Helvetica'), local('Arial'), local('ArialMT');
  unicode-range: U+0026;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: #FFFFFF;
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Plain Amp', 'Asap', roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 76px 32px 0;
}

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 36px 0 0;
}

/* --- section labels ------------------------------------------------------ */

.label {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section { margin-top: 22px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

/* --- header -------------------------------------------------------------- */

.masthead {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.masthead h1 {
  margin: 0;
  font-size: 38px;
  font-weight: 500;
  line-height: 1.2;
}

.masthead p { margin: 14px 0 0; }
.masthead h1 + p { margin-top: 25px; }
.masthead p + p { margin-top: 14px; }

.profile-links {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 16px;
}

.contact {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
}

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

.sidecar { width: 192px; flex-shrink: 0; }

.sidecar img.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border: 1px solid var(--rule);
  border-radius: 10px;
}





.note { margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* --- row lists (news, service) ------------------------------------------- */

.rows {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row { display: flex; gap: 20px; align-items: baseline; }

.row .gutter {
  width: 92px;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* --- disclosure toggle ---------------------------------------------------- */

.toggle {
  margin-top: 10px;
  min-height: 44px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.toggle:hover { color: var(--ink); }
.toggle sup { font-size: 10.5px; }
.toggle svg { width: 10px; height: 10px; }
.toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.toggle .more { display: inline; }
.toggle .less { display: none; }
.toggle[aria-expanded="true"] .more { display: none; }
.toggle[aria-expanded="true"] .less { display: inline; }

[hidden] { display: none !important; }

/* --- publication index ---------------------------------------------------- */

.tabs {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tab {
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  color: var(--muted);
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  color: var(--link);
  font-weight: 600;
  cursor: default;
}

.tab-sep { color: #C3CAD1; }

.pubs {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.year-divider { line-height: 1; }

.year-divider span {
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--link);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.pub { display: flex; gap: 20px; align-items: flex-start; }

.pub .gutter {
  width: 44px;
  flex-shrink: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* Thumbnails are prepared at exactly 3:2, so nothing is cropped here. */
.pub img,
.pub .well {
  width: 160px;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid var(--rule);
  background: var(--placeholder);
}

.pub .body { flex-grow: 1; min-width: 0; }
.pub .title { font-weight: 600; line-height: 1.4; }
.pub .authors { margin-top: 3px; line-height: 1.45; color: var(--muted); }
.pub .authors strong { font-weight: 700; }
.pub .venue { font-style: italic; color: var(--muted); }
.pub .links { margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.pub .links .sep { color: var(--muted); }

/* --- photography ---------------------------------------------------------- */
/* Card styling modelled on xunjianyin.github.io/photography. Layout is
   justified rows (2 then 3 photos) so photos are never cropped. */

.wrap.wide {
  max-width: 1140px;
  padding: 40px 20px 0;
}

.back { display: inline-block; }

.page-title {
  margin: 20px 0 20px;
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
}

.gallery-intro {
  max-width: 600px;
  margin: 0 auto 40px;
  text-align: center;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
}

.gallery-intro p { margin: 0; }

.photo-rows {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 44px;
}

.photo-rights {
  margin: 0 0 64px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.photo-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

/* flex-grow (set inline) = the photo's aspect ratio, so a row's photos
   share one height and keep their original proportions. */
.photo-fill { flex-basis: 0; }

.photo-item {
  position: relative;
  flex-basis: 0;
  flex-shrink: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  outline: none;
}

/* Scroll fade-in, only once JS is known to be running (set in <head>). */
.js .photo-item {
  opacity: 0;
  transform: translateY(30px);
}

.js .photo-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.photo-item:hover,
.js .photo-item.visible:hover,
.photo-item:focus-visible {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.photo-item:focus-visible {
  box-shadow: 0 0 0 2px var(--link), 0 20px 40px rgba(0, 0, 0, 0.15);
}

.photo-item img {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(0.95) contrast(1.05);
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), filter 0.6s ease;
}

.photo-item:hover img,
.photo-item:focus-visible img {
  transform: scale(1.05);
  filter: brightness(1) contrast(1.1);
}

.photo-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 40px 15px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.5px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  opacity: 0;
  transition: all 0.4s ease;
}

.photo-caption .sep { opacity: 0.7; }

.photo-item:hover .photo-caption,
.photo-item:focus-visible .photo-caption { opacity: 1; }

@media (max-width: 860px) {
  .wrap.wide { padding: 30px 15px 0; }
  .photo-rows, .photo-row { gap: 15px; }
}

@media (max-width: 768px) {
  .photo-item { border-radius: 10px; }
  .gallery-intro { margin-bottom: 30px; }
}

@media (max-width: 560px) {
  .wrap.wide { padding: 20px 10px 0; }
  .photo-row { flex-direction: column; }
  .photo-item { flex: none !important; width: 100%; }
  .photo-fill { display: none; }
  .photo-caption { opacity: 1; padding: 30px 12px 12px; font-size: 13.5px; }
}

/* Touch screens can't hover: keep captions visible. */
@media (hover: none) {
  .photo-caption { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .photo-item, .photo-item img, .photo-caption { transition: none; }
  .js .photo-item { opacity: 1; transform: none; }
  .photo-item:hover, .photo-item:hover img { transform: none; }
}

/* --- footer --------------------------------------------------------------- */

.footer {
  padding: 18px 0 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-icons {
  display: flex;
  align-items: center;
  gap: 0;
  margin-right: -3px;   /* optically align the last icon with the rule's edge */
}

.footer-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.footer-icons a:hover { color: var(--ink); text-decoration: none; }

/* --- small screens -------------------------------------------------------- */

@media (max-width: 720px) {
  .wrap { padding-top: 44px; }

  .masthead {
    flex-direction: column-reverse;
    gap: 28px;
  }

  .sidecar { width: 200px; }

  .masthead h1 { font-size: 32px; }

  .row { flex-direction: column; gap: 2px; }
  .row .gutter { width: auto; }

  .pub { flex-wrap: wrap; gap: 14px; }
  .pub .gutter { width: 100%; }
  .pub img, .pub .well { width: 128px; }
  .pub .body { flex-basis: 0; min-width: 200px; }

}
