:root {
  color-scheme: light;
  --bg: #f3eee4;
  --bg-elev: #fffaf1;
  --ink: #1a1714;
  --muted: #6a6258;
  --line: #ddd4c6;
  --accent: #1e4a38;
  --accent-ink: #f7f3ea;
  --focus: #c45c26;
  --shadow: 0 18px 50px rgba(48, 32, 12, 0.08);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141210;
    --bg-elev: #1d1a17;
    --ink: #f4efe6;
    --muted: #b3aa9d;
    --line: #3a342c;
    --accent: #c9e2d2;
    --accent-ink: #13251d;
    --focus: #e7a06a;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(1200px 480px at 50% -80px, color-mix(in srgb, var(--focus) 14%, transparent), transparent 70%),
    var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.6rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elev);
}

.lang button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  font-weight: 650;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.lang button + button {
  border-left: 1px solid var(--line);
}

.lang button[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
}

.brand {
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--ink);
}

.brand span {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  margin-left: 0.35rem;
}

.quiet {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  border-bottom: 1px solid transparent;
}

.quiet:hover { border-bottom-color: var(--line); color: var(--ink); }

main {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto 4rem;
}

.hero {
  text-align: center;
  padding: 4.5rem 0 1.5rem;
}

.has-query .hero {
  padding: 0.4rem 0 1rem;
}

.eyebrow {
  margin: 0 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

h1 {
  margin: 0 0 1.6rem;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  letter-spacing: -0.03em;
}

.has-query h1,
.has-query .eyebrow { display: none; }

.search {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  align-items: stretch;
  max-width: 720px;
  margin: 0 auto;
}

.search input {
  flex: 1;
  height: 3.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1.3rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  outline: none;
}

.search input:focus {
  border-color: var(--focus);
  box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent);
}

.search button,
.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0 1.35rem;
  height: 3.4rem;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
}

.search button:hover,
.button:hover { filter: brightness(1.06); }

.button.ghost {
  height: 2.4rem;
  padding: 0 0.95rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 500;
}

.searching {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-top: 1.2rem;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.htmx-indicator { display: none; }
.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator { display: flex; }

#app:has(.htmx-request) .results-panel {
  opacity: 0.35;
  pointer-events: none;
}

.spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--line);
  border-top-color: var(--focus);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.results-panel { margin-top: 1.4rem; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.status {
  margin: 0;
  color: var(--muted);
}

.status.error { color: var(--focus); }

.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

tbody tr + tr td { border-top: 1px solid var(--line); }

.code {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  white-space: nowrap;
  width: 7.5rem;
}

@media (max-width: 640px) {
  .search { flex-direction: column; }
  .search button { height: 3rem; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .top { flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
}
