/* API Hub preview. Modern dark-first design with a light theme option. */

[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #111830;
  --surface: #151d38;
  --surface-2: #1b2547;
  --border: #2a3560;
  --text: #eef1fb;
  --muted: #aab3d1;
  --faint: #8b95b8;
  --accent: #6ea8fe;
  --accent-2: #7c6cf0;
  --accent-strong: #4f7df9;
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --code-bg: #0a0e1d;
  --shadow: 0 18px 40px rgba(2, 6, 23, 0.45);
  --radius: 18px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-soft: #eef1f9;
  --surface: #ffffff;
  --surface-2: #f1f4fb;
  --border: #dde3f0;
  --text: #141a2e;
  --muted: #5b647e;
  --faint: #7c849e;
  --accent: #2f5fe0;
  --accent-2: #6a5af0;
  --accent-strong: #2f5fe0;
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  --code-bg: #111827;
  --shadow: 0 16px 34px rgba(20, 26, 46, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(720px 320px at 85% -40px, rgba(124, 108, 240, 0.28), transparent 60%),
    radial-gradient(640px 300px at 8% 0, rgba(79, 125, 249, 0.22), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

[data-theme="light"] body,
[data-theme="light"] {
  background: var(--bg);
}

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 1.1rem; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); font-weight: 800; letter-spacing: -0.02em; font-size: 1.15rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-size: 1rem;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2));
  box-shadow: 0 8px 20px rgba(79, 125, 249, 0.4);
}
.topnav { display: flex; gap: 0.25rem; margin-left: 0.5rem; }
.topnav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  padding: 0.45rem 0.8rem; border-radius: 999px;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle { margin-left: auto; }

/* Hero */
.hero { padding: 3.2rem 0 0.6rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 0.35rem 0.75rem; border-radius: 999px; margin: 0 0 1rem;
}
.hero h1 {
  margin: 0 0 0.7rem; font-size: clamp(2.3rem, 6vw, 3.6rem); line-height: 1.05;
  letter-spacing: -0.04em; font-weight: 850;
}
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 0; max-width: 44rem; font-size: 1.12rem; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.4rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.stat-row li {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.4rem 0.85rem; font-size: 0.9rem; color: var(--muted);
}
.stat-row strong { color: var(--text); }

/* Buttons and inputs */
button, .chip { font: inherit; cursor: pointer; }
.btn {
  border: 1px solid transparent; border-radius: 999px; padding: 0.62rem 1.15rem;
  font-weight: 700; background: linear-gradient(135deg, var(--accent-strong), var(--accent-2));
  color: #fff; box-shadow: 0 10px 24px rgba(79, 125, 249, 0.35); text-decoration: none; display: inline-block;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }
.btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: none;
}
.btn.secondary:hover { background: var(--surface-2); }
.btn.small { padding: 0.42rem 0.85rem; font-size: 0.92rem; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); box-shadow: none; }

input[type="search"], input[type="text"], select {
  font: inherit; width: 100%; min-width: 0;
  padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
}
input::placeholder { color: var(--faint); }

/* Sections */
main { padding-bottom: 3rem; }
section { margin-top: 2.6rem; scroll-margin-top: 76px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.4rem; }
.section-head h2 { margin: 0; font-size: clamp(1.5rem, 3.4vw, 2rem); letter-spacing: -0.03em; line-height: 1.15; }
.section-head p, .section-intro { margin: 0.35rem 0 0; color: var(--muted); max-width: 46rem; }
h3 { font-size: 1.2rem; letter-spacing: -0.02em; margin: 1.8rem 0 0.5rem; }
.attribution { color: var(--muted); font-size: 0.95rem; }
.attribution a { font-weight: 600; }

/* Controls */
.controls {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 0.8rem; margin: 1.1rem 0 0.2rem;
}
.control { display: flex; flex-direction: column; gap: 0.35rem; }
.control label { font-weight: 700; font-size: 0.92rem; }
.search-field { position: relative; }
.search-field input { padding-left: 2.6rem; border-radius: 999px; }
.search-field::before { content: "⌕"; position: absolute; left: 0.95rem; top: 50%; transform: translateY(-52%); font-size: 1.25rem; color: var(--faint); pointer-events: none; }
.chips { display: flex; gap: 0.45rem; overflow-x: auto; padding: 0.7rem 0.1rem 0.4rem; scrollbar-width: thin; }
.chip {
  flex: 0 0 auto; padding: 0.42rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 0.92rem;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.own-chip[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent-strong), var(--accent-2)); color: #fff; border-color: transparent; }
