/* The Code — Agentic Coding CLI Quick Reference
   Brand tokens per CODEBRAND.md */

:root {
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-tint: #f6f7fb;

  --ink: #07070a;
  --ink-soft: #3a3a44;
  --ink-mute: #8a8a96;

  --line: #ececf0;
  --line-soft: #f3f3f6;

  --accent: #2247ff;
  --accent-hover: #1a3aee;
  --accent-soft: #e9eeff;

  --code-bg: #07070a;
  --code-ink: #f1f1f6;
  --code-mute: #8a8a96;

  --danger: #c0322b;
  --danger-bg: #fdf2f1;
  --danger-line: #f4d9d7;

  --font-display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(7,7,10,0.03), 0 6px 18px -12px rgba(7,7,10,0.08);
  --shadow-hover: 0 2px 4px rgba(34,71,255,0.06), 0 18px 40px -16px rgba(34,71,255,0.18);

  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --header-h: 61px;
  --sidebar-w: 256px;
  --shell: 1600px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: inherit; }

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
  text-decoration: none;
}
.brand__mark {
  position: relative;
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  background: var(--accent);
  border-radius: 0.16em;
  margin: 0 0.06em;
  vertical-align: -0.06em;
}
.brand__cursor {
  position: absolute;
  inset: 15%;
  display: block;
  background: #fff;
  border-radius: 0.09em;
}
.brand__cursor svg {
  position: absolute;
  inset: 16%;
  width: 68%;
  height: 68%;
  display: block;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header__row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  max-width: var(--shell);
  margin: 0 auto;
}

.search-trigger {
  flex: 1;
  max-width: 460px;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-tint);
  color: var(--ink-mute);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}
.search-trigger:hover { border-color: #dcdce4; background: #fff; }
.search-trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-trigger .kbd { margin-left: auto; flex-shrink: 0; }
.search-trigger span:not(.kbd) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger svg { flex-shrink: 0; }

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  line-height: 1.2;
}

.join-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms, transform 150ms;
}
.join-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ---------- Hero ---------- */

