@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #161616;
  --bg4: #1c1c1c;
  --border: #222222;
  --border-soft: #1a1a1a;
  --green: #00ff88;
  --green-dim: #00cc6a;
  --green-glow: rgba(0, 255, 136, .16);
  --green-subtle: rgba(0, 255, 136, .07);
  --text: #e8e8e8;
  --text-dim: #8a8a8a;
  --text-faint: #4a4a4a;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* faint grid backdrop, like a terminal canvas */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 10%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: .5;
}

::selection { background: var(--green); color: #0a0a0a; }

a { color: inherit; }

/* ─────────────────────── topbar ─────────────────────── */
#topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.8);
  backdrop-filter: blur(6px);
}
.logo {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--green);
  display: flex; align-items: center; gap: 8px;
}
.logo::before { content: '>'; animation: blink 1.1s step-end infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.topbar-stats {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  display: flex; gap: 18px;
}
.topbar-stats b { color: var(--text); font-weight: 600; }
@media (max-width: 620px) { .topbar-stats { display: none; } }

/* ─────────────────────── hero / search ─────────────────────── */
main { position: relative; z-index: 2; }
.hero {
  max-width: 780px; margin: 0 auto; padding: 72px 24px 28px;
  text-align: center;
}
.hero-eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--green-dim);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border: 1px solid rgba(0,255,136,.25);
  border-radius: 20px; background: var(--green-subtle); margin-bottom: 22px;
}
.hero h1 {
  font-family: var(--sans); font-weight: 800; font-size: clamp(30px, 5vw, 46px);
  line-height: 1.15; letter-spacing: -.02em; color: #fff;
  margin-bottom: 14px;
}
.hero h1 span { color: var(--green); }
.hero p.sub {
  color: var(--text-dim); font-size: 16px; max-width: 520px; margin: 0 auto;
}

/* command-palette search */
.search-wrap { max-width: 680px; margin: 34px auto 0; position: relative; }
.search-box {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
  font-family: var(--mono);
  transition: border-color .15s, box-shadow .15s;
}
.search-box.focused {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 4px var(--green-subtle), 0 8px 30px rgba(0,255,136,.08);
}
.search-box .prompt { color: var(--green); font-weight: 700; flex-shrink: 0; }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--mono); font-size: 15px;
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box .kbd-hint {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px;
  flex-shrink: 0;
}
@media (max-width: 560px) { .search-box .kbd-hint { display: none; } }

.results-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 10px);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  max-height: 420px; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  display: none; z-index: 20; text-align: left;
}
.results-panel.open { display: block; }
.results-group-label {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); padding: 12px 16px 6px;
}
.result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  border-left: 2px solid transparent;
}
.result-item .r-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.result-item .r-title { color: var(--text); font-size: 14px; font-weight: 500; }
.result-item .r-meta {
  margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  white-space: nowrap; flex-shrink: 0;
}
.result-item.active, .result-item:hover {
  background: var(--green-subtle); border-left-color: var(--green);
}
.result-item.active .r-title, .result-item:hover .r-title { color: var(--green); }
.results-empty { padding: 24px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }
.results-footer {
  padding: 8px 16px; border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
  display: flex; gap: 14px;
}
.results-footer kbd {
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; margin-right: 4px;
}

.continue-chip {
  margin-top: 18px; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-dim);
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 20px;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.continue-chip:hover { border-color: var(--green-dim); color: var(--green); }

/* ─────────────────────── modules grid ─────────────────────── */
.modules-section { max-width: 1160px; margin: 0 auto; padding: 56px 24px 90px; }
.modules-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.modules-header h2 {
  font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
}
.modules-header h2 b { color: var(--text); }
.modules-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 14px; padding: 5px 11px;
  cursor: pointer; background: var(--bg2); transition: all .15s;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active { color: var(--green); border-color: rgba(0,255,136,.4); background: var(--green-subtle); }

.modules-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px;
}
.module-card {
  position: relative; display: block; text-decoration: none;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px; overflow: hidden; cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.module-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent, var(--green)); opacity: .85;
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent, var(--green));
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
}
.module-card .m-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.module-card .m-icon {
  font-size: 24px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
}
.module-card .m-count {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 12px; padding: 3px 9px;
}
.module-card h3 {
  font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 6px; letter-spacing: -.01em;
}
.module-card p {
  font-size: 13px; color: var(--text-dim); line-height: 1.55; margin-bottom: 16px; min-height: 40px;
}
.module-card .m-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.module-card .m-tag {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  background: var(--bg3); border: 1px solid var(--border-soft); border-radius: 4px; padding: 2px 6px;
}
.module-card .m-arrow {
  position: absolute; bottom: 20px; right: 20px; color: var(--text-faint);
  font-size: 15px; transition: transform .18s, color .18s;
}
.module-card:hover .m-arrow { color: var(--accent, var(--green)); transform: translateX(3px); }

.module-card.placeholder {
  border-style: dashed; cursor: default; display: flex; align-items: center; justify-content: center;
  min-height: 168px; text-align: center;
}
.module-card.placeholder:hover { transform: none; box-shadow: none; border-color: var(--border); }
.placeholder-inner { color: var(--text-faint); font-family: var(--mono); font-size: 12.5px; }
.placeholder-inner .p-plus { font-size: 22px; color: var(--text-faint); display: block; margin-bottom: 8px; }

/* ─────────────────────── footer ─────────────────────── */
footer {
  position: relative; z-index: 2;
  border-top: 1px solid var(--border);
  padding: 22px 32px; text-align: center;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-faint);
}
footer b { color: var(--text-dim); }

/* focus visibility */
a:focus-visible, .result-item:focus-visible, .filter-chip:focus-visible, input:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .logo::before { animation: none; }
  * { transition: none !important; animation: none !important; }
}
