/* Amber on near-black, from the logo and the app itself. Dark is the default look; a light
   scheme is offered to browsers that ask for one. */
:root {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #17171a;
  --surface-2: #1f1f23;
  --border: #2c2c31;
  --text: #e9e7e3;
  --muted: #a3a09a;
  --accent: #f2a516;
  --accent-text: #f5b73b;
  --on-accent: #111;
  --code-bg: #1b1b1f;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fbfaf7;
    --surface: #ffffff;
    --surface-2: #f3f1ec;
    --border: #e2ded5;
    --text: #1b1a17;
    --muted: #5f5b53;
    --accent: #f2a516;
    --accent-text: #8a5300;
    --on-accent: #111;
    --code-bg: #f3f1ec;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}
a { color: var(--accent-text); }
img { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.2px;
}
.brand img { border-radius: 50%; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 18px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.topbar nav a:hover { color: var(--text); }

/* ---- landing ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.hero { padding: 72px 0 40px; text-align: center; }
.hero img.logo { width: 120px; height: 120px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 18px 0 8px; letter-spacing: -0.5px; }
.hero .tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--muted);
  max-width: 680px; margin: 0 auto 28px;
}
.install {
  display: inline-flex; align-items: center; gap: 12px; max-width: 100%;
  padding: 10px 10px 10px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 16px;
}
.install code { white-space: nowrap; overflow-x: auto; }
.install .prompt { color: var(--muted); user-select: none; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  font: 600 15px var(--font); text-decoration: none; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.install .btn { padding: 6px 12px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.note { color: var(--muted); font-size: 14px; margin-top: 14px; }

.shot {
  margin: 40px auto 0; max-width: 960px;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.shot img { display: block; width: 100%; }

section.block { padding: 56px 0 8px; }
section.block h2 { font-size: 1.7rem; margin: 0 0 6px; }
section.block > .wrap > p.lead { color: var(--muted); margin: 0 0 24px; max-width: 720px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
.card h3::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 10px; vertical-align: middle; }
.card p { margin: 0; color: var(--muted); }
.card a { font-weight: 600; }

.endpoint {
  margin-top: 20px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--code-bg); border: 1px solid var(--border); font-family: var(--mono);
  overflow-x: auto; white-space: nowrap;
}
.endpoint b { color: var(--accent-text); font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 16 / 11; object-fit: cover; object-position: top; }
.gallery figcaption { padding: 10px 14px; font-size: 14px; color: var(--muted); }

table.compare { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.compare th, .compare td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.compare tr:last-child td { border-bottom: 0; }
.compare th { font-size: 14px; color: var(--muted); font-weight: 600; }

.footer { margin-top: 72px; padding: 28px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.footer a { color: var(--muted); }

/* ---- search ---- */
.search { position: relative; flex: 1; max-width: 420px; }
.search input {
  width: 100%; padding: 8px 34px 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 15px var(--font);
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  padding: 0 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); font-size: 12px;
}
.search input:focus + kbd { display: none; }
#results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  max-height: 70vh; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
#results a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--text); }
#results a:hover, #results a.active { background: var(--surface-2); }
#results .where { display: block; font-weight: 600; font-size: 14px; color: var(--accent-text); }
#results .what { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; }
#results mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 2px; }
#results .none { padding: 10px; color: var(--muted); font-size: 14px; }

/* ---- docs ---- */
.layout {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 210px; gap: 36px;
  max-width: 1360px; margin: 0 auto; padding: 28px 20px 60px;
}
.toc { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow-y: auto; font-size: 13px; }
.toc p { margin: 0 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; color: var(--muted); text-decoration: none; border-left: 2px solid transparent; }
.toc .l3 a { padding-left: 24px; }
.toc a:hover { color: var(--text); }
.toc a.current { color: var(--accent-text); border-left-color: var(--accent); }

.prose .anchor { margin-left: 8px; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; }
.prose pre { position: relative; }
.copy {
  position: absolute; top: 8px; right: 8px; padding: 3px 9px; border-radius: 6px; cursor: pointer;
  font: 12px var(--font); color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  opacity: 0; transition: opacity 0.15s;
}
.prose pre:hover .copy, .copy:focus { opacity: 1; }
.zoom {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, 0.85); cursor: zoom-out;
}
.zoom[hidden] { display: none; }
.zoom img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.sidebar { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow-y: auto; }
.sidebar summary { display: none; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block; padding: 6px 12px; border-radius: 6px;
  color: var(--muted); text-decoration: none; font-size: 15px;
  border-left: 2px solid transparent;
}
.sidebar li a:hover { color: var(--text); background: var(--surface-2); }
.sidebar li a[aria-current="page"] { color: var(--text); background: var(--surface-2); border-left-color: var(--accent); }

.prose { max-width: 820px; }
.prose h1 { font-size: 2.1rem; margin: 0 0 18px; letter-spacing: -0.3px; }
.prose h2 { font-size: 1.45rem; margin: 40px 0 12px; padding-top: 4px; }
.prose h3 { font-size: 1.15rem; margin: 28px 0 8px; }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 72px; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.prose :not(pre) > code { background: var(--code-bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 5px; }
.prose pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; line-height: 1.5;
}
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 16px 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; vertical-align: top; }
.prose th { background: var(--surface-2); text-align: left; }
.prose blockquote { margin: 16px 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); background: var(--surface); border-radius: 0 6px 6px 0; }
.prose img { border: 1px solid var(--border); border-radius: 8px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager a { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; }
.pager small { display: block; color: var(--muted); font-size: 12px; }
.pager a:hover { border-color: var(--accent); }
.pager .next { margin-left: auto; text-align: right; }
.edit { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.edit a { color: var(--muted); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 16px; padding-top: 16px; }
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .sidebar { position: static; max-height: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
  .sidebar summary { display: block; padding: 8px 12px; font-weight: 600; cursor: pointer; }
  .topbar nav { gap: 8px 14px; }
  .hero { padding-top: 48px; }
}
@media (max-width: 560px) {
  .topbar nav { flex-basis: 100%; justify-content: flex-start; }
}
