/* CSS Variables */
:root {
  --color-bg: #0d1117;
  --color-bg-secondary: #161b22;
  --color-bg-tertiary: #21262d;
  --color-border: #30363d;
  --color-border-hover: #484f58;
  --color-text: #e6edf3;
  --color-text-secondary: #8b949e;
  --color-text-muted: #6e7681;
  --color-link: #58a6ff;
  --color-link-hover: #79c0ff;
  --color-accent: #238636;
  --color-accent-hover: #2ea043;
  --color-warning: #d29922;
  --color-contributor: #8957e5;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --transition: 150ms ease;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-link-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  padding: 3rem 0;
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg) 100%);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.site-header h1 {
  margin: 0 0 0.5rem;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 1.5rem;
  font-size: 1.125rem;
  color: var(--color-text-secondary);
}

.header-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text);
  transition: all var(--transition);
}

.github-link:hover {
  background: var(--color-border);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

/* Main Content */
main {
  padding: 3rem 0;
}

/* Categories */
.category {
  margin-bottom: 3rem;
}

.category-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--color-border);
}

.category-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.category-header p {
  margin: 0;
  color: var(--color-text-secondary);
}

.category--contributions .category-header {
  border-bottom-color: var(--color-contributor);
}

.category--experimental .category-header {
  border-bottom-color: var(--color-warning);
}

.category--academic .category-header {
  border-bottom-color: var(--color-link);
}

/* Subcategories */
.subcategory {
  margin-bottom: 2rem;
}

.subcategory-title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

/* Projects Table */
.projects-table {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.projects-table-header {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr minmax(120px, auto);
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* Project Row */
.project-row {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  transition: background var(--transition);
}

.project-row:last-child {
  border-bottom: none;
}

.project-row:hover {
  background: var(--color-bg-tertiary);
}

.project-row--lead {
  border-left: 3px solid var(--color-accent);
}

.project-row--contributor {
  border-left: 3px solid var(--color-contributor);
}

.project-row--experimental,
.project-row--development {
  border-left: 3px solid var(--color-warning);
}

/* Project Summary (clickable header) */
.project-summary {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 2fr minmax(120px, auto);
  gap: 1rem;
  padding: 1rem;
  cursor: pointer;
  align-items: center;
}

.project-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.expand-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
}

.expand-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: translate(-50%, -70%) rotate(45deg);
  transition: transform var(--transition);
}

.project-row.expanded .expand-icon::before {
  transform: translate(-50%, -30%) rotate(-135deg);
}

.project-name {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  color: var(--color-text);
}

.project-institution {
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: rgba(88, 166, 255, 0.15);
  color: var(--color-link);
}

