:root {
  --bg: #f3f1eb;
  --surface: #fffdf7;
  --surface-soft: #e9ece5;
  --surface-strong: #242821;
  --text: #20231f;
  --muted: #646b62;
  --faint: #8a9088;
  --border: rgba(32, 35, 31, 0.13);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
  --shadow: 0 1px 2px rgba(32, 35, 31, 0.04), 0 14px 36px rgba(32, 35, 31, 0.08);
  --shadow-hover: 0 2px 8px rgba(32, 35, 31, 0.08), 0 22px 46px rgba(32, 35, 31, 0.12);
  --cat-llm: #5b4b9f;
  --cat-llm-bg: #ebe8f8;
  --cat-agent: #2f6b53;
  --cat-agent-bg: #dff0e8;
  --cat-infra: #3c5f8a;
  --cat-infra-bg: #dce8f4;
  --cat-vla: #a85c2c;
  --cat-vla-bg: #fae8d4;
  --cat-wam: #8a6b2c;
  --cat-wam-bg: #f5edd8;
  --cat-cv: #9c4a4a;
  --cat-cv-bg: #f8e4e4;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(32, 35, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 35, 31, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 64%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(243, 241, 235, 0.9);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.82rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  color: inherit;
}

.site-brand:hover {
  text-decoration: none;
}

.site-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: #f8f0d0;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.site-logo {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-tagline {
  margin: 0.08rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.home-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 5rem;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 2rem;
  align-items: center;
  padding: 1.9rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #4b5f46;
}

.home-intro h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(3rem, 7.2vw, 5.4rem);
  line-height: 1.02;
  font-weight: 600;
}

.intro-copy {
  max-width: 31rem;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.latest-strip {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.18s, box-shadow 0.18s;
}

.latest-strip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.latest-strip span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--cat-llm);
}

.latest-strip strong {
  font-size: 1.02rem;
  line-height: 1.35;
}

.latest-strip em {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
}

.reading-board {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.8rem;
}

.reading-sidebar {
  position: sticky;
  top: 5.25rem;
  display: grid;
  gap: 1rem;
}

.side-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.72);
  padding: 1rem;
}

.side-block h2 {
  margin: 0 0 0.85rem;
  font-size: 0.92rem;
}

.side-block.muted p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.category-list {
  display: grid;
  gap: 0.45rem;
}

.category-link {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.58rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.category-link.active,
.category-link:hover {
  background: var(--cat-llm-bg);
  color: var(--cat-llm);
}

.category-link:not(a) {
  opacity: 0.66;
}

.category-link strong {
  font-size: 0.78rem;
}

.paper-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.68);
  overflow: hidden;
}

.paper-section[hidden] {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.15rem;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.16rem;
}

.section-heading .eyebrow {
  margin-bottom: 0.2rem;
}

.section-heading > span {
  color: var(--muted);
  font-size: 0.86rem;
}

.paper-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.paper-list li + li {
  border-top: 1px solid var(--border);
}

.paper-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 32px;
  gap: 1rem;
  align-items: start;
  padding: 1.15rem;
  color: inherit;
  background: transparent;
  transition: background 0.16s;
}

.paper-card:hover {
  background: var(--surface);
  text-decoration: none;
}

.paper-card time {
  color: var(--cat-llm);
  font-size: 0.86rem;
  font-weight: 700;
  padding-top: 0.12rem;
}

.paper-main h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
}

.paper-main .meta {
  margin: 0.28rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.paper-main .tldr {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.62;
}

.paper-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--muted);
  transition: transform 0.16s, background 0.16s, color 0.16s;
}

.paper-card:hover .paper-arrow {
  transform: translateX(2px);
  background: var(--cat-llm);
  color: #fff;
}

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* —— Article pages —— */
body > main:not(.home-shell) {
  max-width: 780px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

.readpaper-body {
  font-family: var(--font);
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 3rem;
  line-height: 1.7;
  color: #2a2826;
}

.readpaper-body h1,
.readpaper-body h2,
.readpaper-body h3 {
  font-weight: 600;
}

.readpaper-body h1 {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.readpaper-body > p:first-of-type,
.readpaper-body h1 + p {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 2rem;
}

.readpaper-body h2 {
  font-size: 1.2rem;
  margin-top: 2.5rem;
  padding-top: 0.5rem;
}

.readpaper-body ul {
  padding-left: 1.25rem;
  margin: 0.75rem 0 1.25rem;
}

.readpaper-body li {
  margin-bottom: 0.65rem;
}

.readpaper-body li strong {
  font-weight: 600;
  color: var(--text);
}

.readpaper-body .diagram {
  margin: 2rem 0;
}

.readpaper-body mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.readpaper-body .panel {
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
}

.readpaper-body .panel h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
}

.readpaper-body .panel .sub {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 0.8rem;
}

.readpaper-body .panel .label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.65;
  margin-top: 0.9rem;
}

