/* themes.css — Editorial theme（杂志编辑风）. Light + dark via data-mode. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-fg); }

/* ───────── Editorial tokens ───────── */
/* 纸墨系统：米白纸底 + 墨黑 + 单一朱红强调色（印刷感的克制用色） */
:root, html[data-mode="light"] {
  --bg: #f6f3ec;
  --bg-elev: #fcfaf5;
  --bg-sunk: #ede8dc;
  --fg: #1c1917;
  --fg-mute: #6e665b;
  --fg-soft: #a39a8a;
  --rule: #d9d1c1;
  --rule-soft: #e7e1d3;
  --accent: #c13c1f;
  --accent-soft: #f2dcd2;
  --accent-fg: #ffffff;
  --warn: #96630c;
  --warn-bg: #f4e8cd;
  --fail: #a0341f;
  --fail-bg: #f2ddd6;
  --ok: #3a7150;
  --ok-bg: #dfeadd;
  --font-display: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
  --font-body: 'Noto Serif SC', 'Songti SC', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-ui: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  --radius: 4px;
  --radius-sm: 3px;
  --shadow-card: none;
  --shadow-elev: 0 2px 4px rgba(28,25,23,.05), 0 20px 40px -20px rgba(28,25,23,.18);
  --nav-h: 62px;
  --tabbar-h: 58px;
  --page-pad: 32px;
  --gap: 20px;
  --thumb-filter: saturate(.18) contrast(1.03);
}
html[data-mode="dark"] {
  --bg: #16130e;
  --bg-elev: #1e1a14;
  --bg-sunk: #100d09;
  --fg: #ece4d4;
  --fg-mute: #97897a;
  --fg-soft: #5f5647;
  --rule: #35301f;
  --rule-soft: #272219;
  --accent: #e05c3a;
  --accent-soft: #40200f;
  --accent-fg: #ffffff;
  --warn: #e0a63f;
  --warn-bg: #3a2a08;
  --fail: #e0684e;
  --fail-bg: #3c1a10;
  --ok: #63b183;
  --ok-bg: #122b1c;
  --shadow-card: none;
  --shadow-elev: 0 2px 4px rgba(0,0,0,.4), 0 24px 48px -24px rgba(0,0,0,.6);
  --thumb-filter: saturate(.25) brightness(.92) contrast(1.02);
}

/* Density */
html[data-density="compact"] { --gap: 14px; --page-pad: 24px; }
html[data-density="comfy"]   { --gap: 28px; --page-pad: 44px; }

/* ───────── Layout ───────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

/* Masthead nav（报头：顶部细线 + 底部双线） */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--nav-h);
  padding: 0 var(--page-pad);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-top: 3px solid var(--fg);
  border-bottom: 1px solid var(--fg);
  box-shadow: 0 3px 0 -1px var(--bg), 0 4px 0 -1px var(--fg);
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-brand .dot {
  width: 10px; height: 10px;
  border-radius: 1px;
  background: var(--accent);
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  position: relative;
  padding: 7px 12px;
  color: var(--fg-mute);
  font-size: 13px;
  font-family: var(--font-ui);
  font-weight: 500;
  letter-spacing: .18em;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .15s;
}
.nav-link:hover { color: var(--fg); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: 1px;
  border-bottom: 1.5px solid var(--accent);
}
.nav-link .badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fail);
}
.nav-spacer { flex: 1; }
.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--rule);
  width: 250px;
  font-family: var(--font-ui);
  transition: border-color .15s;
}
.nav-search:focus-within { border-bottom-color: var(--accent); }
.nav-search input {
  flex: 1; border: 0; outline: 0; background: transparent; color: inherit;
  font: inherit; min-width: 0;
  font-size: 13.5px;
}
.nav-search input::placeholder { color: var(--fg-soft); }
.nav-search svg { color: var(--fg-soft); flex-shrink: 0; }
.nav-icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--fg-mute);
  flex-shrink: 0;
  transition: color .15s, background .15s;
}
.nav-icon-btn:hover { background: var(--bg-sunk); color: var(--fg); }

/* Mobile bottom tab bar */
.tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  height: var(--tabbar-h);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-top: 1px solid var(--fg);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-row { display: flex; height: var(--tabbar-h); }
.tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--fg-soft);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  position: relative;
  transition: color .15s;
}
.tab .badge-dot {
  position: absolute;
  top: 9px;
  right: 50%;
  margin-right: -16px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fail);
}
.tab.active { color: var(--accent); }
.tab.active::before {
  content: '';
  position: absolute;
  top: -1px; left: 28%; right: 28%;
  border-top: 2px solid var(--accent);
}

/* Page container */
.page {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px var(--page-pad) 110px;
}

/* Kicker（页眉小标签：横线 + 拉开字距的小字） */
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .32em;
  color: var(--fg-soft);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.kicker::before {
  content: '';
  width: 22px;
  border-top: 1.5px solid var(--accent);
}

/* Type tags（文字 + 细边框，不再用彩色底块） */
.type-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  padding: 2px 8px 2px 9px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--fg-mute);
  background: transparent;
  white-space: nowrap;
}
.type-tag::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--fg-soft);
}
.type-tag.t-answer::before  { background: var(--fg); }
.type-tag.t-article::before { background: var(--accent); }
.type-tag.t-zvideo::before  { border-radius: 1px; background: var(--fg-mute); }
.type-tag.t-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.type-tag.t-warn::before { background: var(--warn); }

/* ───────── Mobile breakpoints ───────── */
@media (max-width: 880px) {
  :root { --page-pad: 20px; }
  .nav-search { width: 200px; }
}
@media (max-width: 720px) {
  :root { --page-pad: 16px; --nav-h: 54px; --gap: 14px; }
  .app { padding-bottom: var(--tabbar-h); }
  .nav { gap: 10px; box-shadow: 0 3px 0 -1px var(--bg), 0 4px 0 -1px var(--fg); }
  .nav-brand { font-size: 16px; }
  .nav-links { display: none; }
  .nav-search { width: 100%; flex: 1; min-width: 0; padding: 6px 2px; }
  .nav-search input { font-size: 14px; }
  .tabbar { display: block; }
  .page { padding: 22px var(--page-pad) 32px; }
  .kicker { letter-spacing: .24em; }
}
