:root {
  --paper: #f4f0e6;
  --paper-deep: #e9e2d2;
  --ink: #18251f;
  --muted: #667067;
  --forest: #164f3b;
  --moss: #7c9577;
  --line: rgba(24, 37, 31, 0.14);
  --white: rgba(255, 255, 255, 0.68);
  --shadow: 0 20px 70px rgba(24, 37, 31, 0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 5%, rgba(124, 149, 119, .22), transparent 28rem),
    linear-gradient(180deg, #f8f5ed 0, var(--paper) 38rem);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.masthead {
  width: min(1180px, calc(100% - 40px));
  height: 88px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; background: var(--forest); color: #fff;
  font: 700 22px/1 Georgia, serif;
}
.brand strong, .brand small { display: block; }
.brand strong { font: 600 17px/1.1 Georgia, serif; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.snapshot-time { color: var(--muted); font-size: 12px; }

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.hero {
  min-height: 440px;
  padding: 82px 0 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 70px;
  align-items: end;
}
.eyebrow { color: var(--forest); font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
h1 { margin: 16px 0 24px; font: 500 clamp(46px, 6.4vw, 82px)/.98 Georgia, "Songti SC", serif; letter-spacing: -.045em; }
.hero-copy { max-width: 630px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.9; }
.stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.stat { padding: 22px 8px 22px 0; border-bottom: 1px solid var(--line); }
.stat:nth-child(even) { padding-left: 26px; border-left: 1px solid var(--line); }
.stat strong { display: block; font: 500 36px/1 Georgia, serif; }
.stat span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }

.workspace { padding: 0 0 64px; }
.toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(16px);
}
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tab, .filter {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  border-radius: 999px; padding: 9px 14px; color: var(--muted); font-size: 13px;
}
.tab:hover, .filter:hover { color: var(--ink); background: rgba(255,255,255,.55); }
.tab.active { color: #fff; background: var(--forest); }
.search {
  min-width: 330px; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white);
}
.search span { color: var(--muted); font-size: 12px; }
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.search kbd { padding: 2px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 10px; }
.filter-row { min-height: 56px; display: flex; align-items: center; gap: 6px; overflow-x: auto; }
.filter { padding: 6px 10px; font-size: 11px; text-transform: capitalize; }
.filter.active { color: var(--forest); background: rgba(22,79,59,.10); font-weight: 700; }
.result-count { margin: 8px 0 20px; color: var(--muted); font-size: 12px; }

.content-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  min-height: 240px; padding: 24px; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 18px; background: var(--white);
  box-shadow: 0 1px 0 rgba(255,255,255,.7) inset; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(22,79,59,.34); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.source-name { min-width: 0; overflow-wrap: anywhere; color: var(--forest); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status { padding: 4px 8px; border-radius: 999px; background: var(--paper-deep); color: var(--muted); font-size: 10px; }
.status.ready { background: rgba(22,79,59,.12); color: var(--forest); }
.status.review { background: #efe2bd; color: #765c14; }
.card h2 { margin: 22px 0 10px; overflow-wrap: anywhere; font: 600 21px/1.35 Georgia, "Songti SC", serif; }
.card p { margin: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { margin-top: auto; padding-top: 24px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.topic-card strong { font: 500 44px/1 Georgia, serif; color: var(--forest); }
.empty { grid-column: 1/-1; padding: 80px 20px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 18px; }

dialog {
  width: min(780px, calc(100% - 32px)); max-height: min(820px, calc(100vh - 32px));
  padding: 0; border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: #fbf9f3;
  box-shadow: 0 40px 120px rgba(12, 30, 22, .32);
}
dialog::backdrop { background: rgba(15, 27, 21, .60); backdrop-filter: blur(5px); }
.dialog-close { position: sticky; z-index: 2; top: 16px; float: right; margin: 16px 16px 0 0; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: #fff; cursor: pointer; font-size: 22px; }
.detail { padding: 52px clamp(24px, 7vw, 64px) 64px; }
.detail h2 { max-width: 620px; margin: 14px 0 20px; font: 500 clamp(30px, 5vw, 48px)/1.12 Georgia, "Songti SC", serif; }
.detail-summary { color: var(--muted); font-size: 16px; line-height: 1.8; }
.detail-section { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 14px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.detail-section p, .detail-section li { color: #39443d; font-size: 14px; line-height: 1.85; }
.detail-section pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: #39443d; line-height: 1.85; }
.source-link { display: inline-flex; margin-top: 24px; color: var(--forest); font-size: 13px; font-weight: 700; }

footer { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 42px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 48px; }
  .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { min-width: 0; }
}
@media (max-width: 620px) {
  .masthead, main, footer { width: min(100% - 24px, 1180px); }
  .snapshot-time { display: none; }
  .hero { min-height: auto; padding: 64px 0 52px; }
  h1 { font-size: 47px; }
  .content-grid { grid-template-columns: 1fr; }
  .card { min-height: 210px; }
  footer { gap: 12px; flex-direction: column; }
}
