/* ============================================
   matter.darklang.com — Design System
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Backgrounds */
  --bg-primary: #1a1a1a;
  --bg-card: #242628;
  --bg-elevated: #2d2d2d;
  --bg-input: #1e1e1e;
  --bg-border: #383737;
  --bg-border-hover: #4a4a4a;

  /* Brand */
  --purple: #8f5ea1;
  --purple-light: #95589f;
  --purple-secondary: #a76bba;
  --purple-fn: #B18AFA;
  --blue: #6d74c5;
  --blue-light: #747ab9;
  --blue-type: #6174D0;
  --gold: #9D7840;
  --sand: #e6bd81;
  --taupe: #BF9F85;
  --mint: #86c1b9;
  --rose: #d5839d;
  --green: #86EFAC;
  --olive: #a1b56c;

  /* Text */
  --text-primary: #f8f8f8;
  --text-secondary: #a8a8a8;
  --text-muted: #8b8888;
  --text-dim: #676767;

  /* Glow */
  --glow-purple: rgba(143, 94, 161, 0.3);
  --glow-blue: rgba(109, 116, 197, 0.3);

  /* Typography */
  --font-sans: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Fira Code', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  /* Spacing */
  --max-width: 1280px;
  --max-width-xl: 100rem;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--purple-secondary); }

img { max-width: 100%; }

/* --- Scanline Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.02) 2px,
    rgba(0, 0, 0, 0.02) 4px
  );
}

/* --- Canvas Background --- */
#circuit-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* --- Layout --- */
.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-wide {
  max-width: var(--max-width-xl);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Top Nav --- */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 26, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
}

.top-nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, var(--purple) 30%, var(--blue) 70%, transparent 95%);
  opacity: 0.4;
}

.top-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-logo svg { width: 32px; height: 32px; }

.nav-logo .logo-matter {
  font-weight: 300;
  opacity: 0.7;
  margin-left: -0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s;
}

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

.nav-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.nav-search input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.nav-search input::placeholder { color: var(--text-muted); }

.nav-search input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px var(--glow-purple);
}

