:root {
  --paper: #f7f8fa;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --ink-soft: #3d4a5c;
  --harness: #0b6e99;
  --harness-deep: #084e6e;
  --verified: #1a7f5a;
  --warning: #c45c26;
  --critical: #b42318;
  --unknown: #6b7789;
  --line: #e5e7eb;
  --line-strong: #c4c9d1;
  --slot: #0f1b2d;
  --clip: #101820;
  --clip-text: #d7e4ee;
  --shadow: 0 10px 30px rgba(15, 27, 45, 0.06);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;
  --radius: 6px;
  --max: 1200px;
  --header-h: 64px;
  --font-display: "Bricolage Grotesque", "Figtree", sans-serif;
  --font-body: "Figtree", "PingFang SC", "Noto Sans SC", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --paper: #0b1220;
  --surface: #151d2e;
  --ink: #e8eef4;
  --ink-soft: #9aabc0;
  --harness: #4db3d8;
  --harness-deep: #7cc8e4;
  --verified: #3dba86;
  --warning: #e08952;
  --critical: #ef6b63;
  --unknown: #8b97a8;
  --line: #2a364a;
  --line-strong: #44516a;
  --slot: #070b14;
  --clip: #070b14;
  --clip-text: #d7e4ee;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
  display: block;
}

code,
.mono {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--harness);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--ink);
  color: var(--surface);
  padding: 8px 12px;
  z-index: 80;
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-slot {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
}

.brand-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-type strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-type small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  transform: translateX(-50%);
}

.nav a {
  position: relative;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-soft);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 3px;
  background: var(--harness);
  border-radius: 1px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--ink);
}

.icon-btn:hover {
  border-color: var(--line-strong);
}

.lang-btn {
  width: auto;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Hero / backplane */
.hero {
  padding: 56px 0 28px;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--harness);
  margin: 0 0 12px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
  max-width: 16ch;
}

.lede {
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 18px;
  margin: 0 0 28px;
}

.search-bar {
  display: flex;
  gap: 8px;
  max-width: 720px;
}

.search-bar input,
.field,
.select {
  height: 48px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0 14px;
}

.search-bar input {
  flex: 1;
  min-width: 0;
}

.search-bar input::placeholder,
.field::placeholder {
  color: var(--unknown);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
}

.btn:hover {
  background: var(--harness-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: transparent;
}

.btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.hint {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
}

.chip:hover,
.chip.is-on {
  border-color: var(--harness);
  color: var(--ink);
}

.chip.is-on {
  background: color-mix(in srgb, var(--harness) 12%, var(--surface));
}

/* Backplane rail */
.backplane {
  margin: 36px 0 8px;
  background: var(--slot);
  color: #e8eef4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.backplane-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 20px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9aabc0;
}

.rail {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 8px 16px 20px;
  scroll-snap-type: x mandatory;
}

.rail::-webkit-scrollbar {
  height: 8px;
}

.rail::-webkit-scrollbar-thumb {
  background: #44516a;
  border-radius: 99px;
}

.module {
  flex: 0 0 260px;
  scroll-snap-align: start;
  background: #1a2436;
  border: 1px solid #2a364a;
  min-height: 148px;
  display: grid;
  grid-template-columns: 16px 1fr;
  position: relative;
}

.module::before,
.module::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 10px;
  height: 6px;
  background-image: repeating-linear-gradient(
    90deg,
    #0b6e99 0 8px,
    transparent 8px 12px
  );
}

.module::before {
  top: 0;
}

.module::after {
  bottom: 0;
}

.module .slot {
  background: var(--harness);
}

.module-body {
  padding: 16px 14px 14px 12px;
}

.module-body .repo {
  color: #fbfcfd;
}

.module-body p {
  color: #9aabc0;
  font-size: 13px;
  margin: 6px 0 0;
}

/* Sections */
.section {
  padding: 28px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.03em;
  margin: 0;
}

