/* ==========================================================================
   Yuxuan Tong - Minimalist Static Homepage & Publications Stylesheet
   Palette & fonts aligned with Silvia Canelon's Quarto theme used on /blogs
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Petrona:wght@500;600&family=Red+Hat+Text:wght@400;500;600&display=swap");

:root {
  --bg: #fffbf2;
  --fg: #002642;
  --fg-2: #4a5e70;
  --fg-3: #7c8d9b;
  --accent: #a23e02;
  --line: rgba(0, 38, 66, 0.09);
  --ul: rgba(0, 38, 66, 0.24);
  --font-sans: "Red Hat Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Petrona", "Songti SC", "Noto Serif CJK SC", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e171e;
    --fg: #faf0e3;
    --fg-2: #a5b0ba;
    --fg-3: #768592;
    --accent: #d96e34;
    --line: rgba(250, 240, 227, 0.09);
    --ul: rgba(250, 240, 227, 0.25);
  }
}

:root[data-theme="dark"] {
  --bg: #0e171e;
  --fg: #faf0e3;
  --fg-2: #a5b0ba;
  --fg-3: #768592;
  --accent: #d96e34;
  --line: rgba(250, 240, 227, 0.09);
  --ul: rgba(250, 240, 227, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

/* --------------------------------------------------------------------------
   Header & Navigation (right-aligned, matched with /blogs navbar typography)
   -------------------------------------------------------------------------- */

.site-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 44px;
  font-size: 0.9375rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.12s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

.theme-toggle {
  appearance: none;
  background: none;
  border: none;
  padding: 2px 4px;
  margin-left: -4px;
  color: var(--fg-2);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: color 0.12s ease;
}

.theme-toggle:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Restrained Ink Links (monochrome underline, accent on hover)
   -------------------------------------------------------------------------- */

a.ink {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--ul);
  text-underline-offset: 3px;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

a.ink:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Hero Section
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 152px;
  gap: 36px;
  align-items: center;
  margin-bottom: 44px;
}

.hero h1,
.page-header h1 {
  font-family: var(--font-serif);
  font-size: 1.95rem;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.tagline {
  font-size: 0.9375rem;
  color: var(--fg-2);
  margin-bottom: 16px;
}

.hero p {
  font-size: 1rem;
  line-height: 1.68;
  margin: 0 0 11px;
}

/* Brand-colored social icons (GitHub & X adapt automatically to light/dark ink) */
.socials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 15px;
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  opacity: 0.92;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.socials a.social-mono {
  color: var(--fg);
}

.socials a:hover {
  opacity: 1;
  transform: translateY(-1.5px);
}

.socials svg {
  width: 19px;
  height: 19px;
  display: block;
  flex-shrink: 0;
}

.email-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 0.875rem;
  color: var(--fg-2);
}

.email-line svg {
  width: 14.5px;
  height: 14.5px;
  flex-shrink: 0;
  opacity: 0.82;
}

.email-copy {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--fg-2);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--ul);
  text-underline-offset: 3px;
  transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.email-copy:hover,
.email-copy.copied {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.hero-photo {
  width: 152px;
  height: auto;
  border-radius: 8px;
  display: block;
}

.page-header {
  margin-bottom: 28px;
}

.page-header .tagline {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Sections & Aligned Grids
   -------------------------------------------------------------------------- */

.sec {
  padding-top: 26px;
  margin-top: 26px;
  border-top: 1px solid var(--line);
}

.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.sec-head h2 {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0;
}

.sec-head .more {
  font-size: 0.86rem;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.12s ease;
}

.sec-head .more:hover {
  color: var(--accent);
}

/* Selected Publications (Left: title + 1-line summary; Right: tabular venue) */
.work-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.work-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: baseline;
}

.work-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
}

/* Standalone list titles omit resting underlines to match /publications/ and /blogs/ */
.work-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.12s ease;
}

.work-title a:hover {
  color: var(--accent);
}

.work-desc {
  font-size: 0.90625rem;
  color: var(--fg-2);
  margin-top: 2px;
}

