/* cheatsheets.css — Cheat Sheets section (index list + single-sheet view).
   Reuses the site tokens (--ink, --ink-muted, --ink-faint, --cream,
   --cream-darker, --red, --font-mono) so it matches the Glossary. */

/* ── Hero ── */
.cs-hero .sub-line { font-size: 0.8rem; color: var(--ink-faint); max-width: 64ch; margin: 0 auto; }
.cs-hero .sub-line a { color: var(--red); }

/* ── Index: filter ── */
.cs-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem 1rem; align-items: center; margin: 1.2rem 0 1.4rem; }
.cs-label { grid-column: 1 / -1; font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cs-filter { width: 100%; padding: 0.6rem 0.8rem; font-family: var(--font-mono); font-size: 0.9rem; background: var(--cream); color: var(--ink); border: 1px solid var(--cream-darker); border-radius: 6px; }
.cs-filter:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
.cs-count { grid-column: 1 / -1; margin: 0; font-size: 0.78rem; color: var(--ink-muted); }

/* ── Index: list ── */
.cs-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.6rem; }
.cs-item[hidden] { display: none; }
.cs-link { display: flex; flex-direction: column; gap: 0.15rem; min-height: 48px; padding: 0.7rem 0.85rem; background: var(--bg-card, var(--cream)); border: 1px solid var(--cream-darker); border-radius: 8px; text-decoration: none; color: var(--ink); transition: border-color 0.12s ease, transform 0.12s ease; }
.cs-link:hover, .cs-link:focus-visible { border-color: var(--red); transform: translateY(-1px); outline: none; }
.cs-link:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.cs-link-title { font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.cs-link-slug { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-muted); }
.cs-empty { margin: 1.5rem 0; font-size: 0.9rem; color: var(--ink-muted); }

/* ── Single sheet view ── */
.cs-view { max-width: 900px; }
.cs-back { margin: 0 0 0.6rem; font-size: 0.82rem; }
.cs-back a { color: var(--red); text-decoration: none; }
.cs-back a:hover { text-decoration: underline; }
.cs-view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cs-copy { flex: 0 0 auto; }
.cs-meta { margin: 0.2rem 0 1rem; font-size: 0.8rem; color: var(--ink-muted); }
.cs-sheet { margin: 0; padding: 1rem 1.1rem; background: var(--code-bg, var(--cream)); color: var(--code-ink, var(--ink)); border: 1px solid var(--cream-darker); border-radius: 8px; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; overflow-x: auto; tab-size: 4; }
.cs-sheet:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.cs-foot-note { margin: 1rem 0 0; font-size: 0.78rem; color: var(--ink-faint); }
.cs-foot-note a { color: var(--red); }

/* On this page (table of contents) */
.cs-toc { margin: 0 0 1.2rem; padding: 0.8rem 1rem; background: var(--bg-card, var(--cream)); border: 1px solid var(--cream-darker); border-radius: 8px; }
.cs-toc-title { margin: 0 0 0.5rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted); }
.cs-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.cs-toc li { margin: 0; }
.cs-toc a { font-size: 0.8rem; color: var(--red); text-decoration: none; }
.cs-toc a:hover, .cs-toc a:focus-visible { text-decoration: underline; }

/* Sectioned body */
.cs-body { display: flex; flex-direction: column; gap: 1.2rem; }
.cs-section { scroll-margin-top: 5rem; }
.cs-h { margin: 0 0 0.4rem; font-size: 0.95rem; letter-spacing: 0.02em; scroll-margin-top: 5rem; }
.cs-anchor { margin-left: 0.4rem; color: var(--ink-faint); text-decoration: none; font-weight: 400; opacity: 0.35; transition: opacity 0.12s ease; }
.cs-h:hover .cs-anchor, .cs-h:focus-within .cs-anchor, .cs-anchor:focus-visible { opacity: 1; }
@media (hover: hover) { .cs-anchor { opacity: 0; } }
.cs-anchor:hover { color: var(--red); }
.cs-h:target { color: var(--red); }

@media (max-width: 480px) {
    .cs-list { grid-template-columns: 1fr; }
    .cs-sheet { font-size: 0.78rem; padding: 0.85rem 0.7rem; }
}

@media print {
    .cs-back, .cs-copy, .cs-foot-note { display: none; }
    .cs-sheet { border: none; padding: 0; white-space: pre-wrap; }
}