.project-status,
.project-role {
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.project-status--experimental,
.project-status--development {
  background: rgba(210, 153, 34, 0.15);
  color: var(--color-warning);
}

.project-role--contributor {
  background: rgba(137, 87, 229, 0.15);
  color: var(--color-contributor);
}

.project-role--lead {
  background: rgba(35, 134, 54, 0.15);
  color: var(--color-accent);
}

.project-brief {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.project-badges-cell {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.project-badges-cell img {
  height: 18px;
  border-radius: 3px;
}

/* Stat badges (stars, downloads) */
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.stat-badge--stars {
  background: rgba(210, 153, 34, 0.12);
  color: var(--color-warning);
}

.stat-badge--downloads {
  background: rgba(35, 134, 54, 0.12);
  color: var(--color-accent);
}

/* Project Details (accordion content) */
.project-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.project-row.expanded .project-details {
  grid-template-rows: 1fr;
}

.project-details-inner {
  overflow: hidden;
  padding: 0 1rem;
  border-top: 0 solid var(--color-border);
  background: var(--color-bg);
}

.project-row.expanded .project-details-inner {
  padding: 1.25rem 1rem 1.25rem 2.5rem;
  border-top-width: 1px;
}

.project-description {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.project-features-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.project-features {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.project-features li {
  margin-bottom: 0.25rem;
}

.project-features li::marker {
  color: var(--color-accent);
}

.project-note {
  margin: 0 0 1rem;
  padding: 0.625rem 0.875rem;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--color-text-muted);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}

.project-link:hover {
  background: var(--color-border);
  border-color: var(--color-border-hover);
  color: var(--color-text);
}

.project-link--github:hover {
  color: var(--color-text);
}

.project-link--docs {
  color: var(--color-link);
}

.project-link--docs:hover {
  color: var(--color-link-hover);
}

.project-link--website {
  color: var(--color-link);
}

.project-link--upstream {
  color: var(--color-contributor);
}

/* Footer */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.site-footer a {
  color: var(--color-text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .site-header h1 {
    font-size: 1.75rem;
  }

  .tagline {
    font-size: 1rem;
  }

  .projects-table-header {
    display: none;
  }

  .project-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .project-name-cell {
    width: 100%;
  }

  .project-brief {
    width: 100%;
  }

  .project-badges-cell {
    width: 100%;
    justify-content: flex-start;
  }

  .category-header h2 {
    font-size: 1.5rem;
  }
}

/* Composition examples -- the extensions used together */
.composition .category-header { margin-bottom: 1.25rem; }
.composition-install {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  overflow-x: auto;
}
.composition-grid { display: grid; gap: 1.25rem; }
.composition-example {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem 1.25rem;
  transition: border-color var(--transition);
}
.composition-example:hover { border-color: var(--color-border-hover); }
.composition-title { margin: 0 0 0.5rem; font-size: 1.02rem; font-weight: 600; }
.composition-exts { margin: 0 0 0.85rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ext-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  color: var(--color-link);
}
.composition-sql, .composition-output {
  margin: 0 0 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.composition-sql {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
/* The real result of running the snippet above, not an illustration. */
.composition-output {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  color: var(--color-text-secondary);
}
.composition-note { margin: 0; font-size: 0.88rem; color: var(--color-text-secondary); }
.composition-footnote {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.88rem;
  color: var(--color-text-muted);
}
@media (min-width: 980px) {
  .composition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composition-example:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* DuckDB 2.0 readiness chips. Read from each repo's CI, not asserted by hand -- and the
   category note carries the measurement date, because a status with no date becomes a
   claim the moment it goes stale. */
.duckdb2 {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
/* released: shipped and installable. ready: builds, not shipped. untested: no signal. */
.duckdb2--released { color: #7ee787; background: rgba(46,160,67,0.22); border-color: rgba(46,160,67,0.65); font-weight: 600; }
.duckdb2--ready    { color: #d29922; background: rgba(210,153,34,0.12); border-color: rgba(210,153,34,0.4); }
.duckdb2--untested { color: var(--color-text-muted); background: var(--color-bg-tertiary); border-color: var(--color-border); }
.category-duckdb2-note {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 3px solid var(--color-link);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  color: var(--color-text-secondary);
  max-width: 68ch;
}
.project-note--duckdb2 { border-left: 2px solid rgba(46,160,67,0.4); padding-left: 0.6rem; }

/* Guide pages (Markdown in an article.guide) */
.guide {
  max-width: 860px;
  margin: 2rem auto 4rem;
  padding: 0 16px;
}
.guide h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.guide h2 { margin-top: 2.5rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.3rem; }
.guide a { color: var(--color-link); }
.guide a:hover { color: var(--color-link-hover); }
.guide code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-bg-tertiary);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}
.guide pre {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
}
.guide pre code { background: none; padding: 0; }
.guide table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1rem 0;
}
.guide th, .guide td {
  border: 1px solid var(--color-border);
  padding: 0.45rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.guide th { background: var(--color-bg-secondary); }

/* Recent updates */
.updates-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.update {
  display: grid;
  grid-template-columns: 6.5rem 4.5rem 1fr;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.update time {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.update-kind {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
}

.update--note .update-kind {
  color: var(--color-warning);
}

.update a {
  color: var(--color-link);
  text-decoration: none;
}

.update a:hover {
  color: var(--color-link-hover);
}

.update-summary {
  grid-column: 3;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .update {
    grid-template-columns: auto 1fr;
  }

  .update a,
  .update-summary {
    grid-column: 1 / -1;
  }
}

.update-note .update-meta {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.update-note a {
  color: var(--color-link);
}

/* Area pages: the nav under the header, the index's area cards, and the breadcrumb */
.area-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}
.area-nav a { color: var(--color-text-secondary); }
.area-nav a:hover, .area-nav a[aria-current="page"] { color: var(--color-text); }
.area-nav a[aria-current="page"] { font-weight: 600; }
.area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
}
.area-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  color: var(--color-text);
  transition: border-color var(--transition);
}
.area-card:hover { border-color: var(--color-border-hover); color: var(--color-text); }
.area-title { margin: 0; font-size: 1.1rem; font-weight: 600; }
.area-description { margin: 0; flex: 1; color: var(--color-text-secondary); font-size: 0.9rem; }
.area-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-text-muted); }
.breadcrumb, .area-guide { margin: 1.5rem 0 0; font-size: 0.875rem; color: var(--color-text-secondary); }
