/* ==========================================================================
   Commands v2 (/cmds/v2) — built on Skynet UI (https://skynetui.com)

   Page-local layout only. Components come from skynet-ui.css, palettes from
   themes-v2.css, and every colour below is a Skynet UI token so the page
   follows whichever of the twelve palettes the reader picked.
   ========================================================================== */

/* Skynet UI declares `.hidden` before its component display rules, and every
   `display` rule in this file is a class selector — which ties with `[hidden]`
   on specificity and then wins on order. Both guards, up front. */
.cv2 .hidden { display: none !important; }
.cv2 [hidden] { display: none !important; }

.cv2-main { padding-bottom: 4rem; }

/* ---------- hero ---------- */
.cv2-hero {
  position: relative;
  border-bottom: 1px solid var(--sk-border);
  background:
    radial-gradient(110% 130% at 8% 0%,
      color-mix(in srgb, var(--sk-primary) 22%, transparent) 0%,
      color-mix(in srgb, var(--sk-primary) 6%, transparent) 45%,
      transparent 70%),
    var(--sk-surface);
}
.cv2-hero-inner {
  display: grid;
  gap: 1.5rem;
  padding-top: 2.25rem;
  padding-bottom: 1.75rem;
}
@media (min-width: 900px) {
  .cv2-hero-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 2.5rem;
  }
}
.cv2-hero-copy { min-width: 0; }
.cv2-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sk-primary-text);
}
.cv2-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.cv2-lede {
  max-width: 56ch;
  margin: 0 0 0.75rem;
  color: var(--sk-text-2);
  line-height: 1.6;
}
.cv2-platforms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.9rem;
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--sk-text-2);
}
.cv2-platforms span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.cv2-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.cv2-figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
  gap: 0.75rem;
  margin: 0;
}
/* The hero's second column is sized by its content, so `auto-fit` gives the
   tiles one column and stacks them. Above the split they go in a row. */
@media (min-width: 900px) {
  .cv2-figs { grid-auto-flow: column; grid-template-columns: none; }
  .cv2-fig { min-width: 7.5rem; }
}
.cv2-fig {
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--sk-border);
  border-radius: var(--sk-radius);
  background: var(--sk-surface-2);
}
.cv2-fig dt {
  margin: 0;
  color: var(--sk-text-2);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.cv2-fig dd {
  margin: 0.15rem 0 0;
  font-size: clamp(1.15rem, 0.9rem + 0.8vw, 1.5rem);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

/* ---------- body ---------- */
.cv2-body { padding-top: 1.5rem; }
.cv2-outage { margin-bottom: 1.5rem; }
.cv2-empty { padding: 3rem 1rem; }

/* ---------- toolbar ---------- */
/* Sticky under the 60px site header, so the search box is always one keystroke
   away however far down the reference you are. */
.cv2-toolbar {
  position: sticky;
  top: 60px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1.5rem;
  padding: 0.85rem 0;
  background: var(--sk-bg);
  border-bottom: 1px solid var(--sk-border);
}
body.has-partnership-widget .cv2-toolbar { top: 104px; }
@media (max-width: 640px) {
  body.has-partnership-widget .cv2-toolbar { top: 100px; }
}
.cv2-search {
  flex: 1 1 18rem;
  min-width: 0;
}
.cv2-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* ---------- results bar ---------- */
.cv2-result-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}
.cv2-count {
  margin: 0;
  color: var(--sk-text-2);
  font-size: 0.9rem;
}
.cv2-count b { color: var(--sk-text); font-variant-numeric: tabular-nums; }
.cv2-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.cv2-chips .sk-chip { max-width: 16rem; overflow-wrap: anywhere; }
.cv2-chip-x {
  margin-left: 0.35rem;
  padding: 0 0.15rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  opacity: 0.7;
}
.cv2-chip-x:hover { opacity: 1; }
.cv2-clear-all {
  font-size: 0.82rem;
  color: var(--sk-primary-text);
}
.cv2-go-label { margin-left: 0.35rem; }
@media (max-width: 520px) {
  .cv2-go-label { display: none; }
}

/* ---------- two columns ---------- */
.cv2-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (min-width: 1024px) {
  .cv2-cols {
    grid-template-columns: 16rem minmax(0, 1fr);
    /* `auto 1fr`, or the list spanning both rows splits its height between
       them and the extras float halfway down the left column. */
    grid-template-rows: auto 1fr;
    gap: 0 2rem;
  }
  /* The module nav, the list and the supplementary cards are three siblings in
     source order (nav, list, extras) so a phone gets the commands first. Above
     this width the extras go back under the nav, in the left column, with the
     list spanning both rows beside them. */
  /* `align-self: start`, or the grid stretches the nav down its whole row and
     the extras below it start level with nothing in particular. */
  .cv2-side { grid-column: 1; grid-row: 1; align-self: start; }
  .cv2-list { grid-column: 2; grid-row: 1 / span 2; }
  .cv2-extra { grid-column: 1; grid-row: 2; align-self: start; }
}
.cv2-extra { min-width: 0; }
.cv2-side { min-width: 0; }
@media (min-width: 1024px) {
  .cv2-side {
    position: sticky;
    /* The header (60px) plus the toolbar's own height, so the module list
       docks under it rather than behind it. */
    top: 8.5rem;
    max-height: calc(100vh - 9.5rem);
    overflow-y: auto;
    padding-right: 0.25rem;
  }
}

/* The module list is a horizontal strip on phones — a 20-item vertical nav
   above the content is a scroll wall on the way to the first command. */
.cv2-modnav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
}
.cv2-modnav a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--sk-border);
  border-radius: 999px;
  background: var(--sk-surface);
  color: var(--sk-text-2);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.cv2-modnav a:hover { color: var(--sk-text); border-color: var(--sk-border-2); }
