:root {
  --content-max: 1500px;
  --ink: #172b29;
  --muted: #64716e;
  --paper: #f4f7f4;
  --surface: #ffffff;
  --line: #d5ddd8;
  --green: #143d37;
  --jade: #287366;
  --rust: #a14f34;
  --soft-green: #e7f1ed;
  --soft-rust: #f5e9e4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - var(--content-max)) / 2));
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 700;
}
.brand strong { font-size: 17px; }
.home-link { color: var(--muted); font-size: 14px; }
.home-link:hover { color: var(--jade); }

.masthead {
  position: relative;
  min-height: 292px;
  display: flex;
  align-items: end;
  overflow: hidden;
  background: url("../philosophy/assets/library-dawn.png") center 47% / cover;
}
.masthead-shade { position: absolute; inset: 0; background: rgba(9, 34, 31, 0.67); }
.masthead-inner {
  position: relative;
  width: min(var(--content-max), calc(100% - 48px));
  margin: 0 auto;
  padding: 66px 0 48px;
  color: #fff;
}
.eyebrow {
  margin: 0 0 8px;
  color: #c7e0d8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.4px;
}
.masthead h1 { margin: 0; font-size: 42px; line-height: 1.2; letter-spacing: 0; }
.masthead p:last-child { max-width: 620px; margin: 14px 0 0; color: #e2ebe7; }

.workspace { width: min(var(--content-max), calc(100% - 48px)); margin: 0 auto; padding: 38px 0 72px; }
.summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.summary-bar div { min-height: 82px; padding: 16px 20px; border-right: 1px solid var(--line); }
.summary-bar div:last-child { border-right: 0; }
.summary-bar strong { display: block; font-size: 26px; line-height: 1.1; }
.summary-bar span { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; gap: 14px; margin: 26px 0 14px; }
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 15px 0 43px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.search-field input:focus { border-color: var(--jade); box-shadow: 0 0 0 3px rgba(40, 115, 102, 0.12); }
.search-icon {
  position: absolute;
  left: 16px;
  top: 13px;
  width: 15px;
  height: 15px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: var(--muted);
  transform: rotate(45deg);
}
.segments { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segments button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.segments button:last-child { border-right: 0; }
.segments button.active { background: var(--green); color: #fff; }

.browser-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 24px;
}
.source-panel {
  position: sticky;
  top: 88px;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}
.source-panel h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.source-nav { display: grid; gap: 4px; }
.source-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}
.source-nav button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-nav button strong {
  min-width: 28px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e7ece9;
  color: #51615d;
  font-size: 11px;
  text-align: center;
}
.source-nav button:hover { background: #eaf0ed; color: var(--ink); }
.source-nav button.active { background: var(--green); color: #fff; }
.source-nav button.active strong { background: rgba(255, 255, 255, 0.17); color: #fff; }
.results-panel { min-width: 0; }
.result-note { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

.article-list { display: grid; gap: 12px; }
.article-list.grouped { gap: 34px; }
.source-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--green);
}
.source-group-header h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.source-group-header span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.source-group-list { display: grid; gap: 12px; }
.load-more {
  display: block;
  min-width: 220px;
  min-height: 44px;
  margin: 24px auto 0;
  padding: 8px 18px;
  border: 1px solid var(--green);
  border-radius: 5px;
  background: var(--surface);
  color: var(--green);
  font-weight: 700;
}
.load-more:hover { background: var(--green); color: #fff; }
.load-more[hidden] { display: none; }
.article-card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.article-card:hover { border-color: #9db7ae; box-shadow: 0 8px 20px rgba(20, 61, 55, 0.07); }
.article-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.meta time::before { content: "·"; margin-right: 9px; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--soft-green);
  color: var(--jade);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.article-card.wechat-only .status { background: var(--soft-rust); color: var(--rust); }
.article-card h2 { margin: 10px 0 7px; font-size: 22px; line-height: 1.35; letter-spacing: 0; }
.summary { max-width: 1100px; margin: 0; color: #53635f; font-size: 15px; line-height: 1.75; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 17px; }
.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}
.source-action { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.read-action { border: 1px solid var(--green); background: var(--green); color: #fff; }
.note-action { border: 1px solid var(--line); background: #fff; color: var(--muted); }
.actions a:hover { border-color: var(--jade); }
.note-unavailable { color: var(--rust); font-size: 13px; }
.empty-state { padding: 50px 20px; text-align: center; border-top: 1px solid var(--line); }
.empty-state p { margin: 5px 0 0; color: var(--muted); }

footer {
  padding: 30px max(24px, calc((100vw - var(--content-max)) / 2));
  background: #102e2a;
  color: #cbd9d4;
  font-size: 12px;
}
footer p { margin: 4px 0; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
footer nav a { color: #fff; font-weight: 700; }
footer nav a:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .browser-layout { grid-template-columns: 174px minmax(0, 1fr); gap: 22px; }
  .source-panel { padding-right: 16px; }
}

@media (max-width: 1024px) {
  .workspace { width: calc(100% - 32px); }
  .browser-layout { display: block; margin-top: 20px; }
  .source-panel {
    position: static;
    margin: 0 0 20px;
    padding: 0 0 13px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .source-panel h2 { margin-left: 2px; }
  .source-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
  }
  .source-nav::-webkit-scrollbar { display: none; }
  .source-nav button { flex: 0 0 auto; width: auto; min-height: 44px; padding: 8px 11px; }
}

@media (max-width: 720px) {
  .site-header {
    height: 58px;
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }
  .brand-mark { width: 32px; height: 32px; }
  .masthead { min-height: 242px; background-position: 57% center; }
  .masthead-inner { width: calc(100% - 32px); padding: 56px 0 35px; }
  .masthead h1 { font-size: 34px; }
  .masthead p:last-child { font-size: 14px; }
  .workspace { width: calc(100% - 28px); padding: 24px 0 52px; }
  .summary-bar div { min-height: 72px; padding: 13px 11px; }
  .summary-bar strong { font-size: 22px; }
  .summary-bar span { font-size: 12px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 9px; margin-top: 18px; }
  .search-field input { font-size: 16px; }
  .segments { display: grid; grid-template-columns: repeat(3, 1fr); }
  .segments button { padding: 0 7px; font-size: 13px; }
  .browser-layout { display: block; margin-top: 18px; }
  .source-panel {
    position: static;
    margin: 0 -14px 18px;
    padding: 0 14px 12px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .source-panel h2 { margin-left: 2px; }
  .source-nav { gap: 7px; }
  .article-list.grouped { gap: 30px; }
  .source-group-header h2 { font-size: 18px; }
  .article-card { padding: 18px 16px; }
  .article-head { align-items: flex-start; }
  .article-card h2 { font-size: 19px; }
  .summary { font-size: 14px; }
  .actions { flex-wrap: wrap; }
  .load-more { width: 100%; min-width: 0; }
  footer {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }
}

@media (max-width: 480px) {
  .brand { gap: 8px; }
  .brand strong { font-size: 15px; }
  .home-link { font-size: 13px; }
  .masthead { min-height: 222px; }
  .masthead-inner { width: calc(100% - 28px); padding: 46px 0 31px; }
  .masthead h1 { font-size: 30px; }
  .workspace { width: calc(100% - 24px); }
  .summary-bar div { padding: 12px 8px; }
  .summary-bar strong { font-size: 21px; }
  .source-panel { margin-right: -12px; margin-left: -12px; padding-right: 12px; padding-left: 12px; }
  .article-head { flex-wrap: wrap; gap: 8px; }
  .meta { flex-wrap: wrap; row-gap: 2px; }
  .article-card h2 { margin-top: 9px; }
  .actions a { min-height: 40px; }
}

@media (max-width: 350px) {
  .site-header {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }
  .brand-mark { width: 30px; height: 30px; }
  .workspace { width: calc(100% - 18px); }
  .summary-bar div { padding: 11px 6px; }
  .summary-bar span { font-size: 11px; }
  .article-card { padding: 16px 13px; }
  .source-panel { margin-right: -9px; margin-left: -9px; padding-right: 9px; padding-left: 9px; }
  .segments button { padding: 0 4px; font-size: 12px; }
}
