/* The app catalog: the listing pages (/catalog/, /catalog/c/CATEGORY/, their /page/N/) and the app pages
   (/catalog/NAME/). Loaded only by those pages, after the site stylesheet, whose colour variables it uses in both
   themes. Each category has two gradient stops, --c1 (its chip colour) and --c2. Rows have a fixed height (--rh),
   which catalog.v2.js reads to render only the rows in view. */
.t-web { --c1: var(--impl); --c2: var(--accent); }
.t-database { --c1: var(--ok); --c2: var(--impl); }
.t-devops { --c1: var(--plan); --c2: var(--accent); }
.t-monitoring { --c1: var(--exp); --c2: var(--plan); }
.t-security { --c1: var(--exp); --c2: var(--ok); }
.t-network { --c1: var(--plan); --c2: var(--ok); }
.t-communication { --c1: var(--impl); --c2: var(--plan); }
.t-tools { --c1: var(--impl); --c2: var(--ok); }
.t-storage { --c1: var(--ok); --c2: var(--plan); }
.t-other { --c1: var(--impl); --c2: var(--plan); }

/* Icon tiles: the glyph (or the first letter) in the page background colour on the category gradient. */
.cg-tile { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--c1), var(--c2)); color: var(--bg); }
.cg-tile .gl { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cg-tile .gl-l { font-size: 0.9rem; font-weight: 800; line-height: 1; }
.cg-tile.xl { width: 104px; height: 104px; border-radius: 28px; box-shadow: 0 24px 60px -24px var(--c1); }
.cg-tile.xl .gl { width: 56px; height: 56px; stroke-width: 1.6; }
.cg-tile.xl .gl-l { font-size: 3rem; }

/* The search band: sticky, compact, the first thing on the page. */
.cg-band { position: sticky; top: 0; z-index: 7; background: var(--bg); border-bottom: 1px solid var(--line); padding-block: 0.65rem 0.55rem; }
.cg-top { display: flex; align-items: center; gap: 0.6rem 1rem; }
.cg-h1 { font-size: 1.3rem; letter-spacing: -0.02em; margin: 0; white-space: nowrap; }
.cg-pgno { color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.cg-q { position: relative; flex: 1; min-width: 0; }
.cg-q input { width: 100%; height: 2.9rem; font: inherit; font-size: 1.05rem; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 4.6rem 0 2.7rem; -webkit-appearance: none; appearance: none; }
.cg-q input::placeholder { color: var(--muted); opacity: 1; }
.cg-q input:hover:not(:disabled) { border-color: var(--accent); }
.cg-q input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--glow); }
.cg-q input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.cg-q input:disabled { cursor: not-allowed; }
.cg-q input::-webkit-search-cancel-button { -webkit-appearance: none; }
.cg-q-ico { position: absolute; left: 0.9rem; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.cg-kbd { position: absolute; right: 2.9rem; top: 50%; transform: translateY(-50%); font: 700 0.78rem/1 ui-monospace, Menlo, Consolas, monospace; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0.22rem 0.42rem; background: var(--panel-2); pointer-events: none; }
.cg-hb { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: 800 0.95rem/1 inherit; cursor: pointer; }
.cg-hb:hover, .cg-hb[aria-expanded="true"] { border-color: var(--accent); }
.cg-hb[hidden] { display: none; }
.cg-help { position: absolute; left: 0; right: 0; top: calc(100% + 0.4rem); z-index: 8; background: var(--panel); border: 1px solid var(--accent); border-radius: 12px; padding: 0.8rem 1rem; box-shadow: 0 24px 60px -20px var(--shadow); font-size: 0.9rem; }
.cg-help[hidden] { display: none; }
.cg-help p { margin: 0; line-height: 1.9; }
.cg-help code { white-space: nowrap; }
.cg-views { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.cg-views[hidden] { display: none; }
.cg-views button { font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--muted); background: var(--panel); border: 0; padding: 0.5rem 0.75rem; cursor: pointer; }
.cg-views button + button { border-left: 1px solid var(--line); }
.cg-views button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.cg-views button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.cg-bar { display: flex; align-items: center; gap: 0.4rem 1rem; margin-top: 0.55rem; }
.cg-chips { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent); }
.cg-chips ul::after { content: ""; flex: none; width: 1.5rem; }
.cg-chips ul { list-style: none; margin: 0; padding: 2px; display: flex; gap: 0.35rem; }
.cg-chip { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 999px; padding: 0.25rem 0.75rem; font-weight: 700; font-size: 0.86rem; text-decoration: none; }
.cg-chip span { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
.cg-chip:hover { border-color: var(--accent); color: var(--text); }
.cg-chip[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cg-chip[aria-current] span { color: var(--accent-ink); }
.cg-chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.cg-count { margin: 0; white-space: nowrap; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 0.88rem; color: var(--muted); }
#cg-count { font-weight: 700; color: var(--text); }
.cg-showing { margin-left: 0.6rem; }

/* The list: one row per app, a fixed height. The table head and the columns match. */
.cg-results { padding-block: 0.25rem 2rem; }
.cg-list { list-style: none; margin: 0; padding: 0; --rh: 42px; }
.cg-virt { position: relative; contain: layout; }
.cg-virt > .cg-r { position: absolute; left: 0; right: 0; }
.cg-th, .cg-r { display: grid; grid-template-columns: 28px minmax(0, 1fr) 8.5rem 7.5rem 6.5rem 17.5rem; gap: 0 1rem; align-items: center; padding: 0 0.75rem; }
.cg-th { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 800; color: var(--muted); padding-block: 0.45rem; border-bottom: 1px solid var(--line); }
.cg-r { position: relative; height: var(--rh); border-bottom: 1px solid var(--line); overflow: hidden; }
.cg-r:hover { background: var(--panel); box-shadow: inset 3px 0 0 var(--c1); }
.cg-a { display: flex; align-items: baseline; gap: 0.7rem; min-width: 0; white-space: nowrap; }
.cg-n { flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; font-weight: 700; color: var(--text); text-decoration: none; }
.cg-n::after { content: ""; position: absolute; inset: 0; }
.cg-n:hover { color: var(--accent-hover); }
.cg-n:focus-visible { outline: none; }
.cg-r:has(.cg-n:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; background: var(--panel); }
.cg-s { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 0.92rem; }
.cg-c, .cg-v, .cg-ver { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cg-ver { font: 600 0.8rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--muted); }
.cg-i { display: flex; align-items: center; gap: 0.4rem; min-width: 0; position: relative; z-index: 1; }
.cg-i code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; background: none; border: 0; padding: 0; color: var(--muted); }
.cg-cp { flex: none; font: inherit; font-size: 0.78rem; font-weight: 700; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 0.2rem 0.55rem; cursor: pointer; }
.cg-cp:hover { border-color: var(--accent); }
.cg-cp:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.cg-cp[hidden] { display: none; }
.cg-r.cg-pend .cg-s::before { content: "\2026"; }
.cg-badge, .cg-needs, .cg-pill { display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.03em; padding: 0.1rem 0.5rem; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.cg-badge.v-tested { color: var(--ok); background: var(--ok-bg); }
.cg-badge.v-partial { color: var(--exp); background: var(--exp-bg); }
.cg-badge.v-untested { color: var(--muted); background: var(--panel-2); }
.cg-badge::before { content: ""; display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%; margin-right: 0.4em; vertical-align: 0.08em; background: currentColor; }
.cg-badge.v-partial::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px currentColor; }
.cg-badge.v-untested::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.cg-needs { color: var(--plan); background: var(--plan-bg); }
.cg-pill { white-space: normal; overflow-wrap: anywhere; color: var(--muted); border: 1px solid var(--line); font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; letter-spacing: 0; }
.cg-r .chip { font-size: 0.68rem; }
.cg-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin: 0; }
mark { background: var(--exp-bg); color: inherit; border-radius: 3px; box-shadow: 0 0 0 1px var(--exp-bg); }