.cv2-modnav a.active {
  color: var(--sk-text);
  border-color: color-mix(in srgb, var(--sk-primary) 55%, transparent);
  background: var(--sk-primary-soft);
}
.cv2-modnav-name { text-transform: capitalize; }
.cv2-modnav-count {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1024px) {
  .cv2-modnav {
    display: grid;
    gap: 0.15rem;
    overflow: visible;
    margin-bottom: 1.25rem;
  }
  .cv2-modnav a {
    border: 0;
    border-radius: var(--sk-radius-sm);
    background: none;
    padding: 0.5rem 0.65rem;
  }
  .cv2-modnav a.active { background: var(--sk-primary-soft); }
  .cv2-modnav a:hover { background: var(--sk-surface-2); }
  .cv2-modnav-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
}

/* Skynet's bar row is label | track | value in one line, which leaves a
   command name and its bar fighting over a 16rem column. Here the name gets
   its own line and the bar the full width under it. */
.cv2-top { margin-top: 1.25rem; }
@media (min-width: 1024px) { .cv2-top { margin-top: 0; } }
.cv2-top .sk-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.5rem;
}
.cv2-top .sk-bar-label {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv2-top .sk-bar-label code {
  font-size: 0.78rem;
  white-space: nowrap;
}
.cv2-top .sk-bar-value { font-variant-numeric: tabular-nums; }
.cv2-admin-note { margin-top: 1rem; }

/* ---------- modules ---------- */
.cv2-list { min-width: 0; }
.cv2-module {
  margin-bottom: 2.5rem;
  /* Anchor jumps land under the fixed header and the sticky toolbar. */
  scroll-margin-top: 9rem;
}
.cv2-module-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--sk-border);
}
.cv2-module-head h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}
.cv2-module-head h2 i { color: var(--sk-primary-text); }
/* The heading is a link to that module on its own — the same view the sidebar
   gives, from where you are reading. */
.cv2-module-head h2 a { color: inherit; text-decoration: none; }
.cv2-module-head h2 a:hover { text-decoration: underline; }
.cv2-module-count {
  color: var(--sk-muted);
  font-size: 0.82rem;
}

