:root {
  --bg: #07080d;
  --bg-soft: #0c0e16;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --text-dim: #a2a9bd;
  --text-faint: #6c7488;
  --accent: #7c6cff;
  --accent-2: #3ecfff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: rgba(124, 108, 255, 0.35);
  color: #fff;
}

/* ---------- Ambient background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.aurora__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.5;
  animation: drift 26s var(--ease) infinite alternate;
}

.aurora__blob--1 {
  width: 620px;
  height: 620px;
  top: -260px;
  left: -140px;
  background: radial-gradient(circle, #5b4bff 0%, rgba(91, 75, 255, 0) 70%);
}

.aurora__blob--2 {
  width: 560px;
  height: 560px;
  top: -180px;
  right: -160px;
  background: radial-gradient(circle, #1fb6d8 0%, rgba(31, 182, 216, 0) 70%);
  animation-delay: -8s;
}

.aurora__blob--3 {
  width: 720px;
  height: 720px;
  bottom: -420px;
  left: 40%;
  background: radial-gradient(circle, #b83b8f 0%, rgba(184, 59, 143, 0) 70%);
  opacity: 0.28;
  animation-delay: -16s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(60px, 40px, 0) scale(1.12);
  }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 3px 3px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 20%, transparent 75%);
}

/* ---------- Header ---------- */
.site-header {
  padding: 0 32px;
}

.nav {
  max-width: 1240px;
  margin: 0 auto;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 8px 24px -10px rgba(94, 90, 255, 0.9);
}

.brand__text {
  font-size: 16px;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 30px;
  font-size: 14px;
}

.nav__links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.nav__links a:hover {
  color: var(--text);
}

.nav__github {
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}

.nav__github:hover {
  border-color: rgba(62, 207, 255, 0.6);
  color: var(--text);
}

/* ---------- Hero ---------- */
.hero {
  max-width: 800px;
  margin: 0 auto;
  padding: 84px 0 72px;
  text-align: center;
}

.hero__eyebrow {
  display: inline-block;
  margin-bottom: 22px;
  padding: 6px 16px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px);
}

.hero__title {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  background: linear-gradient(180deg, #ffffff 0%, #b9c0d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__subtitle {
  max-width: 560px;
  margin: 22px auto 0;
  font-size: 16px;
  color: var(--text-dim);
}

/* ---------- Search ---------- */
.search {
  position: relative;
  max-width: 560px;
  margin: 44px auto 0;
}

.search__icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-faint);
  pointer-events: none;
}

.search__input {
  width: 100%;
  height: 60px;
  padding: 0 62px 0 52px;
  font-size: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  outline: none;
  backdrop-filter: blur(18px);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease);
}

.search__input::placeholder {
  color: var(--text-faint);
}

.search__input::-webkit-search-cancel-button {
  appearance: none;
}

.search__input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(124, 108, 255, 0.75);
  box-shadow: 0 0 0 4px rgba(124, 108, 255, 0.16), 0 20px 50px -30px rgba(124, 108, 255, 0.9);
}

.search__kbd {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 26px;
  padding: 3px 7px;
  font-size: 12px;
  text-align: center;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
}

.hero__stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
  font-size: 13.5px;
  color: var(--text-faint);
}

.hero__stats strong {
  color: var(--text);
  font-weight: 600;
}

.dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: 0.6;
}

/* ---------- Category chips ---------- */
.categories {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 14px 32px;
  background: linear-gradient(180deg, rgba(7, 8, 13, 0.92) 30%, rgba(7, 8, 13, 0) 100%);
  backdrop-filter: blur(14px);
}

.chips {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.chip.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, rgba(124, 108, 255, 0.95), rgba(62, 207, 255, 0.85));
  box-shadow: 0 12px 30px -16px rgba(94, 90, 255, 1);
}

.chip__count {
  font-size: 11.5px;
  opacity: 0.7;
}

/* ---------- Directory ---------- */
.directory {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 32px 120px;
}

.section {
  padding-top: 34px;
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.section__bar {
  width: 4px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
  align-self: center;
}

.section__title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section__desc {
  font-size: 13.5px;
  color: var(--text-faint);
}

.section__count {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

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

/* ---------- Card ---------- */
.card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease),
    background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%),
      rgba(255, 255, 255, 0.09), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-5px);
  background: var(--surface-hover);
  border-color: var(--card-accent, var(--border-strong));
  box-shadow: var(--shadow);
}

.card:hover::after {
  opacity: 1;
}

.card__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  color: #fff;
  border: 1px solid var(--border);
}

.card__icon img {
  width: 24px;
  height: 24px;
}

.card__body {
  min-width: 0;
  flex: 1;
}

.card__top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card__arrow {
  width: 14px;
  height: 14px;
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--text-faint);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: all 0.35s var(--ease);
}

.card:hover .card__arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--card-accent, var(--accent-2));
}

.card__desc {
  margin-top: 4px;
  font-size: 12.8px;
  color: var(--text-dim);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__tag {
  display: inline-block;
  margin-top: 11px;
  padding: 2px 9px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- Empty ---------- */
.empty {
  padding: 90px 0;
  text-align: center;
}

.empty p {
  font-size: 15px;
  color: var(--text-dim);
}

.empty__reset {
  margin-top: 18px;
  padding: 9px 22px;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s var(--ease);
}

.empty__reset:hover {
  background: var(--surface-hover);
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 32px 60px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-dim);
}

.site-footer__muted {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- To top ---------- */
.to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--text);
  background: rgba(20, 22, 32, 0.8);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.3s var(--ease);
}

.to-top svg {
  width: 20px;
  height: 20px;
}

.to-top:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 108, 255, 0.7);
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .site-header,
  .categories,
  .directory,
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .nav__links {
    gap: 18px;
    font-size: 13px;
  }

  .hero {
    padding: 56px 0 48px;
  }

  .hero__subtitle {
    font-size: 14.5px;
  }

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

  .section__desc {
    display: none;
  }
}
