/* ---- Variables ---- */
:root {
  --bg: #ffffff;
  --surface: #f9fafb;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text-1: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --accent-border: #c7d2fe;
  --header-h: 52px;
  --page-max: 960px;
  --radius: 6px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }
svg { display: block; flex-shrink: 0; }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}
.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-logo {
  width: 22px;
  height: 17px;
  color: var(--text-1);
  flex-shrink: 0;
}
.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-1);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-link {
  font-size: 13px;
  color: var(--text-3);
  padding: 5px 10px;
  border-radius: var(--radius);
  transition: color 0.1s, background 0.1s;
}
.nav-link:hover {
  color: var(--text-1);
  background: var(--surface);
}
.nav-cta {
  color: var(--text-2);
  font-weight: 500;
}

/* ---- Layout ---- */
main {
  min-height: calc(100vh - var(--header-h) - 52px);
}
.page-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px 24px 56px;
}

/* ---- Start Here Banner ---- */
.start-here {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.start-here strong {
  color: var(--text-1);
  font-weight: 600;
}
.start-here a {
  color: var(--accent);
  font-weight: 500;
  margin-left: auto;
  white-space: nowrap;
  transition: color 0.1s;
}
.start-here a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---- Directory Header ---- */
.directory-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.directory-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-1);
  line-height: 1.2;
}
.directory-subtitle {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}
.update-meta {
  font-size: 12px;
  color: var(--text-4);
  white-space: nowrap;
  padding-bottom: 2px;
}

/* ---- Controls ---- */
.controls {
  margin-bottom: 10px;
}
.search-wrap {
  position: relative;
  margin-bottom: 10px;
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}
#search {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-1);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}
#search::placeholder { color: var(--text-4); }
.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.category-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
.cat-pill {
  height: 26px;
  padding: 0 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  white-space: nowrap;
}
.cat-pill:hover {
  background: var(--border-light);
  color: var(--text-2);
}
.cat-pill.active {
  background: var(--text-1);
  color: #fff;
  border-color: var(--text-1);
}
.toggle-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  user-select: none;
  transition: color 0.1s;
}
.toggle-label:hover { color: var(--text-2); }
.toggle-input {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

/* ---- List Meta ---- */
.list-meta {
  font-size: 12px;
  color: var(--text-4);
  margin-bottom: 8px;
  height: 20px;
  display: flex;
  align-items: center;
}

/* ---- Tool List ---- */
.tool-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.loading, .empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-4);
  font-size: 13px;
}

/* ---- Tool Row ---- */
.tool-row {
  border-bottom: 1px solid var(--border);
}
.tool-row:last-child { border-bottom: none; }

.tool-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 46px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.tool-row-header:hover { background: var(--surface); }
.tool-row.expanded > .tool-row-header { background: var(--surface); }