/* The compact grid (JavaScript only): the same rows as cards of a fixed height, placed by catalog.v2.js. */
.cg-grid .cg-th { display: none; }
.cg-grid .cg-results { padding-top: 0.75rem; }
.cg-grid .cg-list { --rh: 150px; }
.cg-grid .cg-r { height: calc(var(--rh) - 12px); grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "t a a" "c c v" "i i i"; gap: 0.35rem 0.75rem; align-content: center; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.cg-grid .cg-r .cg-tile { grid-area: t; width: 40px; height: 40px; border-radius: 11px; }
.cg-grid .cg-r .cg-tile .gl { width: 22px; height: 22px; }
.cg-grid .cg-a { grid-area: a; flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.cg-grid .cg-n { max-width: 100%; }
.cg-grid .cg-s { width: 100%; }
.cg-grid .cg-c { grid-area: c; }
.cg-grid .cg-v { grid-area: v; }
.cg-grid .cg-ver { display: none; }
.cg-grid .cg-i { grid-area: i; }

/* Pages without JavaScript, the empty state, the about section. */
.cg-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; margin-top: 1.5rem; }
.cg-pager ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; }
.cg-pager a { display: inline-block; min-width: 2.2rem; text-align: center; padding: 0.35rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-decoration: none; font-weight: 700; }
.cg-pager a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cg-js .cg-pager { display: none; }
.cg-empty { text-align: center; border: 1px dashed var(--line); border-radius: 18px; padding: 2rem 1.25rem; margin-top: 1rem; }
.cg-empty h2 { font-size: 1.4rem; }
.cg-empty[hidden] { display: none; }
.cg-cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
.cg-cols2 h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }

