/* ============================================================
   IntelStream · 情报流 — Anthropic / Claude 设计语言
   温暖米白 · 陶土强调 · 衬线字体 · 克制冷静
   ============================================================ */

:root {
  --bg: #f0eee8;
  --bg-elev: #fcfbf7;
  --bg-elev2: #f4f2ec;
  --text: #2b2a27;
  --text-2: #6c685f;
  --text-3: #9b958a;
  --border: #e1ddd2;
  --border-strong: #cfc9bb;
  --accent: #c15f3c;
  --accent-strong: #a8502f;
  --accent-soft: #f4e5dc;
  --ink: #2b2a27;
  --shadow-sm: 0 1px 2px rgba(43, 42, 39, .04);
  --shadow-md: 0 2px 10px -3px rgba(43, 42, 39, .07), 0 14px 30px -18px rgba(43, 42, 39, .12);
  --shadow-lg: 0 6px 22px -8px rgba(43, 42, 39, .12), 0 26px 44px -26px rgba(43, 42, 39, .18);
  --topbar-bg: rgba(240, 238, 232, .86);
  --mark-bg: #f7e2bf;
  --mark-text: #8a4a24;

  --radius: 14px;
  --radius-sm: 10px;
  --topbar-h: 66px;
  --toolbar-h: 60px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --serif: "Tiempos Headline", "Tiempos", "Source Serif Pro", "Noto Serif SC",
           "Source Han Serif SC", Georgia, "Songti SC", SimSun, serif;
  --mono: "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #1f1e1c;
  --bg-elev: #2a2926;
  --bg-elev2: #33322e;
  --text: #eceae5;
  --text-2: #b1ada4;
  --text-3: #837f76;
  --border: #3a3833;
  --border-strong: #4b4942;
  --accent: #e0835e;
  --accent-strong: #ec9574;
  --accent-soft: #3d2e27;
  --ink: #eceae5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 2px 10px -3px rgba(0, 0, 0, .4), 0 16px 32px -18px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 24px -8px rgba(0, 0, 0, .5), 0 28px 46px -26px rgba(0, 0, 0, .6);
  --topbar-bg: rgba(31, 30, 28, .84);
  --mark-bg: #6b4423;
  --mark-text: #f6d6b2;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + var(--toolbar-h) + 14px); }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.68;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1380px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }

.brand-mark {
  width: 35px; height: 35px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-text {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .3px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand-text em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 1.4px;
  color: var(--text-3);
}

.stats { display: flex; gap: 8px; }
.stat-pill {
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.stat-pill b { color: var(--text); font-variant-numeric: tabular-nums; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search-box { position: relative; display: flex; align-items: center; width: 290px; max-width: 42vw; }
.search-box svg {
  position: absolute; left: 12px; width: 16px; height: 16px;
  color: var(--text-3); pointer-events: none;
}
.search-box input {
  width: 100%; height: 39px;
  padding: 0 34px 0 37px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input::-webkit-search-cancel-button { display: none; }
#search-clear {
  position: absolute; right: 9px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--border-strong);
  color: var(--text-2);
  font-size: 15px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}

.icon-btn {
  width: 39px; height: 39px;
  flex-shrink: 0;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text-2);
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------------- 工具栏 ---------------- */
.toolbar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 90;
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.toolbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 11px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .chip-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.chip.active {
  color: #fbfaf6;
  background: var(--ink);
  border-color: var(--ink);
}
.chip.active .chip-count { color: rgba(251, 250, 246, .72); }

.date-select {
  appearance: none;
  -webkit-appearance: none;
  height: 38px;
  padding: 0 36px 0 13px;
  font-size: 13.5px;
  color: var(--text-2);
  background-color: var(--bg-elev);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239b958a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  outline: none;
  max-width: 185px;
  transition: border-color .2s;
}
.date-select:hover { border-color: var(--border-strong); }
.date-select:focus { border-color: var(--accent); }

/* ---------------- 主体 ---------------- */
.container { max-width: 1380px; margin: 0 auto; padding: 30px 28px 64px; }

.status-line {
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 20px;
  padding: 10px 15px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.status-line b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------------- 日期区块 ---------------- */
.day-section { margin-bottom: 48px; animation: fadeUp .55s ease both; }

.day-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.day-date-block {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 7px;
  flex-shrink: 0; min-width: 120px;
}
.day-date {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.day-meta { display: flex; gap: 8px; align-items: center; }
.weekday-chip {
  font-size: 12px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
}
.day-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.day-head-info { flex: 1; min-width: 0; padding-top: 2px; }
.day-intro { font-size: 13.5px; color: var(--text-3); margin: 0 0 11px; }

.highlights { display: grid; gap: 9px; }
.highlight-item {
  display: flex; gap: 11px;
  align-items: flex-start;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}
.highlight-num {
  flex-shrink: 0;
  width: 21px; height: 21px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
  font-family: var(--mono);
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 1px;
}

/* ---------------- 瀑布流 ---------------- */
.masonry { display: flex; gap: 18px; align-items: flex-start; }
.masonry-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* ---------------- 卡片 ---------------- */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  break-inside: avoid;
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s, border-color .25s;
  animation: cardIn .5s ease both;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-hot { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.card-body { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 11px; flex: 1; }

.card-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cat-tag {
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .4px;
  color: var(--text-2);
  background: var(--bg-elev2);
  padding: 3px 10px;
  border-radius: 7px;
}
.hot-flag {
  font-size: 11.5px; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 7px;
}

.card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
  margin: 0;
  color: var(--text);
}
.card-title a { transition: color .2s; }
.card-title a:hover { color: var(--accent); }

.card-summary {
  font-size: 13.5px;
  line-height: 1.72;
  color: var(--text-2);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-source {
  font-size: 12px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
}
.card-source svg { width: 13px; height: 13px; flex-shrink: 0; }

.card-angle {
  font-size: 12.5px;
  color: var(--text-2);
  padding: 9px 12px;
  background: var(--bg-elev2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.card-angle b { color: var(--text); font-weight: 600; }

.card-footer { margin-top: auto; padding-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  color: var(--accent);
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 8px;
  background: var(--accent-soft);
  transition: all .2s;
}
.link-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.link-btn svg { width: 13px; height: 13px; }

.link-more {
  font-size: 12px;
  color: var(--text-3);
  background: none; border: none;
  cursor: pointer; padding: 6px 4px;
}
.link-more:hover { color: var(--text); }

.extra-links { display: none; flex-direction: column; gap: 7px; margin-top: 1px; }
.extra-links.open { display: flex; }
.extra-link {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg-elev2);
  border: 1px solid var(--border);
  transition: all .18s;
}
.extra-link:hover { color: var(--accent); border-color: var(--accent); }
.extra-link svg { width: 12px; height: 12px; flex-shrink: 0; }
.extra-link .link-domain {
  margin-left: auto;
  font-size: 10.5px;
  font-family: var(--mono);
  color: var(--text-3);
}

mark { background: var(--mark-bg); color: var(--mark-text); border-radius: 3px; padding: 0 2px; }

/* ---------------- 状态页 ---------------- */
.loading-state, .empty-state, .error-state {
  text-align: center;
  padding: 84px 20px;
  color: var(--text-3);
}
.empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  display: grid; place-items: center;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elev);
}
.empty-icon svg { width: 26px; height: 26px; }
.loading-state h3, .empty-state h3, .error-state h3 {
  font-family: var(--serif);
  color: var(--text);
  margin: 8px 0 6px;
  font-weight: 600;
}
.loading-state p, .empty-state p, .error-state p { font-size: 14px; margin: 0 0 18px; }

.spinner {
  width: 34px; height: 34px;
  display: inline-block;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.btn-primary {
  font-size: 14px; font-weight: 600;
  color: #fbfaf6;
  background: var(--ink);
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .18s, box-shadow .2s;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:active { transform: scale(.97); }

.sentinel { height: 10px; }

/* ---------------- 回到顶部 ---------------- */
.back-to-top {
  position: fixed; right: 28px; bottom: 28px;
  z-index: 80;
  box-shadow: var(--shadow-md);
  animation: fadeUp .3s ease both;
}

/* ---------------- 页脚 ---------------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 28px 36px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}
.footer p { margin: 3px 0; }
.footer-meta { font-family: var(--mono); font-size: 11px; }

/* ---------------- 动画 ---------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .topbar-inner, .toolbar-inner, .container { padding-left: 18px; padding-right: 18px; }
  .stats { display: none; }
  .day-head { flex-direction: column; gap: 12px; }
  .day-date-block { min-width: 0; flex-direction: row; align-items: center; gap: 12px; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 106px; }
  .topbar { height: auto; }
  .topbar-inner { flex-wrap: wrap; row-gap: 10px; padding-top: 10px; padding-bottom: 10px; }
  .brand { order: 1; }
  #theme-toggle { order: 2; margin-left: auto; }
  .top-actions { order: 3; flex-basis: 100%; width: 100%; }
  .brand-text em { display: none; }
  .search-box { width: 100%; max-width: none; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-mark svg { width: 18px; height: 18px; }
  .toolbar-inner { flex-direction: column; align-items: stretch; gap: 10px; }
  .date-select { max-width: none; width: 100%; }
  .day-date { font-size: 25px; }
  .masonry { gap: 14px; }
  .masonry-col { gap: 14px; }
  .back-to-top { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto; }
}