/* ---------- one command ---------- */
.cv2-cmds {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* Two commands to a row once the column can hold them: thirty in one column is
   seven screens of scrolling, and a reference is read by scanning. The cards
   are different heights, so they sit at the top of their row rather than
   stretching to match. */
@media (min-width: 1280px) {
  .cv2-cmds {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}
.cv2-cmd {
  min-width: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--sk-border);
  border-radius: var(--sk-radius);
  background: var(--sk-surface);
}
.cv2-cmd:hover { border-color: var(--sk-border-2); }
.cv2-cmd.is-hidden-cmd {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--sk-danger) 45%, var(--sk-border));
}
.cv2-cmd-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.cv2-sig {
  flex: 1;
  min-width: 0;
  font-family: "JetBrains Mono", var(--sk-font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sk-text);
  overflow-wrap: anywhere;
}
.cv2-copy { flex: none; }
.cv2-copy-label { margin-left: 0.35rem; }
/* Below this the signature needs every pixel; the icon still says "copy". */
@media (max-width: 480px) {
  .cv2-copy-label { display: none; }
}
.cv2-desc {
  margin: 0.5rem 0 0;
  color: var(--sk-text-2);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.cv2-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.cv2-tags .sk-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.cv2-uses {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--sk-muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.cv2-argbox {
  margin-top: 0.75rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--sk-border);
}
.cv2-argbox > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  color: var(--sk-text-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.cv2-argbox > summary::-webkit-details-marker { display: none; }
.cv2-argbox > summary::before {
  content: "▸";
  color: var(--sk-muted);
  transition: transform var(--sk-transition);
}
.cv2-argbox[open] > summary::before { content: "▾"; }
.cv2-argbox > summary:hover { color: var(--sk-text); }
@media (pointer: coarse) {
  .cv2-argbox > summary { min-height: 44px; }
}
.cv2-args {
  display: grid;
  gap: 0.35rem;
  margin: 0.4rem 0 0.2rem;
}
.cv2-arg {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
}
@media (min-width: 640px) {
  .cv2-arg { grid-template-columns: 9rem minmax(0, 1fr); gap: 0.75rem; align-items: baseline; }
}
.cv2-arg dt {
  margin: 0;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}
.cv2-arg dt code {
  font-family: "JetBrains Mono", var(--sk-font-mono);
  color: var(--sk-primary-text);
}
.cv2-req {
  margin-left: 0.15rem;
  color: var(--sk-danger-text);
  font-weight: 700;
}
.cv2-arg dd {
  margin: 0;
  color: var(--sk-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cv2-admin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--sk-border);
}
.cv2-visibility { flex: none; }
.cv2-hide-reason {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--sk-muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.cv2-noresults { padding: 3rem 1rem; }

/* ---------- pagination ---------- */
.cv2-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 2rem;
}
/* Skynet UI's pagination is sized for a mouse; these are the page's main
   navigation once there is more than one page of commands. */
.cv2-pages a,
.cv2-pages span {
  min-width: 2.5rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.cv2-gap {
  color: var(--sk-muted);
  pointer-events: none;
}
.cv2-page-note {
  margin: 0.6rem 0 0;
  text-align: center;
  color: var(--sk-muted);
  font-size: 0.8rem;
}

/* ---------- back to top ---------- */
.cv2-totop {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  box-shadow: var(--sk-shadow-lg);
}

/* ---------- touch ---------- */
/* Skynet UI sizes its controls for a mouse (.sk-btn 39px, .sk-btn-sm 30px,
   inputs 37px at a sub-16px face). On a touch screen these are the page's real
   controls, and 16px on the field is what stops iOS zooming the page on
   focus. */
@media (pointer: coarse) {
  .cv2 .sk-btn,
  .cv2 .sk-btn-sm { min-height: 44px; }
  .cv2 .sk-input { min-height: 44px; font-size: 16px; }
  .cv2-pages a,
  .cv2-pages span { min-width: 44px; min-height: 44px; }
}

/* ---------- print ---------- */
/* A command reference is a thing people print or PDF. Drop the chrome. */
@media print {
  .cv2-toolbar,
  .cv2-side,
  .cv2-pages,
  .cv2-totop,
  .cv2-hero-actions,
  .sk-footer { display: none !important; }
  .cv2-cols { display: block; }
  .cv2-cmd { break-inside: avoid; }
}
