/* One-page reference sheets: Module1-SQL/sql-cheat-sheet.md and
   Module2-Systems/io-cheat-sheet.md, opened with r (shared/refcard.js).

   The markdown builder wraps each run of inline spans inside these divs in a <p>.
   Left alone, that <p> becomes the grid's only child and every row collapses into
   the first column. The :is(...)>p rules dissolve it (display:contents) so the spans
   are the grid cells, and they outrank the site's body[data-module] .v5-article p,
   which would otherwise set the rows in the sans face. */

.cs-tag{display:inline-flex;align-items:center;justify-content:center;min-width:1.15rem;height:1.15rem;padding:0 .25rem;border-radius:4px;background:#FEF3C7;color:#92400E;font:600 .72rem/1 var(--v5-sans);vertical-align:1px}
.cs-legend{display:flex;flex-wrap:wrap;gap:.4rem 1.4rem;font-size:.92rem;color:var(--v5-text);margin:.4rem 0 1.6rem}

/* one query, each clause numbered by run order */
.cs-q{border:1px solid var(--v5-hairline-2);border-radius:8px;overflow:hidden;margin:1rem 0 .9rem;background:var(--v5-surface)}
.cs-ql{display:grid;grid-template-columns:2rem minmax(0,1fr) 12.5rem;gap:.75rem;align-items:center;padding:.42rem .95rem;border-top:1px solid var(--v5-hairline);font:.88rem/1.4 var(--v5-mono);color:var(--v5-ink)}
.cs-ql:first-child{border-top:0}
.cs-n{display:inline-flex;width:1.45rem;height:1.45rem;border-radius:50%;align-items:center;justify-content:center;background:var(--m1-tint);color:var(--m1);font:600 .78rem/1 var(--v5-sans)}
.cs-cnt{text-align:right;color:var(--v5-muted);font-size:.8rem}
.cs-notes{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:.9rem;font-size:.92rem;color:var(--v5-text);margin:0 0 1.6rem;line-height:1.5}

/* query -> result -> tag rows, in columns */
.cs-res{display:grid;grid-template-columns:repeat(auto-fit,minmax(19.5rem,1fr));gap:1.5rem;margin:1rem 0 1.2rem}
.cs-res h4{font:600 .7rem/1.3 var(--v5-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--v5-muted);margin:0 0 .45rem}
.cs-r{display:grid;grid-template-columns:minmax(0,1fr) auto 1.3rem;gap:.6rem;align-items:center;padding:.32rem 0;border-bottom:1px solid var(--v5-hairline);font:.84rem/1.35 var(--v5-mono);color:var(--v5-ink)}
.cs-r span:nth-child(2){color:var(--v5-text)}

/* trap cards: query, what Postgres returns, the fix */
.cs-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:.85rem;margin:.6rem 0 1.5rem}
.cs-cd{border:1px solid var(--v5-hairline-2);border-radius:8px;padding:.8rem .9rem;font-size:.86rem;line-height:1.45;background:var(--v5-surface)}
.cs-code{font:.8rem/1.45 var(--v5-mono);color:var(--v5-ink);white-space:pre-wrap;margin:0}
.cs-got{margin-top:.55rem;font:.8rem/1.4 var(--v5-mono);color:#92400E}
.cs-fix{margin-top:.4rem;color:var(--v5-text)}

body[data-module] .v5-article :is(.cs-ql,.cs-r,.cs-legend,.cs-notes,.cs-cd)>p{display:contents;font:inherit;color:inherit}
body[data-module] .v5-article :is(.cs-got,.cs-fix)>p{margin:0;font:inherit;color:inherit}

@media (max-width:640px){
  .cs-ql{grid-template-columns:2rem minmax(0,1fr)}
  .cs-cnt{grid-column:2;text-align:left}
}