@media (max-width: 1100px) {
  .cg-th, .cg-r { grid-template-columns: 28px minmax(0, 1fr) 8rem 7.5rem 6rem 4rem; }
  .cg-i code { display: none; }
  .cg-th span:last-child { visibility: hidden; }
}
@media (max-width: 760px) {
  .cg-band { padding-block: 0.5rem 0.45rem; }
  .cg-h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .cg-q input { height: 2.75rem; font-size: 1rem; padding-right: 2.9rem; }
  .cg-kbd { display: none; }
  .cg-views button { padding: 0.45rem 0.55rem; font-size: 0.8rem; }
  .cg-bar { flex-wrap: wrap; margin-top: 0.45rem; }
  .cg-chips { flex-basis: 100%; }
  .cg-count { font-size: 0.82rem; }
  .cg-th { display: none; }
  .cg-list { --rh: 64px; }
  .cg-r { grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: "t a v"; gap: 0 0.75rem; padding: 0 0.25rem; }
  .cg-r .cg-tile { width: 36px; height: 36px; border-radius: 10px; }
  .cg-r .cg-tile .gl { width: 20px; height: 20px; }
  .cg-a { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .cg-n { max-width: 100%; }
  .cg-s { width: 100%; font-size: 0.86rem; }
  .cg-c, .cg-ver, .cg-i { display: none; }
  .cg-grid .cg-list { --rh: 150px; }
  .cg-grid .cg-r { grid-template-areas: "t a a" "c c v" "i i i"; padding: 0.7rem 0.9rem; }
  .cg-grid .cg-c, .cg-grid .cg-i { display: flex; }
  .cg-grid .cg-i code { display: block; }
  .cg-cols2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .cg-r { transition: background-color 0.12s ease, box-shadow 0.12s ease; }
}
@media print {
  .cg-band, .cg-cp { display: none; }
}

/* An app's page. */
.cg-app-hero { padding-block: 1.5rem 2.25rem; border-bottom: 1px solid var(--line); background: radial-gradient(ellipse 55% 90% at 8% 0, color-mix(in srgb, var(--c1) 16%, transparent), transparent 70%), radial-gradient(ellipse 40% 70% at 95% 20%, var(--glow), transparent 70%); }
.cg-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0; margin: 0 0 1.5rem; font-size: 0.9rem; color: var(--muted); }
.cg-crumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--line); }
.cg-app-head { display: flex; gap: 1.6rem; align-items: center; }
.cg-app-head > div { min-width: 0; }
.cg-app-head h1 { font-size: clamp(2.3rem, 5.4vw, 3.8rem); margin-bottom: 0.25rem; overflow-wrap: anywhere; }
.cg-app-head .lead { margin: 0 0 0.8rem; }
.cg-install { margin-top: 1.6rem; max-width: 50rem; }
.cg-cmd { display: flex; gap: 0.5rem; align-items: stretch; }
.cg-cmd code.cmd { flex: 1; min-width: 0; font-size: 1rem; padding: 0.75rem 1rem; display: flex; align-items: center; }
.cg-cmd code.cmd::before { margin-right: 0.5em; }
.cg-copy { flex: none; }
.cg-copy[hidden] { display: none; }
.cg-install p { font-size: 0.95rem; margin: 0.7rem 0 0; }
.cg-cols { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.5rem; padding-block: 2.5rem 1rem; }
.cg-main > section { margin-bottom: 2.75rem; }
.cg-main h2, .cg-related h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); }
.cg-side h2 { font-size: 1.2rem; }
.cg-gets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cg-get { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.05rem 1.2rem; min-width: 0; }
.cg-get.wide { grid-column: 1 / -1; }
.cg-get h3 { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem; }
.cg-get ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.cg-get li { display: flex; flex-wrap: wrap; gap: 0.1rem 0.45rem; align-items: baseline; min-width: 0; }
.cg-get li > span { flex-basis: 100%; color: var(--muted); font-size: 0.92rem; }
.cg-get p { margin: 0 0 0.5rem; }
.cg-get code, .cg-facts-dl code, .cg-notes code, .cg-long summary code { min-width: 0; overflow-wrap: anywhere; }
.cg-notes, .cg-get { overflow-wrap: anywhere; }
.cg-get li > .cg-flag { flex-basis: auto; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--impl); background: var(--impl-bg); border-radius: 999px; padding: 0 0.45rem; }
.cg-steps { margin: 0; padding-left: 1.4rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem; }
.cg-steps li { display: list-item; }
.cg-long summary { list-style: none; cursor: pointer; display: flex; gap: 0.4rem; align-items: center; }
.cg-long summary::-webkit-details-marker { display: none; }
.cg-long summary .chev { flex: none; color: var(--muted); }
.cg-long[open] summary .chev { transform: rotate(180deg); }
.cg-pre { margin: 0.6rem 0; background: var(--term-bg); color: var(--term-text); border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem 0.95rem; font-size: 0.84rem; line-height: 1.55; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.cg-notes { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem 1.4rem; }
.cg-notes > :last-child { margin-bottom: 0; }
.cg-notes ol, .cg-notes ul { padding-left: 1.4rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
.cg-notes li::marker { color: var(--accent); font-weight: 800; }
.cg-box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem 1.4rem; }
.cg-box > :last-child { margin-bottom: 0; }
.cg-main .cg-box { border-color: color-mix(in srgb, var(--c1) 45%, var(--line)); }
.cg-box code.cmd { margin: 0.4rem 0 0.6rem; }
.cg-needbox { border-left: 3px solid var(--c1); padding: 0.1rem 0 0.1rem 1rem; margin: 1.2rem 0; }
.cg-needbox h3 { font-size: 1.1rem; margin-bottom: 0.35rem; }
.cg-side { display: grid; gap: 1rem; align-content: start; }
.cg-facts-dl { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 0.3rem 1.2rem; }
.cg-facts-dl > div { display: grid; grid-template-columns: 6.6rem minmax(0, 1fr); gap: 0.6rem; padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
.cg-facts-dl > div:last-child { border-bottom: 0; }
.cg-facts-dl dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 800; color: var(--muted); padding-top: 0.2rem; }
.cg-facts-dl dd { margin: 0; min-width: 0; font-size: 0.93rem; overflow-wrap: anywhere; }
.cg-facts-dl ul { list-style: none; margin: 0; padding: 0; }
.cg-ver h2 { margin-bottom: 0.5rem; }
.cg-ver .cg-badge { font-size: 0.85rem; }
.cg-ver.v-tested { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.cg-ver.v-partial { border-color: color-mix(in srgb, var(--exp) 45%, var(--line)); }
.cg-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0 2.5rem; }
.cg-pn a { display: flex; flex-direction: column; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1rem; min-width: 0; }
.cg-pn a span { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cg-pn a[rel="next"] { text-align: right; }
.cg-pn a:hover { border-color: var(--accent); color: var(--text); }
.cg-related .cg-list { margin-top: 0.5rem; }
.cg-related { border-top: 1px solid var(--line); background: var(--bg-2); }
@media (max-width: 900px) {
  .cg-cols { grid-template-columns: minmax(0, 1fr); }
  .cg-gets { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cg-app-head { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .cg-app-head .cg-tile.xl { width: 80px; height: 80px; border-radius: 22px; }
  .cg-app-head .cg-tile.xl .gl { width: 44px; height: 44px; }
  .cg-cmd { flex-direction: column; }
  .cg-cmd .btn { width: auto; align-self: flex-start; }
  .cg-pn { grid-template-columns: 1fr; }
  .cg-pn a[rel="next"] { text-align: left; }
  .cg-facts-dl > div { grid-template-columns: 1fr; gap: 0.15rem; }
}
