/* ============================================================
   Shared site styles — Zifeng Wang
   Used by publication.html, software.html, cv.html
   (index.html keeps its own inline styles)
   ============================================================ */

:root {
  --accent: #8b1a1a;
  --accent-soft: #fdf6f6;
  --accent-border: #e8d6d6;
  --text: #1d1d1f;
  --muted: #6b6b70;
  --link: #8b1a1a;
  --venue: #1f5fa8;
  --rule: #ececec;
  --maxw: 1280px;
  --contentw: 1080px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

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

/* ---------- Top bar ---------- */
nav.topbar {
  background: var(--accent);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}
nav.topbar .bar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.6rem;
  font-family: var(--sans);
}
nav.topbar .bar-name {
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
  margin-right: auto;
  letter-spacing: 0.01em;
}
nav.topbar a {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.02rem;
  font-weight: 500;
}
nav.topbar a:hover,
nav.topbar a.current { color: #fff; text-decoration: none; }
nav.topbar a.current { border-bottom: 2px solid #fff; padding-bottom: 2px; }

/* ---------- Page container ---------- */
.page {
  max-width: var(--contentw);
  margin: 0 auto;
  padding: 2.4rem 1.5rem 4rem;
}

.page-title {
  font-family: var(--sans);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 1.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--accent);
}

.page h2 {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--rule);
}

.page h3 {
  font-family: var(--sans);
  font-weight: 600;
}

.page p { margin: 0.7rem 0; }

.page ul { padding-left: 1.3rem; margin: 0.6rem 0; }
.page ul li { margin-bottom: 0.45rem; }
.page ul ul { margin: 0.35rem 0; }

/* ---------- CV / About ---------- */
.bio-container {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1.1rem 1.4rem;
  margin: 0 0 1.8rem;
  font-size: 1rem;
}

/* ---------- Honors & Awards ---------- */
ul.honors { list-style: none; padding: 0; margin: 0.6rem 0; }
ul.honors li {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--rule);
}
ul.honors li:last-child { border-bottom: none; }
.honor-year {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-right: 0.5rem;
}

/* ---------- Software (figure + content rows) ---------- */
.software-list { margin: 0.6rem 0; }
.sw-entry {
  display: flex;
  gap: 1.3rem;
  align-items: flex-start;
  padding: 1.3rem 0;
  border-bottom: 1px dashed var(--rule);
}
.sw-entry:last-child { border-bottom: none; }
.sw-figure { flex: 0 0 300px; width: 300px; }
.sw-figure img {
  width: 100%;
  height: 190px;
  object-fit: contain;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
  display: block;
}
.sw-detail { flex: 1; min-width: 0; }
.sw-detail h3 { margin: 0 0 0.35rem; font-size: 1.08rem; }
.sw-detail ul { margin: 0.3rem 0 0.7rem; }
.sw-detail li { font-size: 0.95rem; }
.sw-links { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.sw-detail { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .sw-entry { flex-direction: column; gap: 0.6rem; }
  .sw-figure { flex-basis: auto; width: 100%; }
  .sw-figure img { height: auto; max-height: 260px; }
}

/* ---------- Software cards (legacy) ---------- */
.software-card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  margin: 1.3rem 0;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.software-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}
.software-card .software-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--rule);
}
.software-card .software-title h3 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--text);
}
.software-links { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.software-content { padding: 1rem 1.4rem; }
.software-content ul { margin: 0; }
.software-content li { font-size: 0.98rem; }

.paper-link, .doc-link {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  transition: all 0.18s ease;
}
.paper-link:hover, .doc-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.github-stars {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.github-stars:hover { text-decoration: none; }
.github-stars img { vertical-align: middle; }

/* ---------- Publications ---------- */
#filter-section {
  background: #fafafa;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.8rem;
}
#filter-section h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  color: var(--text);
}
#filter-section .filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
#filter-section strong { font-family: var(--sans); font-size: 0.85rem; font-weight: 500; }
#filter-section select {
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--rule);
  margin-left: 0.4rem;
  background: #fff;
}
#reset-filters {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.18s ease;
}
#reset-filters:hover { opacity: 0.88; }

h2[id^="year-"] {
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--rule);
}