.readpaper-body .panel .value {
  font-size: 0.95rem;
}

.readpaper-body .flow {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0.6rem;
  align-items: stretch;
}

.readpaper-body .flow .arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  opacity: 0.6;
  padding: 0 0.3rem;
}

.readpaper-body .flow .arrow .glyph {
  font-size: 1.4rem;
  line-height: 1;
}

.readpaper-body .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.readpaper-body .grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.readpaper-body .lavender { background: #e8e4f8; color: #2a1f5c; }
.readpaper-body .mint { background: #d4ebe0; color: #173d2e; }
.readpaper-body .peach { background: #f8e0cc; color: #5c2f12; }
.readpaper-body .cream { background: #f5edd8; color: #4a3a12; }
.readpaper-body .rose { background: #f4d7d7; color: #5c2424; }
.readpaper-body .sky { background: #d8e5f1; color: #1f3a5c; }

.article-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.article-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--cat-llm-bg);
  color: var(--cat-llm);
  border: 1px solid transparent;
  transition: background 0.15s;
}

.article-links a:hover {
  background: #ddd6f5;
  text-decoration: none;
}

@media (max-width: 860px) {
  .home-intro,
  .reading-board {
    grid-template-columns: 1fr;
  }

  .reading-sidebar {
    order: 2;
    position: static;
  }

  .paper-section {
    order: 1;
  }

  .category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .readpaper-body .flow,
  .readpaper-body .grid-3,
  .readpaper-body .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-header-inner {
    padding: 0.72rem 1rem;
  }

  .home-shell {
    padding-top: 1.4rem;
  }

  .home-intro h1 {
    font-size: 2.55rem;
  }

  .latest-strip {
    align-self: stretch;
  }

  .paper-card {
    grid-template-columns: 1fr 28px;
  }

  .paper-card time {
    grid-column: 1 / -1;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  body > main:not(.home-shell) {
    padding: 1.05rem 1rem 3.5rem;
  }

  .article-links {
    gap: 0.45rem;
    margin-bottom: 1.25rem;
  }

  .article-links a {
    flex: 1 1 0;
    justify-content: center;
    min-height: 38px;
    padding: 0.42rem 0.75rem;
  }

  .readpaper-body {
    max-width: none;
    padding-bottom: 2rem;
    font-size: 0.98rem;
    line-height: 1.76;
  }

  .readpaper-body h1 {
    font-size: clamp(1.52rem, 8vw, 1.95rem);
    line-height: 1.28;
    margin-bottom: 0.7rem;
  }

  .readpaper-body > p:first-of-type,
  .readpaper-body h1 + p {
    font-size: 0.98rem;
    line-height: 1.78;
    margin-bottom: 1.55rem;
  }

  .readpaper-body h2 {
    font-size: 1.08rem;
    margin-top: 2rem;
    padding-top: 0.35rem;
  }

  .readpaper-body ul {
    padding-left: 1.05rem;
    margin: 0.65rem 0 1rem;
  }

  .readpaper-body li {
    margin-bottom: 0.82rem;
  }

  .readpaper-body .diagram {
    margin: 1.35rem 0 1.65rem;
  }

  .readpaper-body .panel {
    border-radius: 10px;
    padding: 1rem;
  }

  .readpaper-body .panel h4 {
    font-size: 0.98rem;
  }

  .readpaper-body .panel .value {
    font-size: 0.9rem;
  }

  .readpaper-body .flow {
    gap: 0.55rem;
  }

  .readpaper-body .flow .arrow {
    min-height: 32px;
    flex-direction: row;
    gap: 0.4rem;
    padding: 0;
  }

  .readpaper-body .flow .arrow .glyph {
    transform: rotate(90deg);
  }
}
