:root {
  --bg: #0b0f10;
  --panel: #131a1c;
  --panel-2: #182123;
  --ink: #e8f0ee;
  --muted: #8aa0a0;
  --green: #21c08b;
  --accent: #f5d547;
  --line: #223033;
  --red: #e2566b;
  --amber: #e6a23c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #102023 0%, var(--bg) 60%);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap {
  width: min(900px, 92vw);
  margin: 0 auto;
  padding: 30px 0 64px;
}

.topnav {
  width: min(900px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.navlinks { display: flex; gap: 18px; }
.navlinks a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.navlinks a:hover { color: var(--ink); }
.navlinks a[aria-current="page"] { color: var(--green); }

.radar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--green);
  position: relative;
}
.radar::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 280deg, rgba(33, 192, 139, 0.6) 360deg);
}

.accent { color: var(--green); }

/* Home hero */
.hero { text-align: center; margin: 8px auto 26px; }
.kicker {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  margin: 0 auto 14px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  margin: 0 auto;
  max-width: 24ch;
  letter-spacing: -0.02em;
}
.subtitle {
  color: #cdd9d7;
  font-size: 17px;
  text-align: center;
  margin: 14px auto 0;
  max-width: 56ch;
}
.signals {
  margin: 16px auto 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 100ch;
  line-height: 1.8;
}

/* Form */
.finder {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); }
.field input {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 15px;
}
.field input:focus { outline: none; border-color: var(--green); }
button#submit {
  background: var(--green);
  color: #04130d;
  border: 0;
  border-radius: 9px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
button#submit:disabled { opacity: 0.55; cursor: progress; }

.status {
  margin: 22px auto 0;
  text-align: center;
  color: var(--accent);
  font-size: 14px;
}
.status.error { color: var(--red); }