.last-checked, .hint { color: var(--muted); font-size: 0.93rem; }
.error {
  color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  border-radius: 12px; padding: 0.65rem 0.9rem;
}

/* Cards */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.15rem; display: flex; flex-direction: column; gap: 0.65rem;
  box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.card h3 { margin: 0; font-size: 1.12rem; line-height: 1.3; overflow-wrap: break-word; }
.card-desc {
  margin: 0; color: var(--muted); font-size: 0.96rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: break-word; word-break: normal;
}
.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.badge {
  font-size: 0.8rem; font-weight: 600; padding: 0.18rem 0.6rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge.own { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; font-size: 0.9rem; color: var(--muted); margin: 0; }
.status-pill { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; color: var(--text); }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; flex: 0 0 auto; background: var(--faint); }
.dot.ok { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent); }
.dot.down { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 16%, transparent); }
.dot.unknown { background: var(--faint); }
.checked-at { color: var(--faint); font-size: 0.85rem; }
.doc-link { font-weight: 700; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.2rem; }

/* Skeleton */
.skeleton {
  min-height: 190px; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1.2rem; }
.pagination-info { margin: 0 0.3rem; color: var(--muted); font-weight: 600; }
.page-btn {
  min-width: 2.4rem; padding: 0.45rem 0.6rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700;
}
.page-btn[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination-count { color: var(--muted); font-size: 0.93rem; }

/* Sandbox */
.snippets { border-top: 1px solid var(--border); padding-top: 0.7rem; }
.snippet-tabs { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.5rem; }
.tab-button { padding: 0.32rem 0.75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.88rem; font-weight: 600; }
.tab-button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.copy-button { margin-left: auto; padding: 0.32rem 0.75rem; }
pre {
  margin: 0; padding: 0.75rem 0.85rem; background: var(--code-bg); color: #e5e7eb;
  border-radius: 12px; border: 1px solid var(--border); overflow-x: auto;
  font-size: 0.83rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
pre code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.panel {
  border: 1px solid var(--border); border-radius: 14px; padding: 0.9rem;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 0.65rem;
}
.param-field { display: flex; flex-direction: column; gap: 0.25rem; }
.param-field label { font-weight: 700; font-size: 0.92rem; }
.response-meta { font-size: 0.92rem; color: var(--muted); margin: 0; }

/* Journals */
.search-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); margin-top: 1rem;
}
.search-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.search-row .control { flex: 1 1 18rem; }
.source-status { list-style: none; margin: 0.8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.source-status li { font-size: 0.88rem; padding: 0.32rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.result-group { margin-top: 1.3rem; }
.result-group h4 { margin: 0 0 0.5rem; font-size: 1.02rem; }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.result-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.result-title {
  font-weight: 700; color: var(--accent); text-decoration: none; line-height: 1.35;
  overflow-wrap: break-word; word-break: normal; hyphens: none;
}
.result-title:hover { text-decoration: underline; }
.result-desc {
  margin: 0; color: var(--muted); font-size: 0.93rem; line-height: 1.5;
  overflow-wrap: break-word; word-break: normal; hyphens: none;
}
.result-meta { color: var(--faint); font-size: 0.88rem; margin: 0; }
.journal-group { margin-top: 1.4rem; }
.journal-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.journal-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.journal-list a { font-weight: 700; overflow-wrap: break-word; text-decoration: none; }
.journal-list a:hover { text-decoration: underline; }
.journal-note { color: var(--muted); font-size: 0.92rem; margin: 0; }

.site-footer { border-top: 1px solid var(--border); padding: 1.6rem 0 2.4rem; color: var(--muted); font-size: 0.93rem; }
.site-footer a { font-weight: 600; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid, .result-list, .journal-list { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .hero { padding-top: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton { animation: none; }
  .card { transition: none; }
}
