/* DSH plugin index — marketplace surface.
   Layout: sticky command bar → index-source hero → filter rail + card grid.
   Reference points: DSH's own dark palette (Montserrat, blue→violet accent,
   soft rounded panels), VS Code Marketplace's rail+cards, npm's dense meta rows.
   Everything is CSS: no images, no web fonts, no icon fonts. */
:root {
  --bg: #070910;
  --panel: #0e1420;
  --panel-2: #131a29;
  --line: #1d2536;
  --line-2: #2a3448;
  --text: #e9eefb;
  --muted: #8f9cba;
  --dim: #6d7a95;
  --brand: #4d6bfe;
  --brand-2: #8ba2ff;
  --violet: #8b5cf6;
  --ok: #38bdf8;
  --radius: 14px;
  --radius-sm: 10px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --font: "Montserrat", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  /* ~75% of the viewport, centred; below that it goes full width and stays fluid */
  width: min(75vw, 1560px); min-width: 0;
  margin: 0 auto; padding: 0 18px 56px;
  font-family: var(--font); font-size: 13.5px; line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 460px at 4% -10%, #16224a 0%, transparent 62%),
    radial-gradient(720px 380px at 96% -8%, #2b1743 0%, transparent 60%),
    radial-gradient(700px 500px at 50% 115%, #0a1626 0%, transparent 62%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
::selection { background: rgba(77, 107, 254, .35); }

/* ── sticky command bar ───────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  margin: 0 -18px; padding: 14px 18px;
  background: linear-gradient(180deg, rgba(7, 9, 16, .96), rgba(7, 9, 16, .78));
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.badge {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; letter-spacing: .06em; color: #cdd8ff;
  background: rgba(77, 107, 254, .16);
  border: 1px solid rgba(139, 162, 255, .34);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 10px var(--brand);
}
header h1 {
  flex: 0 0 auto; margin: 0 4px 0 0;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  background: linear-gradient(120deg, #fff, #b9c6ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#q {
  flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 14px;
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
#q::placeholder { color: var(--dim); }
#q:focus { border-color: rgba(124, 147, 255, .7); box-shadow: 0 0 0 4px rgba(77, 107, 254, .14); }
#lang {
  flex: 0 0 auto; height: 34px; padding: 0 10px;
  font: inherit; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
}

/* ── index-source hero ────────────────────────────────────────────────── */
.hero {
  position: relative; margin: 16px 0 18px; padding: 16px 18px;
  border: 1px solid transparent; border-radius: 18px;
  background:
    linear-gradient(165deg, #141c2d, #0d1220) padding-box,
    linear-gradient(120deg, rgba(77, 107, 254, .9), rgba(139, 92, 246, .55) 45%, rgba(77, 107, 254, .2)) border-box;
  box-shadow: 0 26px 60px -40px rgba(77, 107, 254, .95), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.seg { display: inline-flex; gap: 3px; padding: 3px; background: rgba(7, 9, 16, .85); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 14px; border-radius: 999px; font-size: 12px;
  transition: color .14s ease, background .14s ease;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed] {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  box-shadow: 0 8px 22px -10px rgba(77, 107, 254, .95);
}
.src {
  display: flex; gap: 8px; align-items: center; margin-top: 10px;
  padding: 7px 8px 7px 12px; cursor: copy;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  /* rainbow that flows along the row — the whole row copies the index URL */
  background:
    linear-gradient(rgba(7, 9, 16, .94), rgba(7, 9, 16, .94)) padding-box,
    linear-gradient(90deg, #4d6bfe, #8b5cf6, #22d3ee, #f472b6, #4d6bfe) border-box;
  background-size: auto, 300% 100%;
  animation: rainbow 7s linear infinite;
}
@keyframes rainbow {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 300% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .src { animation: none; }
}
.src:hover code { color: #fff; }
.ghost {
  padding: 5px 12px; font-size: 12px; color: var(--muted);
  background: rgba(7, 9, 16, .7); border: 1px solid var(--line-2); border-radius: 999px;
}
.ghost:hover { color: var(--text); border-color: rgba(124, 147, 255, .6); }
.src code {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12px; color: var(--brand-2);
}
#copy {
  flex: 0 0 auto; padding: 6px 13px; font-size: 12px; color: #fff; border: 0;
  border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--violet));
  box-shadow: 0 10px 24px -12px rgba(77, 107, 254, .95);
}
#copy:hover { filter: brightness(1.08); }
.row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
#meta { font-size: 11.5px; color: var(--muted); }
#sort { margin-left: auto; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── rail + grid ──────────────────────────────────────────────────────── */
.wrap { display: grid; grid-template-columns: 212px minmax(0, 1fr); gap: 18px; align-items: start; }
#cats {
  position: sticky; top: 68px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: calc(100vh - 92px); overflow-y: auto;
  padding: 8px; background: rgba(14, 20, 32, .6);
  border: 1px solid var(--line); border-radius: var(--radius);
}
#cats::-webkit-scrollbar { width: 6px; }
#cats::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.grp { margin: 10px 0 3px; padding: 0 8px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 6px 9px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: 12.5px; text-align: left;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}
.chip:hover { color: var(--text); background: var(--panel-2); }
.chip i { font-style: normal; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.chip[aria-pressed] { color: #fff; background: rgba(77, 107, 254, .18); border-color: rgba(124, 147, 255, .45); }
.chip[aria-pressed] i { color: #c3cfff; }

#list { display: grid; grid-template-columns: repeat(auto-fill, minmax(304px, 1fr)); gap: 12px; min-width: 0; }
.card {
  position: relative; display: flex; gap: 12px; padding: 14px;
  background: linear-gradient(175deg, rgba(19, 26, 41, .95), rgba(13, 18, 32, .95));
  border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(320px 120px at 10% 0%, rgba(77, 107, 254, .16), transparent 70%);
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.card:hover, .card:focus-visible { transform: translateY(-2px); border-color: rgba(124, 147, 255, .55); box-shadow: 0 20px 40px -28px rgba(77, 107, 254, 1); outline: none; }
.card:hover::after, .card:focus-visible::after { opacity: 1; }
.card img, .card .dot { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 10px; object-fit: contain; background: var(--bg); border: 1px solid var(--line); }
.card .dot { background: radial-gradient(circle at 50% 45%, var(--brand) 0 5px, transparent 5px), linear-gradient(160deg, #192241, #0d1220); }
.body { min-width: 0; flex: 1; }
.card h2 {
  margin: 0 0 3px; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.desc {
  margin: 0 0 8px; font-size: 12px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; }
.meta span {
  font-size: 10.5px; color: #9aa8c7; font-variant-numeric: tabular-nums;
  background: rgba(7, 9, 16, .75); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px;
}
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.badges b {
  font-size: 10px; font-weight: 500; color: #b7c3ff;
  background: rgba(77, 107, 254, .14); border: 1px solid rgba(124, 147, 255, .26);
  border-radius: 6px; padding: 1px 6px;
}
.more {
  grid-column: 1 / -1; padding: 12px; font-size: 12.5px; color: var(--text);
  background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius);
}
.more:hover { border-color: rgba(124, 147, 255, .6); }
.empty { grid-column: 1 / -1; padding: 40px 0; text-align: center; color: var(--dim); font-size: 13px; }

/* ── sort switch ──────────────────────────────────────────────────────── */
.sorts { display: inline-flex; gap: 2px; padding: 3px; background: rgba(7, 9, 16, .85); border: 1px solid var(--line); border-radius: 999px; }
.sorts button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; font-size: 11.5px; border-radius: 999px; }
.sorts button:hover { color: var(--text); }
.sorts button[aria-pressed] { color: #fff; background: rgba(77, 107, 254, .26); }
.dice { padding: 5px 11px; font-size: 12px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; }
.dice:hover { border-color: rgba(124, 147, 255, .6); }

/* ── detail drawer ────────────────────────────────────────────────────── */
dialog {
  /* centred modal that hugs its content (a stale CF deployment once shipped the
     full-height drawer rule, which is what made this panel look empty) */
  margin: auto; padding: 0; width: min(720px, 92vw);
  height: fit-content; max-height: 86vh; overflow-y: auto;
  color: var(--text);
  background: linear-gradient(180deg, #121a2b, #0a0f1a);
  border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 40px 120px -50px #000, inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: pop .18s cubic-bezier(.22, .61, .36, 1);
}
@keyframes pop { from { transform: scale(.97); opacity: .5; } to { transform: none; opacity: 1; } }
dialog::backdrop { background: rgba(3, 5, 10, .7); backdrop-filter: blur(3px); }
dialog h3 { margin: 0; padding: 20px 22px 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
/* the description is the reason a reader opened the modal: make it the loudest
   thing under the title */
.lead {
  margin: 0; padding: 0 22px 16px;
  font-size: 14.5px; line-height: 1.75; color: #dbe3f6;
  border-left: 3px solid rgba(124, 147, 255, .55);
  padding-left: 16px; margin-left: 22px; padding-right: 22px;
}
.guide { margin: 0 22px 14px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.guide li { display: flex; gap: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.guide li b {
  flex: 0 0 20px; height: 20px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--violet));
}
dialog dl {
  display: grid; grid-template-columns: 64px 1fr; gap: 6px 12px;
  margin: 0 22px 14px; padding: 12px 14px;
  background: rgba(7, 9, 16, .6); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12px;
}
dialog dt { color: var(--dim); }
dialog dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.cmd { display: flex; gap: 8px; align-items: center; margin: 0; padding: 0 22px 12px; }
.cmd code {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12px; color: var(--brand-2);
  background: rgba(7, 9, 16, .85); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px;
}
.cmd button {
  flex: 0 0 auto; padding: 7px 12px; font-size: 12px; color: #fff; border: 0; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
}
.links { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0 22px 12px; font-size: 11.5px; }
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0; padding: 0 22px 14px; font-size: 11.5px; color: var(--dim);
}
.nav button { padding: 6px 13px; font-size: 12px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; }
.nav button:hover { border-color: rgba(124, 147, 255, .6); }
.nav button[disabled] { opacity: .4; cursor: default; }
dialog form { margin: 0; padding: 0 22px 22px; text-align: right; }
dialog .close { padding: 7px 16px; font-size: 12px; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; }

body > footer {
  margin-top: 32px; padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--dim); text-align: center;
}

@media (max-width: 1200px) {
  body { width: auto; max-width: calc(100vw - 24px); }
}
@media (max-width: 860px) {
  .wrap { grid-template-columns: 1fr; }
  #cats { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .grp { width: 100%; margin: 6px 0 0; }
  .chip { width: auto; }
  header h1 { display: none; }
  #list { grid-template-columns: 1fr; }
  .hero { padding: 14px; }
}
@media (max-width: 560px) {
  body { padding: 0 12px 40px; }
  header { gap: 8px; padding: 12px; margin: 0 -12px; }
  #q { height: 34px; }
  #sort { margin-left: 0; }
}
