/* =========================
   基础变量
========================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --text: #1d2330;
  --muted: #7b8495;
  --border: #e8eaf0;
  --primary: #6366f1;
  --primary-soft: #eef0ff;
  --shadow: 0 10px 30px rgba(31, 38, 55, 0.07);
  --radius: 16px;
  --container: 1180px;
}

/* =========================
   Reset
========================= */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

button,
input {
  font: inherit;
}

.container {
  width: min(calc(100% - 40px), var(--container));
  margin: 0 auto;
}

/* =========================
   顶部导航
========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(232, 234, 240, 0.9);
  backdrop-filter: blur(16px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: white;
  font-weight: 800;
  background: transparent;
  box-shadow: 0 8px 18px rgba(99, 102, 241, 0.24);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: -2px;
  font-size: 11px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  color: #596173;
  font-size: 14px;
}

.nav-links a {
  transition: 0.2s ease;
}

.nav-links a:hover {
  color: var(--primary);
}

/* 右上角访客所在地天气 */
.weather-pill {
  min-width: 142px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 18px rgba(31, 38, 55, 0.05);
  transition: 0.2s ease;
}

.weather-pill.loaded:hover {
  transform: translateY(-1px);
  border-color: #d8daff;
  box-shadow: 0 8px 22px rgba(31, 38, 55, 0.08);
}

.weather-icon {
  flex: 0 0 auto;
  width: 26px;
  text-align: center;
  font-size: 21px;
  line-height: 1;
}

.weather-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.weather-main {
  color: #41485a;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.weather-location {
  max-width: 105px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-error {
  opacity: 0.78;
}

.github-btn {
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  transition: 0.2s ease;
}

.github-btn:hover {
  border-color: #d4d7e0;
  transform: translateY(-1px);
}

/* =========================
   Hero
========================= */
.hero {
  position: relative;
  overflow: hidden;
  padding: 80px 0 74px;
  background:
    radial-gradient(circle at 20% 15%, rgba(99, 102, 241, 0.14), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(139, 92, 246, 0.12), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fc 100%);
  border-bottom: 1px solid var(--border);
}

.hero-content {
  text-align: center;
}

.hero-badge {
  display: inline-block;
  padding: 7px 12px;
  border: 1px solid #dfe1ff;
  border-radius: 999px;
  color: #575bd5;
  background: rgba(238, 240, 255, 0.85);
  font-size: 13px;
  font-weight: 600;
}

.hero h1 {
  margin: 20px 0 12px;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 650px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
}

.search-box {
  max-width: 650px;
  height: 58px;
  margin: 34px auto 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  border: 1px solid #dfe2ea;
  border-radius: 15px;
  background: white;
  box-shadow: var(--shadow);
}

.search-icon {
  font-size: 24px;
  color: #9aa1af;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: #a4aab6;
}

.shortcut {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: #969eac;
  background: #fafbfc;
  font-size: 11px;
}

/* =========================
   主体布局
========================= */
.layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 44px;
  padding-top: 50px;
  padding-bottom: 80px;
}

.sidebar-inner {
  position: sticky;
  top: 100px;
}

.sidebar-title {
  margin: 0 0 12px;
  padding: 0 12px;
  color: #9aa1af;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #697284;
  font-size: 14px;
  transition: 0.2s ease;
}

.category:hover,
.category.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.content {
  min-width: 0;
}

/* =========================
   分类区块
========================= */
.resource-section {
  margin-bottom: 54px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-icon {
  font-size: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.count {
  color: #9da4b2;
  font-size: 12px;
}

/* =========================
   网站卡片
========================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.site-card {
  min-height: 205px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(31, 38, 55, 0.02);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.site-card:hover {
  transform: translateY(-4px);
  border-color: #d8daff;
  box-shadow: var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.site-logo {
  min-width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0 9px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-logo img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.external {
  color: #b3b8c4;
  font-size: 17px;
  transition: 0.2s ease;
}

.site-card:hover .external {
  color: var(--primary);
}

.site-card h3 {
  margin: 16px 0 5px;
  font-size: 16px;
}

.site-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 18px;
}

.tags span {
  padding: 4px 8px;
  border-radius: 7px;
  color: #7d8594;
  background: var(--surface-soft);
  font-size: 11px;
}

/* =========================
   页脚
========================= */
.footer {
  border-top: 1px solid var(--border);
  background: white;
}

.footer-inner {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #959cab;
  font-size: 12px;
}

.footer-inner a:hover {
  color: var(--primary);
}

/* =========================
   响应式
========================= */
@media (max-width: 1000px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 760px) {
  .weather-pill {
    min-width: 122px;
  }

  .weather-location {
    max-width: 82px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 58px 0 54px;
  }

  .layout {
    display: block;
    padding-top: 28px;
  }

  .sidebar {
    margin-bottom: 28px;
    overflow-x: auto;
  }

  .sidebar-inner {
    position: static;
    display: flex;
    gap: 7px;
    min-width: max-content;
  }

  .sidebar-title {
    display: none;
  }

  .category {
    margin: 0;
    border: 1px solid var(--border);
    background: white;
  }

  .category.active {
    border-color: #dfe1ff;
  }
}

@media (max-width: 560px) {
  .weather-pill {
    min-width: 0;
    height: 40px;
    padding: 6px 9px;
  }

  .weather-location {
    display: none;
  }

  .weather-main {
    font-size: 11px;
  }

  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .github-btn {
    display: none;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .hero h1 {
    font-size: 38px;
  }

  .search-box {
    height: 54px;
  }

  .shortcut {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

/* =========================
   Hero 滚动标题
========================= */
.hero-title {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.18em;
}

.rolling-wrap {
  display: inline-block;
  height: 1.15em;
  overflow: hidden;
  color: #6366f1;
  min-width: 4.5em;
  text-align: left;
}

.rolling-words {
  display: flex;
  flex-direction: column;
  animation: rollingWords 12s cubic-bezier(.76, 0, .24, 1) infinite;
}

.rolling-words > span {
  height: 1.15em;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

@keyframes rollingWords {
  0%, 14% {
    transform: translateY(0);
  }

  18%, 32% {
    transform: translateY(-1.15em);
  }

  36%, 50% {
    transform: translateY(-2.3em);
  }

  54%, 68% {
    transform: translateY(-3.45em);
  }

  72%, 86% {
    transform: translateY(-4.6em);
  }

  90%, 100% {
    transform: translateY(-5.75em);
  }
}