.nav-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.btn-publish {
  padding: 0.5rem 1.25rem;
  background: var(--purple);
  border: 1px solid var(--purple);
  border-radius: 8px;
  color: white;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.btn-publish:hover {
  background: var(--purple-light);
  box-shadow: 0 0 20px var(--glow-purple);
}

/* --- Glass Card --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 16px;
  padding: 1.5rem;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.glass-card:hover {
  border-color: var(--bg-border-hover);
  box-shadow: 0 0 24px rgba(143, 94, 161, 0.1), 0 8px 32px rgba(0,0,0,0.2);
  transform: translateY(-2px);
}

.glass-card.clickable { cursor: pointer; }

.glass-card.clickable:hover {
  border-color: var(--purple);
  background: #2a2c2e;
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-fn { background: rgba(177, 138, 250, 0.15); color: var(--purple-fn); }
.badge-type { background: rgba(97, 116, 208, 0.15); color: var(--blue-type); }
.badge-value { background: rgba(157, 120, 64, 0.15); color: var(--gold); }
.badge-module { background: rgba(191, 159, 133, 0.15); color: var(--taupe); }
.badge-version { background: rgba(134, 193, 185, 0.15); color: var(--mint); }
.badge-license { background: rgba(168, 168, 168, 0.1); color: var(--text-secondary); }
.badge-tag { background: #484848; color: var(--text-primary); padding: 0.25rem 0.75rem; }

/* --- Entity Icons (inline SVG wrappers) --- */
.icon-fn, .icon-type, .icon-value, .icon-module {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* --- Code Blocks --- */
.code-block {
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}

.code-block .code-lang {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Syntax highlighting */
.syn-kw { color: #C084FC; }
.syn-fn { color: var(--purple-fn); }
.syn-type { color: var(--blue-type); }
.syn-str { color: var(--green); }
.syn-num { color: #FCD34D; }
.syn-comment { color: var(--text-dim); font-style: italic; }
.syn-op { color: var(--text-secondary); }
.syn-param { color: var(--text-primary); }
.syn-tvar { color: #FCA5A5; }
.syn-pipe { color: var(--purple-secondary); }

/* --- Install Command --- */
.install-cmd {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.install-cmd code { flex: 1; color: var(--text-secondary); }
.install-cmd .cmd-text { color: var(--mint); }

.btn-copy {
  background: none;
  border: 1px solid var(--bg-border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.btn-copy:hover {
  border-color: var(--purple);
  color: var(--purple-secondary);
}

.btn-copy.copied {
  border-color: var(--green);
  color: var(--green);
}

/* --- Stats --- */
.stats-row {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--purple-secondary), var(--blue-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--bg-border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--purple-light);
  border-bottom-color: var(--purple-light);
}

.tab .tab-count {
  margin-left: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--purple-light); }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

/* --- Section Header --- */
.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --- Grid Layouts --- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.grid-sidebar {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
}

.grid-sidebar-right {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2.5rem;
}

/* --- Package Card --- */
.pkg-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.pkg-card-owner {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.pkg-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pkg-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pkg-card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pkg-card-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pkg-card-stats span { display: flex; align-items: center; gap: 0.3rem; }

/* --- Hero --- */
.hero {
  position: relative;
  padding: 5rem 0 4rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(143, 94, 161, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(109, 116, 197, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  position: relative;
}

.hero h1 .gradient-text,
.gradient-text {
  background: linear-gradient(270deg, var(--purple-secondary), var(--blue-light), var(--mint), var(--purple-secondary));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 8s ease infinite;
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  position: relative;
}

.hero-search {
  max-width: 640px;
  margin: 0 auto 3rem;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3.25rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.hero-search input::placeholder { color: var(--text-muted); }

.hero-search input:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 4px var(--glow-purple), 0 4px 24px rgba(0,0,0,0.3);
}

.hero-search .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--purple-light);
}

/* --- Categories --- */
.category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pill {
  padding: 0.4rem 1rem;
  border: 1px solid var(--bg-border);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  font-family: var(--font-sans);
}

.pill:hover {
  border-color: var(--purple);
  color: var(--text-primary);
  background: rgba(143, 94, 161, 0.08);
}

.pill.active {
  border-color: var(--purple);
  background: rgba(143, 94, 161, 0.15);
  color: var(--purple-secondary);
}

/* --- Sidebar (Browse/Filter) --- */
.filter-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-option:hover { color: var(--text-primary); }

.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
  accent-color: var(--purple);
}

.filter-select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
}

/* --- Module Tree Sidebar --- */
.module-tree {
  font-size: 0.85rem;
}

.module-tree-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.module-tree-item:hover {
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
}

.module-tree-item.active {
  background: rgba(143, 94, 161, 0.12);
  color: var(--purple-secondary);
  font-weight: 600;
}

.module-tree-indent { padding-left: 1.25rem; }

/* --- Function Signature Card --- */
.fn-card {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bg-border);
  transition: background 0.15s;
}

.fn-card:hover { background: rgba(255,255,255,0.015); }

.fn-card.highlighted {
  background: rgba(143, 94, 161, 0.06);
  border-left: 3px solid var(--purple);
  padding-left: calc(1.5rem - 3px);
}

.fn-card-sig {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.fn-card-doc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fn-card-doc code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(255,255,255,0.05);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  color: var(--mint);
}

/* --- Dependency Graph --- */
.dep-graph {
  position: relative;
  height: 220px;
  margin: 1.5rem 0;
}

.dep-graph svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dep-node {
  position: absolute;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: all 0.2s;
}

.dep-node:hover {
  border-color: var(--purple);
  box-shadow: 0 0 16px var(--glow-purple);
}

.dep-node.root {
  border-color: var(--purple);
  background: rgba(143, 94, 161, 0.12);
  color: var(--purple-secondary);
}

/* --- Version Timeline --- */
.version-timeline {
  position: relative;
  padding-left: 2rem;
}

.version-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bg-border);
}

.version-item {
  position: relative;
  padding: 1rem 0;
}

.version-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 1.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-border);
  border: 2px solid var(--bg-primary);
}

.version-item:first-child::before {
  background: var(--purple);
  box-shadow: 0 0 8px var(--glow-purple);
}

.version-item h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.version-item .version-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.version-item .version-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* --- Profile Header --- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.profile-info h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.profile-info .bio {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-stats strong { color: var(--text-primary); }

.btn-follow {
  padding: 0.5rem 1.5rem;
  background: transparent;
  border: 1px solid var(--purple);
  border-radius: 8px;
  color: var(--purple-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-follow:hover {
  background: var(--purple);
  color: white;
}

/* --- Search Results --- */
.search-result {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--bg-border);
  transition: background 0.15s;
  cursor: pointer;
}

.search-result:hover { background: rgba(255,255,255,0.02); }

.search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-icon.fn-icon { background: rgba(177, 138, 250, 0.12); }
.search-result-icon.type-icon { background: rgba(97, 116, 208, 0.12); }
.search-result-icon.value-icon { background: rgba(157, 120, 64, 0.12); }
.search-result-icon.module-icon { background: rgba(191, 159, 133, 0.12); }

.search-result-body { flex: 1; }

.search-result-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.search-result-name mark {
  background: rgba(143, 94, 161, 0.25);
  color: var(--purple-secondary);
  padding: 0 0.15rem;
  border-radius: 2px;
}

.search-result-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.search-result-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Filter Chips --- */
.filter-chips {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* --- Footer --- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--bg-border);
  padding: 2rem 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-brand strong { color: var(--text-secondary); }

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-dim);
  font-size: 0.85rem;
  transition: color 0.2s;
}

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

/* --- Recently Updated --- */
.recent-list { list-style: none; }

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(56, 55, 55, 0.5);
  font-size: 0.9rem;
}