.section-head a {
  font-size: 14px;
  color: var(--harness);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 16px;
  width: 100%;
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

/* Plugin card */
.card {
  display: grid;
  grid-template-columns: 6px 1fr;
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 210px;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--harness);
  transform: translateY(-1px);
}

.slot {
  background: var(--harness);
}

.card-body {
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stars {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.tag-featured {
  color: var(--harness);
  border-color: color-mix(in srgb, var(--harness) 40%, var(--line));
}

.tag-noise {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line));
}

.repo {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-body p {
  margin: 0;
  width: 100%;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 42px;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Install clip */
.clip {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: stretch;
  background: var(--clip);
  color: var(--clip-text);
  border-radius: 3px;
  overflow: hidden;
  min-height: 36px;
}

.clip-edge {
  background-image: repeating-linear-gradient(
    to bottom,
    var(--harness) 0 6px,
    transparent 6px 10px
  );
  background-color: #070b14;
}

.clip code {
  display: block;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip button {
  border: 0;
  background: var(--harness);
  color: #fbfcfd;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 650;
}

.clip button:hover {
  background: #0d86b8;
}

[data-theme="dark"] .clip button {
  color: #0b1220;
}

/* Catalog layout */
.page-head {
  padding: 32px 0 8px;
}

.page-head h1 {
  font-family: var(--font-display);
  font-size: 40px;
  letter-spacing: -0.04em;
  margin: 0 0 6px;
}

.page-head p {
  margin: 0;
  color: var(--ink-soft);
}

.catalog {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 0 48px;
  align-items: start;
}

.filters {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.panel,
.results-panel {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.home {
  padding-bottom: 48px;
}

.home .hero.panel {
  padding: 28px 24px 24px;
  margin-top: 20px;
}

.home .section.panel {
  padding: 20px;
  margin-top: 16px;
}

.home .section.panel .section-head {
  margin-bottom: 14px;
}

.home .section.panel .rail {
  width: 100%;
  min-width: 0;
}

.filters h2 {
  font-size: 13px;
  margin: 0 0 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: var(--ink-soft);
}

.filter-group + .filter-group {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.filter-group h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar .search-bar {
  flex: 1;
  min-width: 220px;
}

.select {
  height: 40px;
}

.toolbar-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  margin-bottom: 14px;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-toggle button {
  width: 36px;
  height: 36px;
  border: 0;
  background: var(--surface);
  color: var(--ink-soft);
}

.view-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.catalog.list-view .results {
  grid-template-columns: 1fr;
}

.catalog.list-view .card {
  min-height: 0;
}

.catalog.list-view .card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  grid-template-areas:
    "top cmd"
    "meta cmd"
    "desc desc";
  gap: 8px 16px;
}

.catalog.list-view .card-top {
  grid-area: top;
}

.catalog.list-view .meta {
  grid-area: meta;
}

.catalog.list-view .card-body p {
  grid-area: desc;
  -webkit-line-clamp: 2;
  min-height: 0;
}

.catalog.list-view .clip {
  grid-area: cmd;
  align-self: center;
}

.empty {
  display: none;
  text-align: center;
  padding: 64px 16px;
  border: 1px dashed var(--line);
  background: var(--surface);
}

.empty.is-visible {
  display: block;
}

.empty h2 {
  font-family: var(--font-display);
  margin: 0 0 8px;
}

.empty p {
  color: var(--ink-soft);
  margin: 0;
}

.load-more {
  margin: 24px 0 0;
  display: block;
  width: 100%;
}

.filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-head h2 {
  margin: 0;
}

/* Detail */
.detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  padding: 28px 0 64px;
  align-items: start;
}

.crumb {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.crumb a {
  color: var(--harness);
}

.crumb a:hover {
  text-decoration: underline;
}

.detail h1 {
  font-family: var(--font-mono);
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -0.04em;
  margin: 0 0 8px;
}

.detail .lede {
  font-size: 16px;
  margin-bottom: 14px;
}

.install-panel {
  position: sticky;
  top: 84px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.install-panel h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.install-panel .note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.install-panel .clip {
  margin-bottom: 12px;
}

.install-panel .clip code {
  white-space: normal;
  overflow: visible;
}

.panel-actions {
  display: grid;
  gap: 8px;
}

.panel-actions .btn {
  width: 100%;
}

.facts {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.facts dt {
  color: var(--ink-soft);
}

.facts a {
  color: var(--harness);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.tabs button {
  border: 0;
  background: transparent;
  padding: 10px 12px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--harness);
}

.tab-panel[hidden] {
  display: none;
}

.readme {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.readme h2,
.readme h3 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.readme pre {
  background: var(--clip);
  color: var(--clip-text);
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

.about-block {
  max-width: 68ch;
  padding: 40px 0 72px;
}

.about-block h1 {
  font-family: var(--font-display);
  font-size: 42px;
  letter-spacing: -0.04em;
  margin: 0 0 12px;
}

.about-block h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 28px 0 8px;
}

.placeholder {
  padding: 80px 0;
  text-align: center;
}

.placeholder h1 {
  font-family: var(--font-display);
  font-size: 36px;
  margin: 0 0 8px;
}

/* Command palette */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 45, 0.38);
  display: none;
  z-index: 60;
  padding: 12vh 16px 16px;
}

.overlay.is-open {
  display: block;
}

.palette {
  width: min(560px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.palette input {
  width: 100%;
  height: 52px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 0 16px;
}

.palette-list {
  max-height: 320px;
  overflow: auto;
}

.palette-list a {
  display: block;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.palette-list a:hover,
.palette-list a:focus {
  background: color-mix(in srgb, var(--harness) 10%, var(--surface));
}

.palette-list small {
  display: block;
  color: var(--ink-soft);
}

.sheet-btn,
.sheet-close {
  display: none;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s ease;
  z-index: 70;
}

.toast.is-on {
  opacity: 1;
  transform: none;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--slot);
  color: #d7e4ee;
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-footer .brand-type small,
.site-footer .disclaimer {
  color: #9aabc0;
}

.disclaimer {
  max-width: 46ch;
  font-size: 13px;
  margin: 8px 0 0;
}

.crawl {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7cc8e4;
  margin-top: 10px;
}

.footer-links {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.footer-links a:hover {
  color: #7cc8e4;
}

@media (max-width: 960px) {
  .catalog {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    display: none;
  }

  .filters.is-open {
    display: block;
    position: fixed;
    inset: auto 12px 12px;
    z-index: 50;
    max-height: 70vh;
    overflow: auto;
    box-shadow: var(--shadow);
  }

  .sheet-btn,
  .sheet-close {
    display: inline-flex;
    align-items: center;
  }

  .detail {
    grid-template-columns: 1fr;
  }

  .install-panel {
    position: static;
  }

  .catalog.list-view .card-body {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "meta"
      "desc"
      "cmd";
  }

  .catalog.list-view .clip {
    align-self: stretch;
  }
}

@media (max-width: 720px) {
  .header-inner {
    gap: 10px;
  }

  .nav {
    display: none;
  }

  .hero {
    padding-top: 32px;
  }

  .home .hero.panel {
    padding: 20px 16px 16px;
    margin-top: 12px;
  }

  .home .section.panel {
    padding: 16px;
  }

  .grid,
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  .toolbar-count {
    margin-left: 0;
    width: 100%;
  }

  .mobile-nav {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    gap: 4px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-nav a {
    white-space: nowrap;
    font-size: 13px;
    padding: 6px 10px;
    color: var(--ink-soft);
  }

  .mobile-nav a[aria-current="page"] {
    color: var(--ink);
    box-shadow: inset 0 -2px 0 var(--harness);
  }
}

@media (min-width: 721px) {
  .mobile-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .card,
  .toast {
    transition: none;
  }

  .card:hover {
    transform: none;
  }
}
