/* Modern CLI Tools cheatsheet — house style (Vigod Labs network)
   Dark-first, GitHub-dark palette, JetBrains Mono for code. */

:root {
  --bg: #0f1117;
  --surface: #161b22;
  --surface-2: #1c2230;
  --border: #2a3140;
  --text: #e6edf3;
  --text-dim: #9aa7b8;
  --accent: #2dd4bf;        /* teal — distinct from sibling sites */
  --accent-soft: rgba(45, 212, 191, 0.14);
  --cmd: #e3b341;           /* amber for commands */
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.13);
  --success: #3fb950;
  --mark: rgba(45, 212, 191, 0.32);
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", ui-monospace, SFMono-Regular, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --maxw: 1280px;
  --lk-bg: #0a0c12;
  --lk-fg: #e6edf3;
  --lk-dim: #8b94a3;
  --lk-border: rgba(255,255,255,.07);
}

html[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --border: #d6dde6;
  --text: #1c2128;
  --text-dim: #57606a;
  --accent: #0d9488;
  --accent-soft: rgba(13, 148, 136, 0.12);
  --cmd: #9a6700;
  --danger: #cf222e;
  --danger-soft: rgba(207, 34, 46, 0.10);
  --success: #1a7f37;
  --mark: rgba(13, 148, 136, 0.22);
  --lk-bg: #e9eef3;
  --lk-fg: #1c2128;
  --lk-dim: #57606a;
  --lk-border: rgba(0,0,0,.09);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, .mono { font-family: var(--mono); }

/* ---------- linuxkernel.com brand strip (network continuity; non-sticky, scrolls away) ---------- */
.lk-strip {
  display: flex; align-items: center; gap: 16px;
  padding: 7px 22px;
  background: var(--lk-bg);
  border-bottom: 1px solid var(--lk-border);
  font-size: .8rem;
}
.lk-strip .lk-home { color: var(--lk-fg); font-weight: 600; }
.lk-strip .lk-home:hover { color: var(--accent); text-decoration: none; }
.lk-links { display: flex; gap: 16px; }
.lk-links a { color: var(--lk-dim); }
.lk-links a:hover { color: var(--lk-fg); text-decoration: none; }
@media (max-width: 640px) { .lk-links { display: none; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 700px) 1fr;  /* brand | wide centered search | controls */
  align-items: center;
  gap: 16px;
}
.brand {
  font-family: var(--mono); font-weight: 700; font-size: 1.02rem;
  color: var(--text); white-space: nowrap;
}
.brand .br-accent { color: var(--accent); }
.brand:hover { text-decoration: none; opacity: .85; }
.brand { justify-self: start; }

.search-wrap { position: relative; justify-self: center; width: 100%; max-width: 700px; }
#search {
  width: 100%; padding: 9px 34px 9px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--mono); font-size: .9rem; outline: none;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: none; background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 1rem; padding: 4px;
}
#search-clear.show { display: block; }

