/* FreeStockHub — style.css */

:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #16181d;
  --muted: #69707e;
  --border: #e5e8ef;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --ok: #0f9d63;
  --ok-bg: #e6f6ef;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
  --info: #2563eb;
  --info-bg: #e8f0fe;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, 0.04), 0 12px 28px -16px rgba(16, 24, 40, 0.18);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f16;
    --surface: #141926;
    --surface-2: #1b2130;
    --text: #e8ebf2;
    --muted: #98a1b3;
    --border: #232b3d;
    --accent: #7c74f5;
    --accent-hover: #8f88f7;
    --accent-soft: rgba(124, 116, 245, 0.12);
    --ok: #43d99a;
    --ok-bg: rgba(67, 217, 154, 0.12);
    --warn: #eab464;
    --warn-bg: rgba(234, 180, 100, 0.12);
    --info: #7fb0ff;
    --info-bg: rgba(127, 176, 255, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 28px -16px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
a:focus-visible, .btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  font-size: 17px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}
.main-nav { display: flex; gap: 4px; overflow-x: auto; }
.main-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14.5px;
  white-space: nowrap;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------- hero ---------- */
.hero {
  border-bottom: 1px solid var(--border);
  background: radial-gradient(900px 320px at 50% -120px, var(--accent-soft), transparent 70%);
}
.hero-inner { padding: 56px 20px 40px; text-align: center; }
.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4.6vw, 42px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.hero .lede {
  max-width: 620px;
  margin: 0 auto 26px;
  color: var(--muted);
  font-size: 16.5px;
}
.hero-search { max-width: 560px; margin: 0 auto; }
.hero-search input {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  outline: none;
}
.hero-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-md);
}
.hero-stats { margin: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.hero-stats strong { color: var(--text); }

/* ---------- sections ---------- */
.section { padding: 36px 0 8px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 21px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip-sm {
  padding: 1px 9px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: default;
}

/* ---------- grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}
.site-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.site-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow-md);
}
.site-card-top { display: flex; gap: 12px; align-items: center; }
.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 18px;
}
.site-card-titles h3 { margin: 0 0 3px; font-size: 16.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.site-card-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13.8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.site-card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

/* ---------- badges ---------- */
.badge {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-muted { color: var(--muted); background: var(--surface-2); font-weight: 500; }

/* ---------- breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  padding-top: 22px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { opacity: 0.5; }

/* ---------- page head ---------- */
.page-head { padding-top: 18px; }
.page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.page-head .lede {
  max-width: 720px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
}
.page-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 600;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- facts ---------- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 20px 0 0;
  padding: 0;
}
.fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.fact dt { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.fact dd { margin: 0; font-size: 14.5px; font-weight: 600; }

/* ---------- article ---------- */
.article { max-width: 820px; margin: 0 auto; }
.article > h1 { font-size: clamp(24px, 3.6vw, 32px); line-height: 1.35; margin: 8px 0 14px; letter-spacing: -0.01em; }
.article h2 { font-size: 23px; margin: 38px 0 12px; line-height: 1.4; }
.article h3 { font-size: 18px; margin: 26px 0 8px; }
.article p { margin: 10px 0; }
.article ul { padding-left: 22px; margin: 10px 0; }
.article li { margin: 4px 0; }
.article hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.article .md-strong { font-weight: 700; margin: 20px 0 6px; }
.article code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.92em;
}
.article .table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.article table { border-collapse: collapse; width: 100%; font-size: 13.8px; }
.article th, .article td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.article thead th { background: var(--surface-2); font-weight: 600; font-size: 13px; }
.article tbody tr:last-child td { border-bottom: none; }

/* ---------- panel (sites without a full article yet) ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 820px;
  margin: 0 auto;
}
.panel h2 { margin: 0 0 14px; font-size: 20px; }
.proscons { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.proscons h3 { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
.proscons ul { margin: 0; padding-left: 20px; }
.proscons li { margin: 6px 0; }

/* ---------- related ---------- */
.related { padding-top: 34px; }
.related h2 { font-size: 18px; margin: 0 0 12px; }
.mini-links { display: flex; flex-wrap: wrap; gap: 10px; }
.mini-link {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
}
.mini-link:hover { border-color: var(--accent); color: var(--accent); }
.mini-link .muted { font-size: 12.5px; }

/* ---------- promo ---------- */
.promo {
  margin: 30px auto 10px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 820px;
}
.promo a { font-weight: 600; }

/* ---------- article cards (home) ---------- */
.article-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.article-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.article-card .tag {
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  align-self: flex-start;
  font-weight: 600;
}
.article-card h3 { margin: 0; font-size: 17px; line-height: 1.5; }
.article-card .arrow { color: var(--accent); font-size: 14px; margin-top: auto; }

/* ---------- empty / footer ---------- */
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }
.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.site-footer .wrap { padding: 26px 20px 34px; }
.footer-note { margin: 0 0 6px; font-size: 13.5px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .header-inner {
    height: auto;
    padding: 10px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .main-nav { width: 100%; }
  .hero-inner { padding: 40px 20px 30px; }
  .proscons { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 26px; }
}

/* ---------- category tiles & inline search ---------- */
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.cat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.cat-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.cat-tile h3 { margin: 0; font-size: 16.5px; }
.cat-tile .count { color: var(--accent); font-weight: 700; font-size: 13px; }
.cat-tile .desc { margin: 0; color: var(--muted); font-size: 13px; }
.page-head .hero-search { margin: 0 0 18px; max-width: 560px; }