.work-venue {
  font-size: 0.85rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.work-award {
  display: block;
  font-size: 0.78rem;
  color: var(--fg-3);
  margin-top: 2px;
}

/* Key-Value Two-Column Aligned Rows (Projects) */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kv-row {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 18px;
  align-items: baseline;
  font-size: 0.96875rem;
  line-height: 1.54;
}

.kv-key {
  font-size: 0.85rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}

.kv-key a {
  color: var(--fg);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
  transition: color 0.12s ease;
}

.kv-key a:hover {
  color: var(--accent);
}

.kv-val {
  font-size: 1rem;
  color: var(--fg);
  font-weight: 500;
}

.kv-sub {
  color: var(--fg-2);
  font-size: 0.90625rem;
  margin-top: 2px;
}

/* Experience & Education Rows (Logo + Details + Right-Aligned Date) */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exp-row {
  display: grid;
  grid-template-columns: 38px 1fr 124px;
  gap: 14px;
  align-items: start;
  font-size: 0.96875rem;
  line-height: 1.54;
}

.exp-logo {
  width: 36px;
  height: 36px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  flex-shrink: 0;
}

.exp-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Soft warm badge in dark mode so dark/colored university seals remain crisp */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .exp-logo {
    background-color: rgba(255, 251, 242, 0.92);
    padding: 3px;
  }
}

:root[data-theme="dark"] .exp-logo {
  background-color: rgba(255, 251, 242, 0.92);
  padding: 3px;
}

.exp-date {
  font-size: 0.85rem;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: left;
  padding-top: 2px;
}

/* Multi-role entry under a single organization (e.g. Intern -> Full-time) */
.exp-row--multi {
  grid-template-columns: 38px 1fr;
}

.exp-roles {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.exp-role {
  display: grid;
  grid-template-columns: 1fr 124px;
  gap: 14px;
  align-items: baseline;
}

.exp-role .kv-sub {
  margin-top: 0;
}

.exp-role .exp-date {
  padding-top: 0;
}

/* Misc Paragraph */
.misc-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--fg-2);
}

/* --------------------------------------------------------------------------
   Publications Page (Year Column + Full Entries + Inline Copy BibTeX)
   -------------------------------------------------------------------------- */

.pub-yr-group {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 24px;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.pub-yr {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.pub-items {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pub-entry .pt {
  font-size: 1rem;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.45;
}

.pub-entry .pt a {
  color: inherit;
  text-decoration: none;
  transition: color 0.12s ease;
}

.pub-entry .pt a:hover {
  color: var(--accent);
}

.pub-entry .pa {
  font-size: 0.90625rem;
  color: var(--fg-2);
  margin-top: 3px;
  line-height: 1.54;
}

.pub-entry .pa strong {
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--ul);
  text-underline-offset: 2px;
}

.pub-entry .pa .note {
  color: var(--fg-3);
  font-size: 0.84rem;
}

/* Unified resource link bar shared across Publications, Blogs, and Talks */
.resource-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  row-gap: 4px;
  font-size: 0.84rem;
}

.resource-links > a,
.resource-links > button {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--fg-2);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.12s ease;
}

.resource-links > a:hover,
.resource-links > button:hover,
.resource-links > .bib-copy.copied {
  color: var(--accent);
  text-decoration: none;
}

.resource-links > :not(:last-child)::after {
  content: "/";
  display: inline-block;
  margin: 0 0.48rem;
  color: var(--fg-3);
  opacity: 0.5;
  font-weight: 400;
  text-decoration: none;
  pointer-events: none;
  user-select: none;
}

.pub-entry .pm {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 16px;
  row-gap: 4px;
  font-size: 0.84rem;
  color: var(--fg-3);
  margin-top: 5px;
}

.pub-entry .pm .pub-venue-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
}

.pub-entry .pm .venue {
  color: var(--fg-2);
  font-weight: 500;
}

.pub-entry .pm .award {
  color: var(--fg-3);
}

.pub-entry .pm .award a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--ul);
  text-underline-offset: 2px;
}

.pub-entry .pm .award a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--fg-3);
}

/* --------------------------------------------------------------------------
   Responsive Mobile Breakpoint
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  .wrap {
    padding: 24px 18px 48px;
  }

  .site-header {
    margin-bottom: 30px;
  }

  .site-nav {
    gap: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-bottom: 34px;
  }

  .hero-photo {
    order: -1;
    width: 112px;
  }

  .work-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .work-venue {
    text-align: left;
  }

  .kv-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .exp-row {
    grid-template-columns: 32px 1fr;
    gap: 2px 12px;
  }

  .exp-logo {
    grid-row: 1 / 3;
    width: 32px;
    height: 32px;
  }

  .exp-date {
    grid-column: 2;
    text-align: left;
    padding-top: 0;
    margin-top: 2px;
  }

  .exp-row--multi {
    grid-template-columns: 32px 1fr;
  }

  .exp-row--multi .exp-logo {
    grid-row: 1;
  }

  .exp-roles {
    gap: 6px;
  }

  .exp-role {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .exp-role .exp-date {
    grid-column: 1;
    margin-top: 1px;
  }

  .pub-yr-group {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
