/* ==========================================================================
   KNOWS.PW 个人服务门户
   轻量原生样式 · 浅色/深色主题 · 响应式
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f4f8ff;
  --bg-2: #ffffff;
  --ink: #102f68;
  --ink-strong: #0d2a5c;
  --muted: #647da6;
  --line: #e2ebf8;
  --line-strong: #cbdff8;
  --surface: rgba(255, 255, 255, .92);
  --surface-2: #f7fbff;
  --accent: #1677ff;
  --accent-2: #0d5fd6;
  --shadow: 0 12px 28px rgba(36, 100, 185, .09);
  --shadow-hover: 0 18px 35px rgba(36, 100, 185, .16);
  --chip: #eef5ff;
  --hero-1: #f2f7ff;
  --hero-2: #ffffff;
  --hero-3: #f5f9ff;
  --focus: #ffbf47;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070d18;
  --bg-2: #0b1220;
  --ink: #dbe7ff;
  --ink-strong: #f2f7ff;
  --muted: #8ba3c9;
  --line: #1c2b45;
  --line-strong: #2c4166;
  --surface: rgba(17, 26, 44, .86);
  --surface-2: #101a2c;
  --accent: #4da3ff;
  --accent-2: #77bbff;
  --shadow: 0 12px 28px rgba(0, 0, 0, .38);
  --shadow-hover: 0 18px 38px rgba(0, 0, 0, .5);
  --chip: #142037;
  --hero-1: #0a1220;
  --hero-2: #070d18;
  --hero-3: #0a1220;
  --focus: #fbbf24;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei",
               "PingFang SC", "Noto Sans CJK SC", sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; }

/* ------------------------------ 顶栏 ------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 72px;
  padding: 0 clamp(18px, 4.3vw, 72px);
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink-strong);
  text-decoration: none;
  font-size: 23px;
  font-weight: 850;
  letter-spacing: -.6px;
  white-space: nowrap;
}
.brand-mark { width: 32px; height: 32px; display: block; }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.6vw, 34px);
  margin-left: 18px;
  margin-right: auto;
}
.nav a {
  text-decoration: none;
  font-size: 14.5px;
  color: var(--muted);
  padding: 8px 0;
  transition: color .15s ease;
}
.nav a:hover, .nav a:focus-visible, .nav a.is-active { color: var(--accent); }

.theme-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all .18s ease;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(-12deg); }
.theme-btn svg { width: 19px; height: 19px; }
.theme-btn .icon-moon { display: none; }
[data-theme="dark"] .theme-btn .icon-sun { display: none; }
[data-theme="dark"] .theme-btn .icon-moon { display: block; }

/* ------------------------------ 首屏 ------------------------------ */

.hero {
  position: relative;
  isolation: isolate;
  text-align: center;
  padding: clamp(38px, 6vw, 66px) 20px clamp(30px, 4vw, 46px);
  background: linear-gradient(180deg, var(--hero-1), var(--hero-2) 62%, var(--hero-3));
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: -220px;
  width: 760px;
  height: 760px;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%);
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 3.5px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.12;
  letter-spacing: -1.6px;
  font-weight: 850;
  color: var(--ink-strong);
}
.hero h2 {
  margin: 12px 0 10px;
  font-size: clamp(19px, 2.6vw, 28px);
  font-weight: 750;
  color: var(--ink);
}
.hero p {
  margin: 0 auto;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(14px, 1.5vw, 16.5px);
  line-height: 1.85;
}

/* ------------------------------ 主体 ------------------------------ */

.wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4.3vw, 72px) 56px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: -6px 0 18px;
}

.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 190px;
}
.search input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
  max-width: 100%;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .16s ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* 分页导航 */
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 2px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.pager::-webkit-scrollbar { display: none; }
.pager button {
  position: relative;
  flex: 0 0 auto;
  padding: 11px 16px 13px;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s ease, background .16s ease;
}
.pager button:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.pager button.is-active {
  color: var(--accent);
  font-weight: 800;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.pager button.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}
.pager .pager-num { min-width: 42px; text-align: center; }

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}
.page-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.3px;
  color: var(--ink-strong);
}
.page-head span { font-size: 12.5px; color: var(--muted); }

/* 卡片 */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.card {
  --accent-card: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent-card);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}
.card-top { display: flex; align-items: flex-start; gap: 16px; min-height: 62px; }
.icon-wrap {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent-card) 13%, transparent);
  color: var(--accent-card);
}
.icon-wrap svg { width: 28px; height: 28px; }
.card h3 {
  margin: 2px 0 6px;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink-strong);
  font-weight: 750;
  overflow-wrap: anywhere;
}
.card .tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .4px;
}
.card p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
}
.host {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--accent);
  font-size: 12.5px;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.host svg { flex: 0 0 15px; width: 15px; height: 15px; }
.host:hover { text-decoration: underline; }
.visit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--accent) 24%, transparent);
  transition: filter .18s ease, transform .18s ease;
}
.visit:hover { filter: brightness(1.07); transform: translateY(-1px); }
.card-link { position: absolute; inset: 0; border-radius: 15px; }
.card-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}
.lock svg { width: 12px; height: 12px; }

/* 底部分页 */
.foot-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
  flex-wrap: wrap;
}
.foot-pager button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .16s ease;
}
.foot-pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.foot-pager button:disabled { opacity: .38; cursor: not-allowed; }
.foot-pager .foot-info { font-size: 12.5px; color: var(--muted); padding: 0 6px; }

.empty {
  grid-column: 1 / -1;
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
  background: var(--surface);
}

/* ------------------------------ 页脚 ------------------------------ */

footer {
  padding: 30px 20px 26px;
  text-align: center;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}
.footer-brand { margin: 0 0 6px; color: var(--ink-strong); font-size: 16px; font-weight: 850; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-links { display: flex; justify-content: center; gap: 20px; margin: 10px 0 12px; flex-wrap: wrap; }
.copyright { margin: 0; }

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.to-top:hover { transform: translateY(-2px); border-color: var(--accent); }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 1020px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

@media (max-width: 720px) {
  .site-header { height: 62px; gap: 10px; padding: 0 16px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 28px; height: 28px; }
  .nav { gap: 16px; margin-left: 4px; }
  .nav a { font-size: 13px; }
  .nav a:first-child { display: none; }
  .hero { padding: 30px 18px 24px; }
  .hero h1 { letter-spacing: -1px; }
  .wrap { padding: 0 16px 40px; }
  .toolbar { margin-bottom: 14px; }
  .search input { height: 42px; font-size: 13.5px; }
  .pager button { padding: 10px 12px 12px; font-size: 13px; }
  .cards { grid-template-columns: 1fr; gap: 13px; }
  .card { padding: 18px 17px 15px; }
  .icon-wrap { flex-basis: 50px; width: 50px; height: 50px; border-radius: 13px; }
  .icon-wrap svg { width: 25px; height: 25px; }
  .card h3 { font-size: 16px; }
  .card p { font-size: 13px; margin-top: 10px; }
  .foot-pager { gap: 8px; }
  .foot-pager button { height: 40px; padding: 0 14px; font-size: 12.5px; }
  .to-top { right: 14px; bottom: 14px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