.recent-item:last-child { border-bottom: none; }
.recent-item-name { font-weight: 600; color: var(--text-primary); }
.recent-item-version { color: var(--mint); font-family: var(--font-mono); font-size: 0.8rem; }
.recent-item-time { color: var(--text-dim); font-size: 0.8rem; }

/* --- Activity Feed --- */
.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(56, 55, 55, 0.5);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.4rem;
  flex-shrink: 0;
}

.activity-text { font-size: 0.85rem; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); }
.activity-time { font-size: 0.75rem; color: var(--text-dim); margin-top: 0.15rem; }

/* --- Terminal Window --- */
.terminal {
  background: #0d0d0d;
  border: 1px solid var(--bg-border);
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
}

.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #1a1a1c;
  border-bottom: 1px solid var(--bg-border);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-sans);
}

.terminal-body {
  padding: 1.25rem 1.5rem;
  min-height: 200px;
}

.terminal-line {
  white-space: pre;
  min-height: 1.4em;
}

.terminal-prompt {
  color: var(--purple-fn);
}

.terminal-cmd {
  color: var(--text-primary);
}

.terminal-dim {
  color: var(--text-dim);
}

.terminal-tree-branch {
  color: var(--text-dim);
}

.terminal-entity-fn { color: var(--purple-fn); }
.terminal-entity-type { color: var(--blue-type); }
.terminal-entity-value { color: var(--gold); }
.terminal-entity-module { color: var(--taupe); }

.terminal-success { color: var(--green); }
.terminal-info { color: var(--mint); }

/* Typing cursor animation */
.terminal-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background: var(--purple-fn);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(134, 239, 172, 0.4); }
  50% { box-shadow: 0 0 8px rgba(134, 239, 172, 0.7), 0 0 20px rgba(134, 239, 172, 0.2); }
}

@keyframes float-up {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Status Bar (CLI-inspired footer) --- */
.status-bar {
  background: var(--purple);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 0;
  display: flex;
  align-items: center;
}

.status-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.status-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-bar-label {
  background: rgba(255,255,255,0.15);
  padding: 1px 8px;
  border-radius: 3px;
  font-weight: 600;
}

.status-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  opacity: 0.8;
}

/* --- Tree List (CLI-style with box-drawing chars) --- */
.tree-list {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  list-style: none;
}

.tree-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0;
}

.tree-item a {
  color: var(--text-primary);
  transition: color 0.15s;
}

.tree-item a:hover {
  color: var(--purple-fn);
}

.tree-branch {
  color: var(--text-dim);
  user-select: none;
  flex-shrink: 0;
  width: 2ch;
}

.tree-icon {
  flex-shrink: 0;
  width: 1.5ch;
}

/* --- Entity Emoji Icons (matching CLI) --- */
.entity-fn::before { content: "⚡"; }
.entity-type::before { content: "🏷️"; }
.entity-value::before { content: "💎"; }
.entity-module::before { content: "🗂️"; }

/* --- Focus Indicator (CLI ► style) --- */
.glass-card.clickable:hover .pkg-card-name::before,
.search-result:hover .search-result-name::before {
  content: "► ";
  color: var(--purple-fn);
  font-family: var(--font-mono);
}

/* --- Package Card — monospace counts --- */
.pkg-card-counts {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.pkg-card-counts .count-fn { color: var(--purple-fn); }
.pkg-card-counts .count-type { color: var(--blue-type); }
.pkg-card-counts .count-value { color: var(--gold); }
.pkg-card-counts .count-dl { color: var(--text-dim); }

/* --- Hero Terminal Layout --- */
.hero-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.hero-text {
  text-align: left;
}

.hero-text h1 {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  line-height: 1.15;
}

.hero-text .subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 2rem;
  max-width: 480px;
  line-height: 1.6;
}