.header-nav { display: flex; align-items: center; gap: 12px; justify-self: end; }
.header-nav a { color: var(--text-dim); font-size: .88rem; white-space: nowrap; }
.header-nav a:hover { color: var(--text); }
#theme-toggle {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 999px; cursor: pointer; font-size: 1rem;
  display: grid; place-items: center;
}
#theme-toggle:hover { border-color: var(--accent); }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: clamp(20px, 4vw, 40px); }

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 0 0 6px; }
.replaces {
  display: inline-block; font-size: .82rem; color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.replaces code { color: var(--cmd); }
.lede { color: var(--text-dim); max-width: 70ch; margin: 6px 0 0; }
.meta-note { color: var(--text-dim); font-size: .82rem; margin-top: 8px; }

#count { color: var(--text-dim); font-size: .85rem; margin: 0 0 16px; min-height: 1.2em; }
#count.none { color: var(--danger); }

/* ---------- card grid ---------- */
/* masonry via CSS columns — evens out tall/short cards, no big gaps.
   Cards flow to balance column heights (column-fill: balance is the default). */
.card-grid {
  column-width: 340px;
  column-gap: 16px;
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin: 0 0 16px;          /* column-gap handles horizontal; margin handles vertical */
  width: 100%;
}
.card.hidden { display: none; }
.card-title {
  margin: 0; padding: 11px 16px; font-size: .82rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.cmd-table { width: 100%; border-collapse: collapse; }
.cmd-row { border-top: 1px solid var(--border); cursor: pointer; }
.cmd-row:first-child { border-top: none; }
.cmd-row:hover { background: var(--accent-soft); }
.cmd-row.hidden { display: none; }
.cmd-row td { padding: 9px 16px; vertical-align: top; font-size: .88rem; }
.cmd-row .cmd { width: 42%; }
.cmd-code { color: var(--cmd); font-family: var(--mono); word-break: break-word; }
.copyable {
  color: var(--cmd); cursor: pointer; position: relative;
  border-radius: 5px; padding: 1px 3px; word-break: break-word;
}
.copyable:hover { background: var(--accent-soft); }
.copyable.copied { color: var(--success); }
.desc { color: var(--text-dim); }
.desc .arg { color: var(--cmd); font-style: italic; font-family: var(--mono); }
.example {
  display: block; margin-top: 4px; font-family: var(--mono);
  font-size: .8rem; color: var(--text); opacity: .7;
}
.example::before { content: "↳ "; color: var(--accent); }

/* danger rows */
.cmd-row.danger .cmd { background: var(--danger-soft); }
.danger-badge {
  display: inline-block; margin-left: 6px; color: var(--danger);
  font-size: .72rem; font-weight: 700; cursor: help;
}

mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- hub: old->new mapping ---------- */
.mapping {
  width: 100%; border-collapse: collapse; margin: 8px 0 32px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.mapping th, .mapping td { padding: 11px 16px; text-align: left; font-size: .9rem; border-top: 1px solid var(--border); }
.mapping thead th { background: var(--surface-2); color: var(--text-dim); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; border-top: none; }
.mapping .old code { color: var(--text-dim); text-decoration: line-through; }
.mapping .new a { color: var(--cmd); font-family: var(--mono); font-weight: 600; }

/* hub tool cards — centered flex so the last row centers (no orphan) */
.tool-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.tool-card {
  flex: 0 1 300px;          /* fixed-ish width, no grow → 3 per row on desktop, 5 = 3 + 2 centered */
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.tool-card h3 { margin: 0 0 4px; font-family: var(--mono); color: var(--accent); font-size: 1.15rem; }
.tool-card .repl { color: var(--text-dim); font-size: .8rem; font-family: var(--mono); }
.tool-card p { margin: 8px 0 0; color: var(--text-dim); font-size: .86rem; }

/* ---------- recipes / notes ---------- */
.section-title { font-size: 1.1rem; margin: 36px 0 14px; }
.section-title.centered { text-align: center; }

/* hub hero — centered heading + lede */
.hero-centered { text-align: center; }
.hero-centered .lede { margin-left: auto; margin-right: auto; }
.recipes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.recipe {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.recipe h4 { margin: 0 0 8px; font-size: .92rem; }
.recipe pre {
  margin: 0 0 8px; padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; overflow-x: auto;
}
.recipe pre code { color: var(--cmd); font-size: .82rem; cursor: pointer; }
.recipe p { margin: 0; color: var(--text-dim); font-size: .84rem; }

.note-list { display: grid; gap: 10px; }
.note-item {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 11px 15px; color: var(--text-dim); font-size: .86rem; line-height: 1.55;
}
.note-label { color: var(--text); font-weight: 600; }
.note-item code { color: var(--cmd); font-family: var(--mono); font-size: .82em; word-break: break-word; }
.note-code {
  margin: 8px 0 4px; padding: 10px 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; overflow-x: auto;
}
.note-code code { color: var(--cmd); font-family: var(--mono); font-size: .8rem; }

/* ---------- footer (centered) ---------- */
footer {
  max-width: var(--maxw); margin: 56px auto 0; padding: 28px clamp(16px,4vw,40px) 36px;
  border-top: 1px solid var(--border); color: var(--text-dim); font-size: .85rem;
  text-align: center;
}
footer a { color: var(--text-dim); }
footer a:hover { color: var(--accent); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-bottom: 12px; }
.foot-parent { margin-bottom: 14px; color: var(--text-dim); }
.foot-parent a { color: var(--text-dim); }
.foot-parent a:hover { color: var(--accent); }
.foot-note { margin-bottom: 14px; }
.foot-siblings { display: block; }   /* registry injects cross-network links here later */
.foot-made { margin-top: 18px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.foot-made a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; line-height: 1; }
.foot-made a:hover { text-decoration: none; opacity: .85; }
.vl-flask { width: 15px; height: 15px; flex: none; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--accent); color: #00211c; font-weight: 600; font-size: .85rem;
  padding: 9px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- click tooltip ---------- */
.tip {
  position: fixed; z-index: 60; width: min(380px, 92vw);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 16px 44px rgba(0,0,0,.5);
  padding: 14px 16px; font-size: .86rem;
}
.tip[hidden] { display: none; }
.tip-close {
  position: absolute; top: 6px; right: 8px; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: .95rem; line-height: 1; padding: 4px;
}
.tip-close:hover { color: var(--text); }
.tip-line { display: flex; align-items: flex-start; gap: 8px; }
.tip-cmd, .tip-ex { font-family: var(--mono); flex: 1; word-break: break-word; }
.tip-cmd { color: var(--cmd); font-size: .92rem; padding-right: 16px; }
.tip-ex { color: var(--text); opacity: .9; font-size: .82rem; }
.tip-cmd-row { padding-right: 24px; }   /* clear the absolute ✕ close button */
.tip-ex-line { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.tip-ex-line[hidden] { display: none; }
.tip-copy {
  flex: none; background: var(--surface); border: 1px solid var(--border);
  color: var(--text-dim); border-radius: 6px; font-size: .72rem; padding: 3px 9px; cursor: pointer;
}
.tip-copy:hover { border-color: var(--accent); color: var(--text); }
.tip-copy.copied { color: var(--success); border-color: var(--success); }
.tip-danger {
  margin: 10px 0 0; padding: 8px 10px; background: var(--danger-soft);
  border: 1px solid var(--danger); border-radius: 8px; color: var(--danger); font-size: .8rem;
}
.tip-danger[hidden] { display: none; }

/* ---------- back to top ---------- */
#top {
  position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 1.1rem; cursor: pointer; display: none;
  place-items: center; z-index: 30;
}
#top.show { display: grid; }
#top:hover { border-color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .header-inner { grid-template-columns: auto 1fr auto; gap: 10px; }
  .header-nav a.nav-text { display: none; }
  .card-grid { column-count: 1; column-width: auto; }
  .recipes { grid-template-columns: 1fr; }
  .cmd-row .cmd { width: 48%; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