/* Source summary */
.source {
  margin-top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.source h2 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.source p { margin: 0; color: var(--muted); font-size: 14px; }
.source .stack { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

/* Results grid */
.grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card .rank { font-size: 12px; color: var(--muted); }
.card .name {
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  font-size: 15px;
  word-break: break-word;
}
.card .name:hover { color: var(--green); }
.card .stars { color: var(--accent); font-size: 13px; white-space: nowrap; }
.card .lang { font-size: 12px; color: var(--muted); }
.card .line { font-size: 13.5px; color: #cdd9d7; margin: 0; }
.card .line b { color: var(--green); font-weight: 600; }

.ratings { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.rate { display: grid; grid-template-columns: 54px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

/* Example buttons */
.examples {
  margin: 14px 2px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.examples-label { font-size: 13px; color: var(--muted); }
.example {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.example:hover { border-color: var(--green); }
.example .ex-goal {
  color: var(--green);
  font-size: 12px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
}

/* Sub-pages (FAQ, About, Contact) */
.page { max-width: min(720px, 92vw); }
.page h1 { font-size: 26px; margin: 6px 0 22px; letter-spacing: -0.01em; }
.page-lede { color: var(--muted); margin: 0 0 24px; max-width: 60ch; }
.page-cta { margin-top: 28px; color: var(--muted); font-size: 14px; }
.page-cta a, .prose a, .page-lede a { color: var(--green); }

.prose p { margin: 0 0 16px; color: #cdd9d7; }
.prose a { text-decoration: none; }
.prose a:hover { text-decoration: underline; }

.faq { display: flex; flex-direction: column; gap: 18px; }
.qa {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.qa h2 { font-size: 15.5px; margin: 0 0 7px; font-weight: 650; }
.qa p { margin: 0; color: #cdd9d7; font-size: 14px; }

/* Contact form */
.contact {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  max-width: 520px;
}
.contact .field { gap: 6px; }
.contact textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
.contact textarea:focus { outline: none; border-color: var(--green); }
.contact button {
  background: var(--green);
  color: #04130d;
  border: 0;
  border-radius: 9px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  align-self: start;
}
.contact button:disabled { opacity: 0.55; cursor: progress; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.foot {
  width: min(900px, 92vw);
  margin: 40px auto 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--green); }

/* Chat with a repo */
.chat-btn {
  margin-top: 2px;
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.chat-btn:hover { border-color: var(--green); color: var(--green); }

.chat-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.chat-modal[hidden] { display: none; }
.chat-box {
  width: min(560px, 96vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 650;
  font-size: 14px;
}
.chat-head button { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; }
.chat-head button:hover { color: var(--ink); }
.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}
.chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  border: 1px solid var(--line);
}
.chat-msg.bot { background: var(--panel-2); align-self: flex-start; white-space: normal; }
.chat-msg p, .chat-msg ul, .chat-msg ol, .chat-msg pre, .chat-msg table, .chat-msg blockquote { margin: 0 0 8px; }
.chat-msg > :last-child { margin-bottom: 0; }
.chat-msg ul, .chat-msg ol { padding-left: 20px; }
.chat-msg li + li { margin-top: 4px; }
.chat-msg strong { color: var(--ink); }
.chat-msg a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.chat-msg code, .card .line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
.chat-msg pre { padding: 10px 12px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.chat-msg pre code { background: none; padding: 0; white-space: pre; overflow-wrap: normal; }
.chat-msg table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 0.92em; }
.chat-msg th, .chat-msg td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.chat-msg hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.chat-msg blockquote { padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.chat-msg.you { background: var(--green); color: #04130d; align-self: flex-end; border-color: transparent; }
.chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px 6px;
  border-top: 1px solid var(--line);
}
.chat-input input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}
.chat-input input:focus { outline: none; border-color: var(--green); }
.chat-input button {
  background: var(--green);
  color: #04130d;
  border: 0;
  border-radius: 9px;
  padding: 10px 16px;
  font-weight: 650;
  cursor: pointer;
}
.chat-note { margin: 0; padding: 4px 16px 14px; font-size: 11px; color: var(--muted); }

@media (max-width: 640px) {
  .finder { grid-template-columns: 1fr; }
  .navlinks { gap: 14px; }
}

/* About page: architecture diagram */
.arch { margin-top: 36px; }
.arch h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
.arch-lede { color: var(--muted); margin: 0 0 16px; }
.arch-figure { margin: 0 0 22px; }
.arch-diagram {
  padding: 18px;
  background: rgba(19, 26, 28, 0.55);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.arch-grid { display: grid; gap: 12px; }
.arch-cols-2 { grid-template-columns: 1fr 1fr; }
.arch-cols-3 { grid-template-columns: repeat(3, 1fr); align-items: start; }
.arch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 11px 12px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.arch-node > strong { font-size: 14.5px; font-weight: 650; }
.arch-node > span { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.arch-cf {
  border-color: rgba(33, 192, 139, 0.55);
  background: linear-gradient(rgba(33, 192, 139, 0.06), rgba(33, 192, 139, 0.06)), var(--panel);
}
.arch-cf > strong { color: var(--green); }
.arch-worker { gap: 10px; padding: 12px 14px 14px; }
.arch-worker > .arch-grid, .arch-worker > .arch-engine { align-self: stretch; }
.arch-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  font-size: 13.5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.arch-engine {
  padding: 10px 12px 12px;
  background: rgba(11, 15, 16, 0.55);
  border: 1px dashed #33484c;
  border-radius: 11px;
}
.arch-engine > strong { display: block; font-size: 14px; font-weight: 650; }
.arch-steps {
  counter-reset: step;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.arch-steps li {
  counter-increment: step;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 6px;
  font-size: 13px;
  line-height: 1.35;
  color: #cdd9d7;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.arch-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  background: rgba(33, 192, 139, 0.16);
}
.arch-link {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  padding-left: calc(50% + 10px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.arch-link::before {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  top: 3px;
  bottom: 8px;
  width: 2px;
  background: #3d5458;
}
.arch-link::after {
  content: "";
  position: absolute;
  left: calc(50% - 5px);
  bottom: 2px;
  border: 5px solid transparent;
  border-top: 7px solid #3d5458;
  border-bottom: 0;
}
.arch-link-short { height: 22px; }
.arch-stack { display: flex; flex-direction: column; }
.arch-figure figcaption { margin-top: 10px; font-size: 12.5px; color: var(--muted); text-align: center; }
.arch .prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 1px 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
}
@media (max-width: 560px) {
  .arch-diagram { padding: 12px; }
  .arch-steps { grid-template-columns: 1fr 1fr; }
  .arch-cols-3 { grid-template-columns: 1fr; }
  .arch-fanout .arch-link + .arch-link { display: none; }
}

/* Turnstile human check. Only shown on the Cloudflare demo hosts (c. and g.). */
.ts-gate {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: min(360px, 92vw);
  padding: 14px 16px 10px;
  background: var(--panel);
  border: 1px solid var(--green);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.ts-gate p {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink);
}