/* --- Contributor Card (compact) --- */
.contributor-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.contributor-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.contributor-info {
  flex: 1;
  min-width: 0;
}

.contributor-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.contributor-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* --- Branch Context Bar --- */
.branch-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--bg-border);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1;
}

.branch-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 32px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.branch-selector {
  position: relative;
  flex-shrink: 0;
}

.branch-selector-btn {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  padding: 3px 8px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}

.branch-selector-btn:hover {
  border-color: var(--purple);
  background: rgba(143, 94, 161, 0.1);
}

.branch-selector-btn:focus {
  outline: none;
  border-color: var(--purple);
}

.branch-icon {
  color: var(--green);
  font-size: 8px;
  line-height: 1;
}

.branch-arrow {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1;
}

.branch-bar-sep {
  color: var(--bg-border);
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.branch-bar-info {
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-bar-info .branch-wip {
  color: var(--sand);
}

.branch-bar-right {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.branch-bar-right a {
  color: var(--purple-fn);
  text-decoration: none;
  transition: color 0.15s;
}

.branch-bar-right a:hover {
  color: var(--text-primary);
}

/* Branch dropdown */
.branch-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 320px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  z-index: 200;
  font-size: 0.8rem;
}

.branch-dropdown[hidden] {
  display: none;
}

.branch-dropdown-header {
  padding: 6px 12px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-weight: 700;
  background: rgba(0, 0, 0, 0.2);
}

.branch-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.branch-dropdown-item:hover {
  background: rgba(143, 94, 161, 0.1);
  color: var(--text-primary);
}

.branch-dropdown-item.active {
  color: var(--green);
  background: rgba(134, 239, 172, 0.05);
}

.branch-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.branch-meta {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* --- Live Indicator --- */
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  animation: pulse-glow 2s ease-in-out infinite;
}

/* --- Search Keyboard Hint --- */
.search-hint {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  background: var(--bg-elevated);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--bg-border);
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* --- Terminal Glow Effect --- */
.terminal-glow {
  box-shadow: 0 0 40px rgba(143, 94, 161, 0.12),
              0 0 80px rgba(109, 116, 197, 0.06),
              0 20px 60px rgba(0, 0, 0, 0.4);
}

/* --- Hero Command Prefix --- */
.hero-prefix {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

/* --- Hero Terminal Wrapper --- */
.hero-terminal-wrap {
  position: relative;
}

/* --- Hero Text — search, stats, subtitle overrides --- */
.hero-text .hero-search {
  margin: 0 0 2rem;
  max-width: 100%;
}

.hero-text .hero-search input {
  padding-right: 4rem;
}

.hero-text .stats-row {
  justify-content: flex-start;
}

/* --- Recent Updates Tree Style --- */
.recent-tree-header {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--bg-border);
}

.recent-tree .tree-list {
  font-size: 0.85rem;
}

.recent-tree .tree-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  color: var(--text-secondary);
}

.recent-tree .tree-item a {
  color: var(--text-primary);
  font-weight: 500;
}

.recent-tree .tree-item a:hover {
  color: var(--purple-fn);
}

.recent-tree .tree-version {
  color: var(--mint);
  font-size: 0.8rem;
}

.recent-tree .tree-time {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-left: auto;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-sidebar { grid-template-columns: 1fr; }
  .grid-sidebar-right { grid-template-columns: 1fr; }
  .filter-sidebar { position: static; }
  .hero-split { grid-template-columns: 1fr; gap: 2rem; }
  .hero-text { text-align: center; }
  .hero-text .subtitle { margin: 0 auto 2rem; }
  .hero-text .hero-search { margin: 0 auto 2rem; max-width: 640px; }
  .hero-text .stats-row { justify-content: center; }
  .hero-prefix { text-align: center; }
}

@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .hero .subtitle { font-size: 1rem; }
  .stats-row { gap: 1.5rem; justify-content: center; }
  .stat-number { font-size: 1.5rem; }
  .nav-search { display: none; }
  .nav-links { gap: 0.75rem; }
  .top-nav-inner { gap: 1rem; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; }
  .hero-terminal-wrap { display: none; }
  .hero-text h1 { font-size: 2rem; }
  .status-bar-inner { flex-direction: column; gap: 0.25rem; text-align: center; }
  .status-bar-right { justify-content: center; }
}

@media (max-width: 480px) {
  .nav-links { gap: 0.5rem; font-size: 0.8rem; }
  .btn-publish { padding: 0.4rem 0.75rem; font-size: 0.8rem; }
}
