:root {
  --bg: #f6f6f9;
  --surface: #ffffff;
  --text: #14131f;
  --text-muted: #635f75;
  --border: #e8e7f0;
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --primary-tint: #f2edfc;
  --shadow: 0 1px 2px rgba(20, 16, 43, 0.04), 0 6px 20px rgba(20, 16, 43, 0.06);
  --shadow-hover: 0 4px 8px rgba(20, 16, 43, 0.06), 0 16px 32px rgba(20, 16, 43, 0.12);
  --radius: 16px;
  --max-width: 1220px;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0d18;
    --surface: #17162456;
    --surface: #18172a;
    --text: #f2f1f8;
    --text-muted: #9793ab;
    --border: #2b2942;
    --primary: #a78bfa;
    --primary-dark: #c4b5fd;
    --primary-tint: #241f3d;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 6px 20px rgba(0,0,0,0.35);
    --shadow-hover: 0 4px 8px rgba(0,0,0,0.35), 0 16px 32px rgba(0,0,0,0.45);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo { font-family: var(--font-display); }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #7c3aed, #4c1d95);
  color: #fff;
  flex-shrink: 0;
}

.logo-accent { color: var(--primary); }

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.15s;
}

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

@media (max-width: 720px) {
  .header-nav { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 120% 100% at 50% -10%, #2a1968 0%, #0e0a24 55%, #0a0818 100%);
  padding: 84px 0 40px;
  text-align: center;
  isolation: isolate;
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 20%, transparent 80%);
  z-index: 0;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  opacity: 0.55;
}

.hero-glow-1 {
  width: 480px; height: 480px;
  background: #7c3aed;
  top: -220px; left: 8%;
}

.hero-glow-2 {
  width: 420px; height: 420px;
  background: #2563eb;
  top: -180px; right: 6%;
  opacity: 0.35;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  color: #d8d3f5;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 26px;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 18px;
  color: #ffffff;
}

.grad-text {
  background: linear-gradient(100deg, #c4b5fd 10%, #93c5fd 50%, #f0abfc 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  color: #b8b3d1;
  font-size: 17px;
  max-width: 600px;
  margin: 0 auto 36px;
}

.search-box {
  max-width: 560px;
  margin: 0 auto 36px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #a49cc9;
  pointer-events: none;
}

#calcSearch {
  width: 100%;
  padding: 17px 20px 17px 52px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  color: #fff;
  outline: none;
  transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
}

#calcSearch::placeholder { color: #a49cc9; }

#calcSearch:focus {
  border-color: #a78bfa;
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.22);
}

.search-count {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: #b8b3d1;
  min-height: 18px;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.stat span {
  font-size: 12.5px;
  color: #a49cc9;
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.15);
}

@media (max-width: 560px) {
  .stats-row { gap: 18px; }
  .stat-divider { display: none; }
}

/* ---------- Category pill nav ---------- */
.cat-pills-wrap {
  position: sticky;
  top: 68px;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.cat-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cat-pills::-webkit-scrollbar { display: none; }

.cat-pills a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.cat-pills a svg { flex-shrink: 0; opacity: 0.8; }

.cat-pills a:hover {
  color: var(--text);
  border-color: var(--primary);
}

.cat-pills a.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cat-pills a.is-active svg { opacity: 1; }

/* ---------- Category sections ---------- */
.cat-section {
  padding: 52px 0 8px;
  scroll-margin-top: 130px;
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--accent-soft, var(--primary-tint));
  color: var(--accent, var(--primary));
  flex-shrink: 0;
}

.cat-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Category accent colors */
.cat-section[data-color="violet"] { --accent: #7c3aed; --accent-soft: #f0e9fd; }
.cat-section[data-color="emerald"] { --accent: #059669; --accent-soft: #e3f7ee; }
.cat-section[data-color="amber"] { --accent: #b45309; --accent-soft: #fbedd5; }
.cat-section[data-color="blue"] { --accent: #2563eb; --accent-soft: #e5eefd; }
.cat-section[data-color="teal"] { --accent: #0d9488; --accent-soft: #dff5f2; }
.cat-section[data-color="orange"] { --accent: #ea580c; --accent-soft: #fde9dc; }
.cat-section[data-color="sky"] { --accent: #0284c7; --accent-soft: #e2f2fb; }
.cat-section[data-color="slate"] { --accent: #475569; --accent-soft: #e9edf2; }
.cat-section[data-color="rose"] { --accent: #e11d48; --accent-soft: #fde5eb; }
.cat-section[data-color="purple"] { --accent: #9333ea; --accent-soft: #f3e6fd; }

@media (prefers-color-scheme: dark) {
  .cat-section[data-color="violet"] { --accent-soft: #2c2150; }
  .cat-section[data-color="emerald"] { --accent-soft: #113228; }
  .cat-section[data-color="amber"] { --accent-soft: #3a2712; }
  .cat-section[data-color="blue"] { --accent-soft: #16233f; }
  .cat-section[data-color="teal"] { --accent-soft: #0f322e; }
  .cat-section[data-color="orange"] { --accent-soft: #3a2313; }
  .cat-section[data-color="sky"] { --accent-soft: #10293a; }
  .cat-section[data-color="slate"] { --accent-soft: #262c36; }
  .cat-section[data-color="rose"] { --accent-soft: #3a1620; }
  .cat-section[data-color="purple"] { --accent-soft: #2c1c40; }
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  position: relative;
}

a.card { display: block; text-decoration: none; color: inherit; }

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--accent, var(--primary));
}

.card-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, var(--primary));
  margin-bottom: 12px;
}

.card h3 {
  margin: 0 0 7px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-right: 78px;
}

.card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.badge {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.card.is-hidden { display: none; }

.no-results {
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
  padding: 60px 0;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  overflow: hidden;
  margin-top: 64px;
  background: #0e0a24;
  padding: 44px 0 32px;
}

.footer-grid {
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 70% 100% at 50% 0%, black 0%, transparent 75%);
}

.footer-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-logo { color: #fff; }
.footer-logo .logo-accent { color: #c4b5fd; }

.footer-inner p {
  margin: 0;
  color: #9791b8;
  font-size: 13px;
  max-width: 560px;
  line-height: 1.6;
}

.copyright { color: #6f6a8c !important; font-size: 12px !important; }

.footer-links { font-size: 13px !important; }
.footer-links a { color: #b3aed1; text-decoration: none; }
.footer-links a:hover { color: #fff; }

@media (max-width: 640px) {
  .hero { padding: 64px 0 32px; }
  .cat-section { padding: 40px 0 4px; }
  .grid { grid-template-columns: 1fr; }
  .card h3 { padding-right: 0; }
  .badge { position: static; display: inline-block; margin-top: 12px; }
}
