/* =========================================================
   全球电动工具资料聚合站 — 工业编辑风样式
   ========================================================= */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1c1e21;
  --text: #2a2d31;
  --muted: #8a8578;
  --border: #e6e1d6;
  --accent: #d9480f;
  --accent-dark: #a63607;
  --accent-soft: #fbe9dd;
  --shadow: 0 1px 2px rgba(28, 30, 33, 0.04), 0 4px 14px rgba(28, 30, 33, 0.05);
  --serif: Georgia, "Times New Roman", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
    "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

::selection { background: var(--accent-soft); color: var(--accent-dark); }

a { color: inherit; }

h1, h2, h3, h4 { color: var(--ink); line-height: 1.35; }

button { font-family: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===================== Header ===================== */
.site-header {
  background: var(--card);
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 62px;
}

.logo {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
  transition: color 0.15s;
}

.logo:hover .logo-icon { color: var(--accent-dark); }

.main-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar { display: none; }

.main-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.main-nav a:hover {
  color: var(--accent-dark);
  background: var(--accent-soft);
  text-decoration: none;
}

.updated-at {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===================== Home layout ===================== */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 36px;
  align-items: start;
  padding-top: 28px;
}

.main-col { min-width: 0; }

.sidebar {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ===================== Widgets ===================== */
.widget {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.widget h3 {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget h3::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ===================== Calendar ===================== */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cal-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cal-nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.cal-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.cal-dow {
  font-size: 0.7rem;
  color: var(--muted);
  padding: 4px 0;
  letter-spacing: 0.05em;
}

.cal-day {
  padding: 5px 0;
  font-size: 0.8rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cal-day.dim { color: #cfc9bd; }

.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }

.cal-day.has-data {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  cursor: pointer;
}

.cal-day.has-data:hover { background: var(--accent); color: #fff; }

.cal-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 10px 0 0;
}

/* ===================== Hot list & tags ===================== */
.hot-list { display: flex; flex-direction: column; gap: 4px; }

.hot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: background 0.15s;
}

.hot-item:hover { background: var(--accent-soft); }

.hot-rank {
  width: 18px;
  color: var(--muted);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

.rank-1 { color: var(--accent); }
.rank-2 { color: #e0700f; }
.rank-3 { color: #e88f2e; }

.hot-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.hot-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.topic-tag {
  padding: 4px 11px;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.topic-tag:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.topic-tag .count {
  color: var(--muted);
  font-size: 0.72rem;
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}

.active-tag {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

.active-tag .count { color: rgba(255, 255, 255, 0.75) !important; }

/* ===================== Filter bar ===================== */
.filter-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border: 1px solid #f0c5a8;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: var(--accent-dark);
}

.filter-bar.active { display: flex; }

.filter-bar strong { color: var(--ink); }

.btn-clear {
  margin-left: auto;
  padding: 4px 14px;
  border: 1px solid var(--accent);
  background: var(--card);
  color: var(--accent-dark);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}

.btn-clear:hover { background: var(--accent); color: #fff; }

/* ===================== Timeline ===================== */
.timeline { padding-bottom: 60px; }

.date-section { margin-bottom: 44px; }

.date-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.date-header h2 {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.date-badge {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  padding-left: 14px;
  position: relative;
}

.date-badge::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  bottom: 0.22em;
  width: 5px;
  background: var(--accent);
}

.date-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

.date-count {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===================== Article list ===================== */
.article-list {
  display: grid;
  gap: 14px;
}

.article-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.article-card:hover {
  border-color: #d4cec2;
  box-shadow: var(--shadow);
}

.article-card h3 {
  margin: 6px 0 6px;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card h3 a {
  text-decoration: none;
  color: var(--ink);
  transition: color 0.15s;
}

.article-card h3 a:hover { color: var(--accent-dark); }

.article-card p {
  margin: 0;
  font-size: 0.87rem;
  color: #6b6659;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.76rem;
  color: var(--muted);
}

.category-tag {
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.cat-news      { background: #e9eff9; color: #2b5aa6; }
.cat-brand     { background: #fbf0da; color: #9a5c0a; }
.cat-standard  { background: #e7f3e9; color: #2e7d43; }
.cat-patent    { background: #f4ecfa; color: #7b3fa0; }
.cat-technology{ background: #e2f2f4; color: #0f7a86; }
.cat-testing   { background: #fdeae6; color: #bc3e2c; }
.cat-wikipedia { background: #eeede9; color: #5f6b5f; }

.source { font-weight: 500; }

.country { opacity: 0.75; }

.date { opacity: 0.7; font-variant-numeric: tabular-nums; }

.tags {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  background: #f0ede6;
  color: var(--muted);
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 0.73rem;
}

/* ===================== Compact grid (encyclopedia) ===================== */
.compact-grid {
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 10px;
}

.compact-grid .article-card { padding: 10px 13px; }

.compact-grid .article-card h3 {
  font-size: 0.9rem;
  margin: 4px 0 0;
}

.compact-grid .article-card .article-meta { gap: 8px; font-size: 0.7rem; }

.compact-grid .article-card p { display: none; }

.compact-grid .article-card .date { display: none; }

/* ===================== Category page ===================== */
.category-header { padding: 32px 0 18px; }

.category-header h1 {
  font-family: var(--serif);
  font-size: 1.7rem;
  margin: 0 0 6px;
  padding-left: 16px;
  position: relative;
}

.category-header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22em;
  bottom: 0.18em;
  width: 6px;
  background: var(--accent);
}

.category-header p { color: var(--muted); margin: 0; }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}

.filters input,
.filters select {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  font-size: 0.9rem;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s;
}

.filters input { flex: 1; min-width: 0; }

.filters input:focus,
.filters select:focus {
  border-color: var(--accent);
  outline: none;
}

.filters input::placeholder { color: #b3ada0; }

/* ===================== Sources page ===================== */
.sources-page { padding: 32px 0 60px; }

.sources-header { margin-bottom: 30px; }

.sources-header h1 {
  font-family: var(--serif);
  font-size: 1.7rem;
  margin: 0 0 6px;
  padding-left: 16px;
  position: relative;
}

.sources-header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22em;
  bottom: 0.18em;
  width: 6px;
  background: var(--accent);
}

.sources-header p { color: var(--muted); margin: 0; }

.sources-header strong { color: var(--accent-dark); }

.source-group { margin-bottom: 36px; }

.source-group h2 {
  font-size: 1.12rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 16px;
  padding-left: 14px;
  position: relative;
}

.source-group h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.24em;
  bottom: 0.32em;
  width: 5px;
  background: var(--accent);
}

.group-count {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 12px;
}

.source-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 13px 15px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.source-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.source-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.source-card-name {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--ink);
}

.country-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  letter-spacing: 0.06em;
}

.c-cn { background: #fdeae6; color: #bc3e2c; }
.c-us { background: #e9eff9; color: #2b5aa6; }
.c-de { background: #fbf0da; color: #9a5c0a; }
.c-jp { background: #e7f3e9; color: #2e7d43; }
.c-gb { background: #f4ecfa; color: #7b3fa0; }
.c-eu { background: #e2f2f4; color: #0f7a86; }
.c-kr { background: #fff3e2; color: #b05e0c; }
.c-it { background: #e9ebf7; color: #3a4494; }
.c-ch { background: #eef4e7; color: #4d7c2a; }

.source-card-url {
  font-size: 0.73rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 8px;
}

.source-card-meta {
  display: flex;
  gap: 10px;
  font-size: 0.73rem;
  color: var(--muted);
}

.parser-tag {
  background: #f0ede6;
  color: #6b6659;
  padding: 0 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}

/* ===================== Footer ===================== */
.site-footer {
  background: var(--ink);
  color: #b9b4a9;
  margin-top: 40px;
}

.site-footer .container {
  padding-top: 26px;
  padding-bottom: 26px;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ===================== Responsive ===================== */
@media (max-width: 1100px) {
  .home-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
  }
  .widget { margin-bottom: 0; }
}

@media (max-width: 860px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 0;
    gap: 12px;
  }
  .main-nav { order: 3; width: 100%; margin-left: 0; }
  .updated-at { display: none; }
  .site-header { position: static; }
  .filters { flex-direction: column; }
  .date-badge { font-size: 1.2rem; }
}
