/* =========================================================
   Wang, Xinyue — Academic site
   Palette: olive-green (#69821b) on pale cream
   Typography: Marcellus (display) + Source Serif 4 (body) + Inter (UI)
   ========================================================= */

:root, [data-theme="light"] {
  --bg:           #FBFAF5;   /* very pale cream, almost off-white */
  --bg-soft:      #F2F0E5;   /* card surface */
  --ink:          #25281C;   /* near-black with faint olive undertone */
  --ink-soft:     #525548;
  --ink-muted:    #8A8C7E;
  --rule:         #E2DECF;   /* hairline */
  --accent:       #69821b;
  --accent-deep:  #4E6314;
  --accent-soft:  #A5B86B;
  --shadow:       0 10px 28px -18px rgba(43,46,34,.30);
}

[data-theme="dark"] {
  --bg:           #1B1D17;
  --bg-soft:      #25281F;
  --ink:          #E8E6DA;
  --ink-soft:     #B5B3A4;
  --ink-muted:    #7F8175;
  --rule:         #3A3D33;
  --accent:       #A5B86B;
  --accent-deep:  #C8D699;
  --accent-soft:  #69821b;
  --shadow:       0 10px 28px -18px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

html { font-size: 17px; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  line-height: 1.65;
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 200ms ease, color 200ms ease;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  gap: 1.5rem;
}

.site-brand {
  font-family: "Marcellus", Georgia, serif;
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav ul {
  display: flex;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}

.site-nav a:hover { color: var(--accent); }
.site-nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 180ms ease, border-color 180ms ease;
}

.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ---------- Main ---------- */
main.container {
  padding-top: 4rem;
  padding-bottom: 4rem;
  min-height: calc(100vh - 140px);
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  font-family: "Marcellus", Georgia, serif;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.25;
  margin: 2.5rem 0 1rem;
}

h1 { font-size: clamp(1.8rem, 3.5vw, 2.2rem); margin-top: 0; }

h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

h3 { font-size: 1.1rem; margin-top: 1.75rem; }

p { margin: 0 0 1.1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: color 180ms ease, border-color 180ms ease;
}

a:hover { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }

em { font-style: italic; color: var(--ink-soft); }
strong { font-weight: 600; color: var(--ink); }

ul, ol { padding-left: 1.2rem; }
li { margin-bottom: 0.5rem; }

/* ---------- Landing layout ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 3.5rem;
  align-items: start;
}

.hero p { font-size: 1.02rem; }

.hero .secondary {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.hero .closing {
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 1.5rem;
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 2px;
  filter: grayscale(10%);
  box-shadow: var(--shadow);
}

/* "Check out here my" + small buttons under photo */
.photo-cta {
  margin-top: 1.1rem;
  text-align: center;
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

.photo-cta .lead {
  display: block;
  margin-bottom: 0.55rem;
}

.btn-mini {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.32rem 0.75rem;
  margin: 0 0.15rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.btn-mini:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Contact card (v1 notation style) ---------- */
.contact-card {
  margin-top: 1.75rem;
  padding: 1.5rem 1.75rem;
  background: var(--bg-soft);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
}

.contact-card .contact-title {
  font-family: "Marcellus", Georgia, serif;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0 0 0.9rem;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
  font-family: "Inter", sans-serif;
  font-size: 0.92rem;
}

.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin: 0;
}

.contact-list .label {
  color: var(--ink-muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-width: 60px;
  flex-shrink: 0;
}

/* ---------- Research entries ---------- */
.paper-list { list-style: none; padding: 0; margin: 0; }

.paper {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.paper:last-child { border-bottom: none; }

.paper-title {
  font-family: "Marcellus", Georgia, serif;
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
  color: var(--ink);
}

.paper-meta {
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
}

.paper-meta .status {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 0.5rem;
}

.paper-abstract { color: var(--ink-soft); font-size: 0.97rem; }

/* ---------- Abstract expand/collapse ---------- */
.paper-details { margin-top: 0.7rem; }

.paper-details summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent, #69821b);
  letter-spacing: 0.02em;
  user-select: none;
}

.paper-details summary::-webkit-details-marker { display: none; }
.paper-details summary::marker { content: ""; }

.paper-details summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.68rem;
  transition: transform 0.2s ease;
}

.paper-details[open] summary::before {
  transform: rotate(90deg);
}

.paper-details .paper-abstract {
  margin: 0.7rem 0 0;
  line-height: 1.65;
  animation: abstract-fade 0.2s ease;
}

@keyframes abstract-fade {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- CV embed ---------- */
.cv-embed {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 600px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}

.cv-fallback {
  text-align: center;
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin-top: 0.8rem;
}

/* ---------- Footer (compact) ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 0.85rem 0;
  font-family: "Inter", sans-serif;
  font-size: 0.76rem;
  color: var(--ink-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  html { font-size: 16px; }
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .hero-photo { max-width: 220px; margin: 0 auto; }
  .header-inner { gap: 0.75rem; flex-wrap: wrap; }
  .header-right { gap: 1rem; }
  .site-nav ul { gap: 1.25rem; }
  .site-nav a { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