.tool-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  width: 160px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--border-light);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tool-desc-short {
  font-size: 13px;
  color: var(--text-3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.6;
}
.badge-mcp { background: var(--accent-light); color: var(--accent); }
.badge-official { background: #f0fdf4; color: #16a34a; }
.badge-free { background: var(--border-light); color: var(--text-3); }
.badge-freemium { background: #fefce8; color: #a16207; }
.badge-paid { background: #fff7ed; color: #c2410c; }

.row-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  color: var(--text-4);
  transition: color 0.1s, background 0.1s;
}
.icon-link:hover {
  color: var(--text-2);
  background: var(--border-light);
}
.expand-chevron {
  color: var(--text-4);
  flex-shrink: 0;
  transition: transform 0.2s ease;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tool-row.expanded .expand-chevron { transform: rotate(90deg); }

/* ---- Detail Panel (expand/collapse) ---- */
.tool-detail-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s ease;
}
.tool-detail-wrap.open { grid-template-rows: 1fr; }
.tool-detail-inner { overflow: hidden; }

.tool-detail {
  display: grid;
  grid-template-columns: 3fr 2fr;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.detail-left {
  padding: 20px 24px 20px 16px;
  border-right: 1px solid var(--border);
}
.detail-right { padding: 20px 16px; }

.detail-section { margin-bottom: 18px; }
.detail-section:last-child { margin-bottom: 0; }

.detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-4);
  margin-bottom: 6px;
}
.detail-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
}

/* Key-value rows */
.kv-table { width: 100%; border-collapse: collapse; }
.kv-row { border-bottom: 1px solid var(--border-light); }
.kv-row:last-child { border-bottom: none; }
.kv-key, .kv-val {
  font-size: 12px;
  padding: 5px 0;
  vertical-align: middle;
}
.kv-key { color: var(--text-4); width: 55%; }
.kv-val { color: var(--text-2); font-weight: 500; text-align: right; }
.kv-val.yes { color: #16a34a; }
.kv-val.no { color: var(--text-4); font-weight: 400; }

/* ---- Install Code Block ---- */
.install-block {
  position: relative;
  margin-top: 6px;
  margin-bottom: 6px;
}
.install-code {
  background: #1a1b26;
  color: #a9b1d6;
  border-radius: var(--radius);
  padding: 11px 36px 11px 12px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  font-size: 11.5px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.copy-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #6b7280;
  cursor: pointer;
  border: none;
  transition: background 0.1s, color 0.1s;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #c0c0c0;
}
.copy-btn.copied {
  background: rgba(22, 163, 74, 0.25);
  color: #4ade80;
}

/* ---- Detail Links ---- */
.detail-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  padding: 4px 9px;
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  background: var(--accent-light);
  transition: background 0.1s, border-color 0.1s;
  line-height: 1;
}
.detail-link:hover {
  background: #e0e7ff;
  border-color: #a5b4fc;
}

/* ---- Ask Claude Button ---- */
.ask-claude-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  margin-top: 14px;
  text-decoration: none;
}
.ask-claude-btn:hover {
  background: var(--surface);
  border-color: var(--text-4);
  color: var(--text-2);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  height: 52px;
}
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-copy {
  font-size: 13px;
  color: var(--text-4);
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-logo {
  width: 14px;
  height: 11px;
  color: var(--text-4);
}
.footer-links {
  display: flex;
  gap: 20px;
}
.footer-link {
  font-size: 13px;
  color: var(--text-4);
  transition: color 0.1s;
}
.footer-link:hover { color: var(--text-2); }

/* ---- Hero ---- */
.hero {
  border-bottom: 1px solid var(--border);
  padding: 52px 0 44px;
}
.hero-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}
.hero-headline {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: -0.7px;
  color: var(--text-1);
  line-height: 1.2;
  margin-bottom: 12px;
  max-width: 560px;
}
.hero-subline {
  font-size: 16px;
  color: var(--text-3);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 520px;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  background: var(--text-1);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  transition: background 0.15s;
  text-decoration: none;
}
.hero-cta:hover { background: #374151; }
.hero-ctas {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-cta-outline {
  display: inline-flex;
  align-items: center;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
}
.hero-cta-outline:hover {
  border-color: var(--text-4);
  background: var(--surface);
}

/* ---- Page header (start.html and subpages) ---- */
.page-header {
  border-bottom: 1px solid var(--border);
  padding: 40px 0 32px;
}
.page-header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.4px;
  color: var(--text-1);
  margin-bottom: 6px;
}
.page-desc {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.6;
  max-width: 520px;
}

/* ---- Glossary ---- */
.glossary-section {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.section-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-4);
  margin-bottom: 16px;
}
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.glossary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.glossary-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 1. Colored monospace label — the term/acronym */
.card-label {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px;
  font-weight: 500;
  color: #818cf8;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}

/* 2. Full name heading */
.card-term {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-1);
  margin-bottom: 8px;
  line-height: 1.3;
}

/* 3. Plain-English explanation */
.card-def {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 10px;
}

/* 4. Code/syntax example */
.card-code {
  background: #1a1b26;
  color: #a9b1d6;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.65;
  padding: 10px 12px;
  border-radius: 5px;
  overflow-x: auto;
  white-space: pre;
  margin-bottom: 14px;
  flex-shrink: 0;
}

/* 5. Buttons row */
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}
.card-read-more {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.1s;
}
.card-read-more:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.card-ask-claude {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-4);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
  line-height: 1.6;
  white-space: nowrap;
}
.card-ask-claude:hover {
  color: var(--text-2);
  border-color: var(--text-4);
}

/* Inline code in card text */
.card-def code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px;
  background: var(--border-light);
  padding: 1px 4px;
  border-radius: 3px;
  color: #818cf8;
}

/* ---- Homepage teaser (2-card strip) ---- */
.glossary-teaser {
  padding-bottom: 32px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}
.glossary-teaser-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.glossary-teaser-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-4);
}
.glossary-teaser-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.1s;
}
.glossary-teaser-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.glossary-teaser-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ---- Active nav link ---- */
.nav-link.active {
  color: var(--text-1);
  background: var(--surface);
}

/* ---- Responsive ---- */
@media (max-width: 680px) {
  .page-inner { padding: 16px 16px 40px; }
  .tool-desc-short { display: none; }
  .tool-name { width: auto; flex: 1; }
  .tool-detail { grid-template-columns: 1fr; }
  .detail-left { border-right: none; border-bottom: 1px solid var(--border); }
  .directory-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .filter-row { gap: 8px; }
  .hero { padding: 36px 0 28px; }
  .hero-subline { font-size: 14px; margin-bottom: 20px; }
  .site-nav .nav-link:not(.nav-cta):not([href="start.html"]) { display: none; }
}
@media (max-width: 768px) {
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
  .glossary-teaser-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .glossary-grid { grid-template-columns: 1fr; }
}