.hero {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 64px 24px 44px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  margin: 0 auto 16px;
  max-width: 27ch;
}
.hero__lede {
  color: var(--ink-soft);
  font-size: 17px;
  max-width: 60ch;
  margin: 0 auto;
}
.hero__search {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  max-width: 540px;
  height: 54px;
  margin: 30px auto 0;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
  color: var(--ink-mute);
  font: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms, transform 150ms;
}
.hero__search:hover {
  border-color: #d8d8e2;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}
.hero__search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.hero__search svg { color: var(--ink-mute); flex-shrink: 0; }
.hero__search span:not(.kbd) {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero__search em {
  font-family: var(--font-mono);
  font-size: 13px;
  font-style: normal;
  color: var(--ink-soft);
  background: var(--bg-tint);
  border-radius: 4px;
  padding: 3px 7px;
  margin-right: 5px;
}
.hero__search .kbd { flex-shrink: 0; background: var(--bg-tint); }

/* Header search stays out of the way until the hero one scrolls off */
.search-trigger {
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms, visibility 180ms;
}
.search-trigger.is-visible { opacity: 1; visibility: visible; }

/* ---------- Layout ---------- */

.layout {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px 96px;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  display: flex;
  flex-direction: column;
  padding: 24px 0 20px;
}
.sidebar__filters {
  flex-shrink: 0;
  padding: 0 10px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.sidebar__filters .filter-row__label { width: auto; margin: 0 0 8px; }
.sidebar__filters .resultbar__count { margin: 12px 0 0; display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sidebar__filters .chip { padding: 5px 9px; font-size: 12px; gap: 5px; }
.sidebar__filters .chip__icon { width: 12px; height: 12px; }
.sidebar__nav { overflow-y: auto; padding-top: 4px; }
.sidebar__group + .sidebar__group { margin-top: 22px; }
.sidebar__title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin: 0 0 8px;
  padding: 0 10px;
}
.sidebar__link {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background 120ms, color 120ms;
}
.sidebar__link:hover { background: var(--bg-tint); color: var(--ink); }
.sidebar__link.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.sidebar__link.is-empty { opacity: 0.35; }
.sidebar__label { flex: 1; min-width: 0; }
.sidebar__count { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); }
.sidebar__link.is-active .sidebar__count { color: var(--accent); }

/* ---------- Filters ---------- */

.filter-row__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  width: 52px;
  flex-shrink: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--bg-tint);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 130ms, color 130ms;
}
.chip__icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: color 130ms;
}
.chip[data-value="claude-code"] .chip__icon { color: #d97757; }
.chip[data-value="codex"] .chip__icon { color: var(--ink); }
.chip[aria-pressed="true"] .chip__icon { color: #fff; }
.chip:hover { background: #ebecf2; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.resultbar { margin-top: 12px; }
.resultbar__count { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-mute); }

/* ---------- Sections ---------- */

.results { padding-top: 24px; }
.results .section:first-child { padding-top: 0; }

.section { padding-top: 34px; scroll-margin-top: calc(var(--header-h) + 24px); }
.section[hidden] { display: none; }

.section__head { margin-bottom: 12px; }
.section__cli {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  display: block;
  margin-bottom: 5px;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 25px;
  letter-spacing: -0.01em;
  margin: 0;
}
.section__note {
  color: var(--ink-mute);
  font-size: 13px;
  margin: 8px 0 0;
  max-width: 76ch;
}

.rows {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
}
.rows__head {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  padding: 9px 16px;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

.row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  transition: background 120ms;
}
.rows .row:first-child { border-top: 0; }
.row:hover { background: #fbfbfd; }
.row[hidden] { display: none; }

.row__cmd {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 7px;
}
.row__desc { color: var(--ink-soft); font-size: 13.5px; }

.row__icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.75;
}
.row__icon--claude-code { color: #d97757; }
.row__icon--codex { color: var(--ink); }
.row:hover .row__icon { opacity: 1; }

.row--danger { background: var(--danger-bg); }
.row--danger:hover { background: #fbe9e7; }
.row--danger .row__cmd { color: var(--danger); }
.row--danger .row__desc { color: #8a3a35; }
.row__warn { flex-shrink: 0; width: 14px; height: 14px; display: block; }

.copy {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--ink-mute);
  cursor: pointer;
  opacity: 0;
  transition: opacity 130ms, background 130ms, color 130ms;
}
.row__cmd .copy { margin-left: 2px; }
.row:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { background: var(--accent-soft); color: var(--accent); }
.copy:focus-visible { outline: none; border-color: var(--accent); }
.copy.is-done { opacity: 1; color: #1a8a4f; }
.copy svg { width: 15px; height: 15px; }

.codeblock {
  position: relative;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0;
}
.section .codeblock + .codeblock { margin-top: 12px; }
.rows + .codeblock { margin-top: 12px; }
.codeblock code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre;
}
.codeblock .copy {
  position: absolute;
  top: 10px; right: 10px;
  opacity: 1;
  color: var(--code-mute);
}
.codeblock .copy:hover { background: rgba(255,255,255,0.1); color: #fff; }

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-mute);
}
.empty[hidden] { display: none; }
.empty__title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 6px;
}

/* ---------- Command palette ---------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(7,7,10,0.32);
  display: flex;
  justify-content: center;
  padding: 12vh 20px 20px;
  animation: fade var(--modal-open-dur) var(--modal-ease);
}
.palette[hidden] { display: none; }
.palette__panel {
  width: 100%;
  max-width: 620px;
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 70px -20px rgba(7,7,10,0.45);
  overflow: hidden;
  animation: scale-in var(--modal-open-dur) var(--modal-ease);
}
@keyframes fade { from { opacity: 0; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } }

.palette__input {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 17px 20px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  flex-shrink: 0;
}
.palette__input::placeholder { color: var(--ink-mute); }
.palette__list { overflow-y: auto; padding: 6px; }
.palette__item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.palette__item.is-active { background: var(--accent-soft); }
.palette__cmd {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  flex-shrink: 0;
  max-width: 46%;
  word-break: break-word;
}
.palette__item.is-danger .palette__cmd { color: var(--danger); }
.palette__desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette__crumb {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  flex-shrink: 0;
  padding-left: 10px;
}
.palette__foot {
  border-top: 1px solid var(--line);
  padding: 9px 16px;
  display: flex;
  gap: 16px;
  font-size: 11.5px;
  color: var(--ink-mute);
  flex-shrink: 0;
}
.palette__foot .kbd { background: var(--bg-tint); }
.palette__empty { padding: 30px 20px; text-align: center; color: var(--ink-mute); font-size: 13.5px; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  z-index: 95;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
}
.site-footer__row {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.site-footer p { margin: 0; color: var(--ink-mute); font-size: 13px; }
.site-footer__brand { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.site-footer__tagline { font-size: 13.5px !important; }

.verified {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px 34px;
}
.verified__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute) !important;
  margin: 0 0 10px !important;
}
.verified__sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  font-size: 12.5px;
}
.verified__sources a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 130ms;
}
.verified__sources a:hover { border-bottom-color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 940px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .layout > * { min-width: 0; }
  .sidebar {
    position: sticky;
    top: var(--header-h);
    z-index: 25;
    max-height: none;
    display: block;
    padding: 10px 0 0;
    background: rgba(255,255,255,0.96);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .sidebar__filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px;
    margin-bottom: 0;
    border-bottom: 0;
  }
  .sidebar__filters .filter-row__label { margin: 0; }
  .sidebar__filters .resultbar__count { margin: 0 0 0 auto; }
  .chips { flex-wrap: nowrap; }
  .sidebar__filters .chip { white-space: nowrap; }
  .sidebar__filters .resultbar__count { white-space: nowrap; }
  .sidebar__nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 10px;
    white-space: nowrap;
  }
  .sidebar__group { display: flex; gap: 8px; align-items: center; }
  .sidebar__group + .sidebar__group { margin-top: 0; }
  .sidebar__title { margin: 0; padding: 0 2px; }
  .sidebar__link { border-radius: 999px; background: var(--bg-tint); padding: 5px 12px; font-size: 12.5px; }
  .results { padding-top: 12px; }
  .section { scroll-margin-top: calc(var(--header-h) + 100px); }
  .row, .rows__head { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rows__head span:nth-child(2) { display: none; }
  .copy { opacity: 1; }
  .join-btn { display: none; }
}

@media (max-width: 620px) {
  .hero { padding: 40px 20px 30px; }
  .filter-row__label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
