:root {
  --border: #d7dce3;
  --text: #17202a;
  --muted: #5b6573;
  --accent: #1f5fbf;
  --surface: #ffffff;
  --bg: #f6f7f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body.theme-dark {
  --border: #3c3f41;
  --text: #d7d9dc;
  --muted: #a8adb5;
  --accent: #6ea6ff;
  --surface: #2b2d30;
  --bg: #1e1f22;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.shell-brand {
  font-weight: 600;
}

.shell-search {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-search-form {
  width: min(720px, 100%);
}

.header-search-form input[type="search"] {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.codebase-picker-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.codebase-picker-form select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
}

.code-browser-home {
  min-height: calc(100vh - 72px);
  display: grid;
  place-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.home-logo {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
}

.home-search-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.home-search-form input[type="search"] {
  width: min(720px, 80vw);
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.home-search-form button {
  padding: 0.9rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.results-list {
  display: grid;
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.result-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.result-title {
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 1rem;
  font-weight: 600;
}

.result-title code {
  font-family: "JetBrains Mono", "Menlo", "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  color: #000000;
}

body.theme-dark .result-title code {
  color: #a9b7c6;
}

.kind-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e8eefb;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.method-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: #e8eefb;
  color: var(--accent);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.75rem;
  font-weight: 700;
}

.result-context,
.result-snippet,
.result-meta {
  margin: 0.35rem 0;
}

.result-context,
.result-meta {
  color: var(--muted);
}

.artifact-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.artifact-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.artifact-header h1 {
  margin-top: 0;
}

.path-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.member-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}

.member-section p {
  margin: 0;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.member-section p:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.code-block {
  overflow-x: auto;
  background: #ffffff;
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  tab-size: 4;
}

body.theme-dark .code-block {
  background: #2b2b2b;
  border-color: #3c3f41;
}

.code-block--rendered pre {
  margin: 0;
}

.code-block code,
.artifact-header pre,
.member-section code {
  font-family: "JetBrains Mono", "Menlo", "Consolas", "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  color: #000000;
}

body.theme-dark .code-block code,
body.theme-dark .artifact-header pre,
body.theme-dark .member-section code {
  color: #a9b7c6;
}

.code-link {
  color: inherit;
  text-decoration: none;
}

.code-link:hover {
  cursor: pointer;
}

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

.code-keyword {
  color: #0033b3;
}

body.theme-dark .code-keyword {
  color: #cc7832;
}

.code-annotation {
  color: #9e880d;
}

body.theme-dark .code-annotation {
  color: #bbb529;
}

.code-literal {
  color: #008000;
}

body.theme-dark .code-literal {
  color: #6a8759;
}

.code-function,
[data-code-token="function"] {
  color: #00627a;
}

body.theme-dark .code-function,
body.theme-dark [data-code-token="function"] {
  color: #ffc66d;
}

.code-field,
[data-code-token="field"] {
  color: #871094;
}

body.theme-dark .code-field,
body.theme-dark [data-code-token="field"] {
  color: #9876aa;
}

[data-code-token="annotation"] {
  color: #8b6f47;
}

body.theme-dark [data-code-token="annotation"] {
  color: #bbb529;
}

.usage-link {
  display: inline;
  margin-left: 0.25rem;
  color: var(--muted);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  user-select: none;
  vertical-align: super;
}

.usage-link:hover,
.usage-link:focus {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.code-block :target,
.code-target:target {
  background: #fff2a8;
  outline: 2px solid #d4a017;
  outline-offset: 2px;
  border-radius: 3px;
}

body.theme-dark .code-block :target,
body.theme-dark .code-target:target {
  background: #4f4a2a;
  outline-color: #b99f3a;
}

.theme-switch {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  margin: 0;
}

.theme-switch label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.12);
  font-size: 0.8rem;
  line-height: 1;
}

body.theme-dark .theme-switch label {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.theme-switch input {
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.results-pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-size-links {
  display: inline-flex;
  gap: 0.5rem;
}
