:root {
  --base: #fff;
  --ink: #1b2428;
  --page: #f4f6f5;
  --surface: #fff;
  --border: #d1d7d7;
  --muted: #677a7a;
  --muted-light: #899897;
  --teal: #008481;
  --teal-dark: #006461;
  --teal-soft: #d8f3f2;
  --radius: 2px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --base: #1b2428;
    --ink: #fff;
    --page: #0e1a1f;
    --surface: #1b2428;
    --border: #354140;
    --muted: #9aa8a8;
    --muted-light: #899897;
    --teal-soft: #0e3b39;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--teal-soft); outline-offset: 2px; }
header {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variation-settings: "wdth" 125;
}
/* Work-in-progress marker next to the wordmark. Solid teal reads in both themes. */
.beta-tag {
  display: inline-flex;
  align-items: center;
  margin-left: -0.15rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  /* Matches the dark navy tile in the mark SVG so no teal shows at the rounded corners. */
  background: #1c3a5e;
  flex-shrink: 0;
}
main { max-width: 1400px; margin: 0 auto; padding: 0 20px 48px; }
.hero {
  max-width: 760px;
  padding: 64px 0 36px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.06;
  letter-spacing: -.04em;
  font-variation-settings: "wdth" 125;
}
.lede { max-width: 660px; margin-bottom: 22px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.search-field { position: relative; display: block; }
.search-field input {
  width: 100%;
  padding: 14px 48px 14px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 15px;
}
.search-field input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
/* The browser's native search-cancel button would otherwise sit in the same
   top-right corner as our own "/" shortcut hint once text is entered. */
.search-field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
kbd {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  font-size: 11px;
}
.status { min-height: 18px; margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.catalog-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters { padding: 14px 0; }
.filter-header, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-header h2 { margin: 0; font-size: 13px; font-variation-settings: "wdth" 125; }
.text-button, .secondary {
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.text-button:hover, .secondary:hover { color: var(--ink); border-color: var(--border); }
.view-toggle { display: flex; flex-shrink: 0; gap: 4px; }
.view-toggle .text-button[aria-pressed="true"] { color: var(--ink); border-color: var(--border); background: var(--page); }
fieldset { margin: 18px 0 0; padding: 0; border: 0; }
legend { margin-bottom: 7px; color: var(--muted-light); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
fieldset label { display: flex; gap: 7px; align-items: center; padding: 4px 0; color: var(--muted); font-size: 12px; cursor: pointer; }
fieldset input { accent-color: var(--teal); }
.toolbar { min-height: 34px; margin-bottom: 10px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-pill {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.result-card {
  display: flex;
  min-height: 166px;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}
.result-card:hover, .result-card.selected { border-color: var(--teal); background: var(--teal-soft); }
.result-meta { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.result-title { margin-top: 8px; font-size: 14px; font-weight: 650; letter-spacing: -.015em; font-variation-settings: "wdth" 125; }
.result-description { display: -webkit-box; margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.result-context { margin-top: auto; padding-top: 10px; color: var(--muted-light); font-size: 11px; }
.result-grid.list-view { display: flex; flex-direction: column; gap: 6px; }
.list-view .result-card {
  flex-direction: row;
  align-items: center;
  min-height: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  gap: 16px;
}
.list-view .result-meta {
  flex-shrink: 0;
  width: 100px;
}
.list-view .result-title {
  flex-shrink: 0;
  width: 200px;
  margin-top: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.list-view .result-description {
  display: block;
  flex: 1;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-line-clamp: unset;
}
.list-view .result-context {
  flex-shrink: 0;
  margin-top: 0;
  margin-left: auto;
  padding-top: 0;
  text-align: right;
}
.scroll-sentinel { height: 1px; }
.load-more-status { margin: 18px auto 0; text-align: center; color: var(--muted); visibility: hidden; }
.load-more-status.visible { visibility: visible; }
dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  padding: 28px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop { background: color-mix(in srgb, var(--ink) 32%, transparent); }
.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}
.dialog-close:hover { color: var(--ink); border-color: var(--teal); }
.detail-meta { margin-bottom: 8px; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.detail-panel h2, #detail-panel h2 { margin-bottom: 10px; padding-right: 28px; font-size: 19px; font-variation-settings: "wdth" 125; letter-spacing: -.02em; }
.detail-panel p, #detail-panel p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.detail-section { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-section h3 { margin: 0 0 9px; color: var(--muted-light); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.capability-explainer { margin-bottom: 14px; }
.capability-group + .capability-group { margin-top: 14px; }
.capability-group h4 { margin: 0 0 7px; color: var(--ink); font-size: 12px; font-weight: 650; }
.detail-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.detail-list li { padding: 4px 7px; background: var(--page); border-radius: 3px; color: var(--muted); font-size: 11px; }
.install-command { display: block; padding: 9px; overflow-x: auto; background: var(--page); border: 1px solid var(--border); border-radius: 3px; color: var(--ink); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.detail-list li.skill-item { flex-basis: 100%; padding: 0; background: none; border-radius: 3px; }
/* Expanded state gets its own bordered card around toggle+meta+body together, so it's
   visually obvious where one skill's content ends and the next skill's begins --
   before this, the three pieces were separate floating boxes with no shared boundary.
   Selector must match `.detail-list li.skill-item` above (class,class,type) or that
   rule's `background: none` wins on specificity regardless of source order -- this
   file has already had one silent override bug from underestimating this exact rule. */
.detail-list li.skill-item.expanded { background: var(--page); border: 1px solid var(--border); padding-bottom: 8px; }
.skill-toggle { display: block; width: 100%; padding: 4px 7px; background: var(--page); border: none; border-radius: 3px; color: var(--muted); font-size: 11px; font-family: inherit; text-align: left; cursor: pointer; }
.skill-item.expanded .skill-toggle { border-radius: 3px 3px 0 0; color: var(--ink); font-weight: 650; }
.skill-toggle:hover { color: var(--ink); }
.skill-toggle::before { display: inline-block; margin-right: 6px; content: "▸"; font-size: 14px; line-height: 1; transform-origin: 45% center; transition: transform .1s ease; }
.skill-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
/* Indented relative to the toggle above so the body reads as its child, not a sibling
   floating at the same level. */
.skill-body { display: block; margin: 4px 7px 0 18px; padding: 9px; max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; color: var(--ink); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.skill-body[hidden] { display: none; }
.empty-state { padding: 48px 24px; border: 1px dashed var(--border); color: var(--muted); text-align: center; }
.empty-state h2 { color: var(--ink); font-size: 15px; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 680px) {
  header { padding: 0 14px; }
  main { padding: 0 14px 32px; }
  .hero { padding: 42px 0 24px; }
  .catalog-layout { grid-template-columns: 1fr; gap: 8px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 0 0 14px; }
  .filter-header { grid-column: 1 / -1; }
  .result-grid { grid-template-columns: 1fr; }
  .result-grid.list-view { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .list-view .result-card {
    flex-direction: column;
    align-items: flex-start;
    min-height: 166px;
    padding: 14px;
    border-radius: 10px;
    gap: 0;
  }
  .list-view .result-meta { width: auto; }
  .list-view .result-title {
    width: auto;
    margin-top: 8px;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
  }
  .list-view .result-description {
    display: -webkit-box;
    margin-top: 6px;
    white-space: normal;
    text-overflow: clip;
    -webkit-line-clamp: 3;
  }
  .list-view .result-context {
    margin-top: auto;
    margin-left: 0;
    padding-top: 10px;
    text-align: left;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .result-card { transition: background .15s ease, border-color .15s ease; }
  .result-card.just-added { animation: capability-in .28s ease both; }
  @keyframes capability-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}