ul.pub-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.pub-item {
  position: relative;
  padding: 0.7rem 0 0.7rem 1.2rem;
  border-bottom: 1px dashed var(--rule);
}
.pub-item:last-child { border-bottom: none; }
.pub-item::before {
  content: "";
  position: absolute;
  left: 0; top: 1.15rem;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.pub-item p { margin: 0.25rem 0; font-size: 0.98rem; word-wrap: break-word; }
.pub-item b { color: var(--text); }
/* author highlight + venue from inline <font> tags */
.pub-item font[color="#ac0000"] { color: var(--accent) !important; font-weight: 600; }
.pub-item font[color="#0000ff"] { color: var(--venue) !important; font-style: normal; font-weight: 500; }
.pub-item a[href$=".pdf"], .pub-item a[href*="PDF"] { color: var(--accent); }

#no-results-message { padding: 1.2rem 0; font-style: italic; color: var(--muted); }

/* ---------- Blog index ---------- */
.blog-list {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  display: grid;
  gap: 1.1rem;
}
.blog-card {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.blog-card:hover {
  border-color: var(--accent-border);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}
.blog-card-link {
  display: block;
  padding: 1.3rem 1.5rem;
  color: inherit;
  text-decoration: none;
}
.blog-card-link:hover { text-decoration: none; }
.blog-card:hover .blog-card-title { color: var(--accent); }
.blog-card-meta,
.blog-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}
.blog-card-meta span,
.blog-post-meta span { white-space: nowrap; }
.blog-cat {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
}
.blog-card-title {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.4rem;
  transition: color 0.15s ease;
}
.blog-card-excerpt { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- Blog post ---------- */
.blog-post { max-width: 880px; }
.blog-back {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.blog-post-title {
  font-family: var(--sans);
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 1rem 0 0.7rem;
}
.blog-post-meta { margin-bottom: 1.25rem; padding-bottom: 1.1rem; border-bottom: 2px solid var(--rule); }
.blog-post-meta time { white-space: nowrap; }
.blog-author { color: var(--muted); }
.blog-author:hover { color: var(--accent); }
.blog-content {
  font-size: 0.98rem;
  line-height: 1.62;
  overflow-wrap: anywhere;
}
.blog-content > p:not([id^="ref"]) { margin: 0.55rem 0 !important; }
.post-resources {
  margin: 0 0 1.6rem !important;
  padding: 1rem 1.2rem 1rem 2.4rem !important;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent-soft);
}
.post-resources li { margin-bottom: 0.25rem !important; }
.post-resources li:last-child { margin-bottom: 0 !important; }
.post-toc {
  margin: 0 0 1.7rem;
  padding: 1rem 1.2rem 0.9rem;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #fafafa;
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.45;
}
.post-toc h2 {
  margin: 0 0 0.55rem;
  padding: 0;
  border: 0;
  font-size: 1rem;
  letter-spacing: 0;
}
.post-toc ol {
  margin: 0;
  padding-left: 1.3rem;
}
.post-toc ol ol {
  margin: 0.22rem 0 0.05rem;
  padding-left: 1.25rem;
}
.post-toc li { margin-bottom: 0.18rem; }
.post-toc a { color: var(--text); }
.post-toc a:hover { color: var(--accent); }
.blog-content h2[id],
.blog-content h3[id] { scroll-margin-top: 5rem; }
.blog-content img,
.blog-content video { max-width: 100%; height: auto; }
.blog-content figure { margin: 1.6rem 0 !important; }
.blog-content figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
}
.blog-content figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.55;
  text-align: center;
}
.blog-content h2 {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  margin: 1.9rem 0 0.75rem !important;
}
.blog-content h3 {
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  margin: 1.45rem 0 0.55rem !important;
}
.blog-content a { color: var(--accent); text-decoration: underline; }
.blog-content .citation {
  margin-left: 0.08em;
  font-family: var(--sans);
  font-size: 0.72em;
  font-weight: 600;
  line-height: 0;
  vertical-align: super;
}
.blog-content .citation a {
  padding: 0.08em 0.14em;
  border-radius: 3px;
  text-decoration: none;
}
.blog-content .citation a:hover {
  background: var(--accent-soft);
  text-decoration: underline;
}
.reference-divider {
  margin: 3rem 0 2rem;
  border: 0;
  border-top: 2px solid var(--rule);
}
.references-list {
  margin: 0;
  padding-left: 2rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.references-list li {
  margin-bottom: 0.9rem;
  padding-left: 0.25rem;
  scroll-margin-top: 1.5rem;
}
.references-list li:target {
  margin-left: -0.35rem;
  padding: 0.4rem 0.5rem 0.4rem 0.6rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  background: var(--accent-soft);
}
.references-list a { white-space: nowrap; }
.blog-content pre { overflow-x: auto; background: #f6f6f7; padding: 1rem; border-radius: 8px; }
.blog-content table { display: block; overflow-x: auto; max-width: 100%; }

/* ---------- Verification essay ---------- */
.verification-essay {
  font-size: 1rem;
  line-height: 1.72;
}
.verification-essay > p:not([id^="ref"]) {
  margin: 0.72rem 0 !important;
}
.verification-essay .post-dek {
  margin: 0 0 1.35rem !important;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}
.verification-essay .hero-figure {
  max-width: 720px;
  margin: 1.75rem auto 2rem !important;
}
.verification-essay .feedback-loop {
  margin: 1.3rem 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  text-align: center;
}
.verification-essay .feedback-loop p { margin: 0 !important; }
.verification-essay .feedback-loop span {
  padding: 0 0.28rem;
  color: var(--accent);
}
.verification-table-wrap {
  margin: 1.35rem 0 1.6rem;
  overflow-x: auto;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(29, 29, 31, 0.055);
  -webkit-overflow-scrolling: touch;
}
.verification-table-wrap:focus-visible {
  outline: 3px solid rgba(139, 26, 26, 0.2);
  outline-offset: 3px;
}
.blog-content .verification-table {
  display: table;
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.92rem;
  line-height: 1.45;
}
.verification-table th,
.verification-table td {
  padding: 0.82rem 0.95rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}
.verification-table th {
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.verification-table th:nth-child(1),
.verification-table td:nth-child(1) { width: 29%; }
.verification-table th:nth-child(2),
.verification-table td:nth-child(2) { width: 24%; }
.verification-table th:nth-child(3),
.verification-table td:nth-child(3) { width: 47%; }
.verification-table tbody tr:nth-child(even) { background: #fafafa; }
.verification-table tbody tr:last-child td { border-bottom: 0; }
.verification-table td:first-child { font-weight: 600; }
.blog-post-foot { margin-top: 2.5rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.related-reading {
  margin-top: 2.2rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: var(--accent-soft);
}
.related-reading h2 {
  margin: 0 0 0.65rem;
  padding: 0;
  border: 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.related-reading ul { margin: 0; }
.related-reading li { margin-bottom: 0.3rem; }
.related-reading li:last-child { margin-bottom: 0; }

/* ---------- Footer ---------- */
footer.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .page { padding: 1.5rem 1.1rem 2.5rem; }
  .page-title { font-size: 1.6rem; }
  .page h2 { font-size: 1.2rem; }
  nav.topbar .bar-inner { padding: 0.6rem 1.1rem; gap: 0.2rem 1.1rem; }
  nav.topbar .bar-name { font-size: 1.05rem; width: 100%; margin-right: 0; margin-bottom: 0.15rem; }
  nav.topbar a { font-size: 0.95rem; padding: 0.15rem 0; }
  #filter-section .filter-row { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  #filter-section select { margin-left: 0; }
  .pub-item { padding-left: 1rem; overflow-wrap: anywhere; }
  .blog-post-title { font-size: 1.6rem; }
  .blog-card-title { font-size: 1.12rem; }
  .verification-essay .post-dek { font-size: 1rem; }
  .verification-essay .feedback-loop {
    padding: 0.9rem;
    font-size: 0.9rem;
    text-align: left;
  }
  .verification-table-wrap {
    margin-right: -0.15rem;
    border-radius: 8px;
    overflow-x: visible;
  }
  .blog-content .verification-table {
    display: block;
    min-width: 0;
    table-layout: auto;
  }
  .verification-table thead { display: none; }
  .verification-table tbody,
  .verification-table tr,
  .verification-table td {
    display: block;
    width: auto !important;
  }
  .verification-table tr {
    padding: 0.68rem 0.8rem;
    border-bottom: 1px solid var(--rule);
  }
  .verification-table tbody tr:nth-child(even) { background: #fafafa; }
  .verification-table tbody tr:last-child { border-bottom: 0; }
  .verification-table td {
    display: grid;
    grid-template-columns: 6.3rem minmax(0, 1fr);
    gap: 0.55rem;
    padding: 0.2rem 0;
    border: 0;
  }
  .verification-table td::before {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.045em;
    text-transform: uppercase;
  }
  .verification-table td:nth-child(1)::before { content: "Domain"; }
  .verification-table td:nth-child(2)::before { content: "Proposal"; }
  .verification-table td:nth-child(3)::before { content: "Verification"; }
  .verification-table td:first-child { font-weight: 400; }
  footer.site-footer { padding: 1.6rem 1.1rem 2.5rem; }
}
