/* resource.css —— 资料库前台 H5 样式（品牌红金深墨 · 移动优先响应式） */
:root {
  --red: #a33c2d;
  --red-d: #812a20;
  --red-l: #b8452f;
  --gold: #d6ad68;
  --gold-d: #b8904a;
  --gold-l: #e4c57e;
  --ink: #1c1714;
  --ink-2: #4a4138;
  --ink-3: #6f6358;
  --paper: #fbf6ee;
  --paper-2: #fffdf9;
  --line: #e7dccd;
  --line-2: #f0e7d8;
  --shadow-sm: 0 2px 8px rgba(120, 70, 30, 0.08);
  --shadow: 0 12px 30px rgba(120, 70, 30, 0.14);
  --radius: 16px;
  --radius-sm: 12px;
  --gap: 14px;
  --maxw: 1080px;
  --tap: 44px;
  /* 类型语义色 */
  --c-tool: #a33c2d;
  --c-h5: #9a6b1e;
  --c-video: #2f6f8f;
  --c-doc: #4f7a35;
  --c-article: #7a4fa0;
  --c-download: #b06a2c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  background-image: radial-gradient(1200px 600px at 80% -10%, rgba(214, 173, 104, 0.14), transparent 60%),
                    radial-gradient(900px 500px at -10% 0%, rgba(163, 60, 45, 0.08), transparent 55%);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

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

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, var(--red-d), var(--red));
  color: var(--gold-l);
  padding: 18px 0 16px;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 11px;
  background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 26px; height: 26px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .b1 { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 1px; }
.brand-text .b2 { font-size: 12px; color: var(--gold-l); opacity: 0.92; }

/* ===== Sticky search ===== */
.search-bar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(251, 246, 238, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.search-bar .wrap { display: flex; }
.search-field {
  position: relative; flex: 1;
}
.search-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search-input {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 42px 10px 42px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 15px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(163, 60, 45, 0.14);
}
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--line-2); color: var(--ink-2);
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.search-clear:hover { background: var(--line); }
.search-clear[hidden] { display: none; }

/* ===== Intro lede ===== */
.lede {
  font-size: 13px; color: var(--ink-2);
  padding: 14px 2px 0;
  line-height: 1.6;
}

/* ===== Category tabs ===== */
.tabs {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 0 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-size: 14px; white-space: nowrap;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab .cnt { font-size: 12px; color: var(--ink-3); }
.tab:hover { border-color: var(--gold-d); }
.tab[aria-selected="true"] {
  background: linear-gradient(135deg, var(--red), var(--red-d));
  border-color: var(--red-d);
  color: #fff;
}
.tab[aria-selected="true"] .cnt { color: var(--gold-l); }
.tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(214, 173, 104, 0.6);
}

.result-count {
  font-size: 13px; color: var(--ink-3);
  padding: 2px 2px 0;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px 0 28px;
}
@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* ===== Card ===== */
.card {
  display: flex; flex-direction: row; align-items: stretch;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--gold-d);
  box-shadow: var(--shadow);
}
.card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(214, 173, 104, 0.7), var(--shadow);
}
.card:active { transform: translateY(-1px); }

.card-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 64px; height: 64px;
  background: var(--paper-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb .thumb-logo {
  width: 38px; height: 38px;
  display: block;
  opacity: 0.95;
}
.type-badge {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
/* 类型语义色：提升可扫视性（当前未使用，保留以兼容未来） */
.type-badge.t-tool { color: var(--c-tool); background: #fbeee9; border-color: #f1d3c9; }
.type-badge.t-h5 { color: var(--c-h5); background: #fbf3e1; border-color: #ecd9b3; }
.type-badge.t-video { color: var(--c-video); background: #e9f1f6; border-color: #cfe2ec; }
.type-badge.t-doc { color: var(--c-doc); background: #eef4e6; border-color: #d6e3c4; }
.type-badge.t-article { color: var(--c-article); background: #f4ecf8; border-color: #e0cdee; }
.type-badge.t-download { color: var(--c-download); background: #fbeede; border-color: #f0d3b0; }

.card-body {
  flex: 1; min-width: 0;
  padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: center;
  gap: 4px;
}
.card-title-row {
  display: flex; align-items: center; gap: 8px;
}
.card-title {
  flex: 1; min-width: 0;
  font-size: 15px; font-weight: 700; color: var(--ink);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-tag {
  flex: 0 0 auto;
  background: transparent;
  color: var(--ink-3);
  border: 1px solid var(--line);
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  white-space: nowrap;
}
.card-summary {
  font-size: 13px; color: var(--ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--ink-3);
}
.card-meta .src { display: inline-flex; align-items: center; gap: 5px; }
.card-meta .date { color: var(--ink-3); white-space: nowrap; }

@media (min-width: 640px) {
  .card-thumb { width: 72px; height: 72px; }
  .type-badge { width: 44px; height: 44px; font-size: 12px; }
  .card-body { padding: 12px 14px; }
  .card-title { font-size: 16px; }
}

/* ===== States ===== */
.state {
  text-align: center; padding: 48px 16px; color: var(--ink-3); font-size: 14px;
}
.skeleton .card-thumb, .skeleton .sk-line {
  background: linear-gradient(90deg, #efe6d6 25%, #f6efe2 37%, #efe6d6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.skeleton .sk-line { height: 10px; border-radius: 5px; margin: 6px 0; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  padding: 22px 0 30px;
  margin-top: 8px;
}
.site-footer .wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.kf-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap);
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), var(--red-d));
  color: var(--gold-l);
  font-size: 15px; font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.kf-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kf-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(214, 173, 104, 0.7), var(--shadow); }
.foot-note { font-size: 12px; color: var(--ink-3); max-width: 480px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
