/* Body typography: scholarly serif */
body {
  font-family: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  color: #333333;
  background: #ffffff;
}

/* Headings: crisp sans for contrast */
h1, h2, h3, h4, h5, h6, .page__title {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.015em;
}

/* Link color (orange) + hover like your reference */
a, .page__content a, .archive__item-title a {
  color: #bd5d38;
  text-decoration: none;
}
a:hover, .page__content a:hover, .archive__item-title a:hover {
  color: #824027;
  text-decoration: underline;
}

/* Text selection highlight (orange) */
::selection { background-color: #ffb699; color: #1a1a1a; }
::-moz-selection { background-color: #ffb699; color: #1a1a1a; }

/* Optional: inline emphasis class similar to .text-primary in your sample */
.text-primary { color: #4c5157 !important; }

/* Optional: <mark> highlight to match palette */
mark {
  background-color: #ffe2d2;
  color: inherit;
  padding: 0 .15em;
  border-radius: 2px;
}

/* Body typography: scholarly serif */
body {
  font-family: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  color: #333333;
  background: #ffffff;
  
}

/* Headings: crisp sans for contrast */
h1, h2, h3, h4, h5, h6, .page__title {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  letter-spacing: -0.015em;
}

/* Link color (orange) + hover like your reference */
a, .page__content a, .archive__item-title a {
  color: #bd5d38;
  text-decoration: none;
}
a:hover, .page__content a:hover, .archive__item-title a:hover {
  color: #824027;
  text-decoration: underline;
}

/* Text selection highlight (orange) */
::selection { background-color: #ffb699; color: #1a1a1a; }
::-moz-selection { background-color: #ffb699; color: #1a1a1a; }

/* Optional: inline emphasis class similar to .text-primary in your sample */
.text-primary { color: #4c5157 !important; }

/* Optional: <mark> highlight to match palette */
mark {
  background-color: #ffe2d2;
  color: inherit;
  padding: 0 .15em;
  border-radius: 2px;
}


/* Utility: smaller text block inside page content */
.page__content .smaller-text {
  font-size: 0.85rem !important;   /* smaller than body */
  line-height: 1.45 !important;
}

/* Ensure nested elements inherit the same scale */
.page__content .smaller-text * {
  font-size: inherit !important;
  line-height: inherit !important;
}


/* ===== Selected Projects: media-left, text-right ===== */
.project-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 22px 0;
}
.project-thumb { flex: 0 0 360px; }                  /* left media width; tweak 300–420 */
.project-body  { flex: 1; min-width: 0; }

/* 16:9 media frame for image/video/iframe */
.media-16x9 {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;                               /* unified ratio */
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.media-16x9 img,
.media-16x9 video,
.media-16x9 iframe {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;                                   /* fill & center-crop; use 'contain' to avoid crop */
  object-position: center;
  border: 0;
  background: #f7f7f7;
}


.media-auto {
  width: 100%;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.media-auto img {
  width: 100%;
  height: auto;           
  display: block;
}


/* Right column typography */
.project-system { color: #4c5157; margin-bottom: 4px; }
.project-title  { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.3; color: #222; }
.project-conf   { margin: 2px 0 6px; font-style: italic; }
.project-authors{ margin: 4px 0 6px; color: #444; }

.project-links { margin: 4px 0 8px; }
.project-links a { color: #bd5d38; text-decoration: none; }
.project-links a:hover { color: #824027; text-decoration: underline; }

/* Abstract toggle */
.project-abs summary { cursor: pointer; margin: 6px 0; }
.project-abs summary::-webkit-details-marker { display: none; }
.project-abs summary::after { content: " ⌄"; font-weight: 600; color: #999; }
.project-abs[open] summary::after { content: " ⌃"; }
.project-abs p { margin: 6px 0; }

/* Responsive: stack on small screens */
@media (max-width: 900px) {
  .project-card { flex-direction: column; }
  .project-thumb { flex-basis: auto; width: 100%; }
}






/* --- github intro --- */
.repos-intro { color: #6b7280; margin: 4px 0 10px; }

/* --- filter pills --- */
#filters-repos {
  margin: 8px 0 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#filters-repos .filter-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background-color .2s, box-shadow .2s, border-color .2s;
}
#filters-repos .filter-pill:hover {
  background: #f3f4f6;
}
#filters-repos .filter-pill.active {
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* --- container --- */
#github-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1600px;
  margin: 6px 0 0 0;
}

/* --- card --- */
.github-card {
  flex: 0 1 calc(50% - 16px);
  background-color: #ffffff;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.08);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .2s ease;
}
.github-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

@media (max-width: 820px) {
  .github-card { flex: 0 1 100%; }
}

/* --- header --- */
.repo-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.bookmark-icon { margin-right: 8px; color: #6b7280; }

.repo-name {
  font-weight: 600;
  color: #0366d6;
  font-size: 1rem;
  text-decoration: none;
}
.repo-name:hover { text-decoration: underline; }

/* --- description --- */
.repo-description {
  font-size: 0.95rem;
  color: #4b5563;
  margin-bottom: 14px;
  line-height: 1.45;
}

/* --- stats line --- */
.repo-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.95rem;
  color: #374151;
}
.language-icon { margin-right: 6px; }
.stats-number { margin-left: 0; }

/* Repo stats layout */
.repo-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

/* Each stat group */
.repo-stats .stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4b5563; /* base grey */
}

/* Icons */
.repo-stats .icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  fill: currentColor; /* star uses fill; fork uses stroke=currentColor */
}

/* Nice colors */
.repo-stats .icon-star { color: #f5b301; }     /* warm gold */
.repo-stats .icon-fork { color: #6b7280; }     /* neutral grey */

/* Numbers */
.repo-stats .stats-number {
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* Dark theme tweak (optional) */
.dark-theme .repo-stats .stat { color: #d1d5db; }
.dark-theme .repo-stats .icon-fork { color: #cbd5e1; }


/* --- dark mode (optional) --- */
.dark-theme .github-card { background-color: #1f2937; color: #e5e7eb; }
.dark-theme .repo-description,
.dark-theme .stats-number { color: #e5e7eb; }
.dark-theme .bookmark-icon, .dark-theme .fork-icon { color: #9ca3af; }
.dark-theme #filters-repos .filter-pill { border-color: #374151; color: #e5e7eb; background:#111827; }
.dark-theme #filters-repos .filter-pill.active { background:#1f2937; border-color:#4b5563; }


/* ===== Gallery ===== */
.gallery-intro { color: #6b7280; margin: 4px 0 14px; }

/* Responsive grid (auto-fit columns with min card width) */
#gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

/* Card block */
.gcard { display: block; }
.gcard__figure { margin: 0; }
.gcard__btn {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  width: 100%;
  cursor: zoom-in;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
}
.gcard__img {
  display: block;
  width: 100%;
  height: 200px;              /* screenshot-like height */
  object-fit: cover;          /* neat crop */
  object-position: center;
  transition: transform .25s ease;
}
.gcard__btn:hover .gcard__img { transform: scale(1.03); }

/* Caption card under the image */
.gcard__cap {
  margin-top: 8px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.gcard__year { color: #6b7280; }

/* Dark theme support */
.dark-theme .gcard__cap { background:#1f2937; border-color:#374151; color:#e5e7eb; }
.dark-theme .gcard__btn { box-shadow: 0 2px 6px rgba(0,0,0,.35); }

/* Lightbox dialog */
.gbox::backdrop { background: rgba(0,0,0,.55); }
.gbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 92vw;
  max-height: 92vh;
}
.gbox img {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}


/* ---------- Gallery cards (float-based, 4 per row) ---------- */
.gallery-intro { color: #6b7280; margin: 4px 0 14px; }

/* Container + clearfix */
.gallery-wrap { margin: 4px 0; }
.clearfix::after { content: ""; display: table; clear: both; }

/* Single card */
div.gallery {
  float: left;
  /* 4 per row: 25% minus left+right margins (8px+8px = 16px) */
  width: calc(25% - 16px);
  margin: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
  transition: transform .15s ease, box-shadow .2s ease;
}
div.gallery:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,.08); }

/* Start a new row every 4 items */
div.gallery:nth-child(4n+1) { clear: both; }

/* Image: smaller, no crop */
div.gallery img {
  display: block;
  width: 100%;
  max-height: 140px;              /* smaller thumbnails */
  object-fit: contain;            /* no cropping */
  object-position: center;
  background: #f8fafc;            /* letterbox fill for different ratios */
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* Caption */
div.desc {
  padding: 10px 12px;
  text-align: center;
  line-height: 1.35;
  color: #374151;
  border-top: 1px solid #e5e7eb;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  background: #fff;
}

/* Dark mode tweak (if you use it) */
.dark-theme div.gallery { background:#1f2937; border-color:#374151; }
.dark-theme div.desc    { background:#1f2937; color:#e5e7eb; border-color:#374151; }

/* Responsive breakpoints */
@media (max-width: 1200px) { div.gallery { width: calc(33.333% - 16px); } } /* 3 per row */
@media (max-width: 820px)  { div.gallery { width: calc(50% - 16px); } }     /* 2 per row */
@media (max-width: 560px)  { div.gallery { width: 100%; } }                  /* 1 per row */



/* ===== Publications styling: highlight ===== */
.pubs { 
  margin: 0 0 1.25rem 1.2em;      /* keep default ordered-list numbers */
  padding-left: 0.8em;
}
.pubs > li {
  margin: 0 0 0.8rem 0;
  line-height: 1.6;
}

/* Link + note */
.pubs a { color: #bd5d38; text-decoration: none; }
.pubs a:hover { color: #824027; text-decoration: underline; }
.pubs .note { color: #666; margin-left: .35rem; }



/* Highlight "Lei Cheng" in author lists */
.pubs .authors .me{
  font-weight: 800;
  color: #111;
  background: #fff2e9;
  border: 1px solid #f2c7af;
  padding: 0 .22em;
  border-radius: .25em;
}






/* ---------- Portfolio page helpers ---------- */
.muted { color:#6b7280; margin:.2rem 0 1rem; }

/* ===== Coursework: card + pill chips (scoped) ===== */
.cw-card{
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:14px 16px;
  background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.04);
  margin:.5rem 0 1rem;
}
.cw-lead{
  color:#6b7280;
  font-size:.95rem;
  margin-bottom:.45rem;
}
.cw-pills{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.cw-pills span{
  border:1px solid #e5e7eb;
  background:#f9fafb;
  color:#374151;
  padding:6px 10px;
  border-radius:9999px;
  font-size:.95rem;
  line-height:1.2;
}
.dark-theme .cw-card{ background:#0b0f14; border-color:#1f2937; }
.dark-theme .cw-pills span{ border-color:#374151; background:#111827; color:#e5e7eb; }

/* ===== Reviewing Service: single-column list (scoped) ===== */
.reviewers{
  /* force one column and undo any global multi-column/list layout */
  display:block !important;
  column-count:1 !important;
  -webkit-columns:1 !important;
  -moz-columns:1 !important;
  column-gap:0 !important;

  list-style:disc;
  padding-left:1.25rem;   /* bullet indent */
  margin:.25rem 0 1rem;
}
.reviewers li{
  display:list-item !important;
  break-inside:avoid;
  margin:.28rem 0;
  color:#374151;
  line-height:1.45;
}
.dark-theme .reviewers li{ color:#e5e7eb; }

/* ===== Honors & Awards: table (scoped) ===== */
.awards-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 8px;
}
.awards-table td{
  padding:10px 12px;
  background:#fff;
  border:1px solid #e5e7eb;
}
.awards-table tr td:first-child{
  border-top-left-radius:8px;
  border-bottom-left-radius:8px;
}
.awards-table tr td.year{
  width:80px;
  text-align:right;
  color:#6b7280;
  border-left:none;
}
.awards-table tr td:not(.year){ border-right:none; }
.awards-table .note{ margin-left:.5rem; color:#6b7280; font-style:italic; }

.dark-theme .awards-table td{ background:#111827; border-color:#374151; }
.dark-theme .awards-table tr td.year{ color:#9ca3af; }
.dark-theme .awards-table .note{ color:#9ca3af; }
