/* Docs for the SEO Tool.
   The palette is lifted from the app itself (src/app/globals.css) so the
   docs and the software look like one product: cool-tinted neutrals at
   hue 245, one electric-cyan accent used only for links, active states
   and primary buttons. */

:root {
  --bg: #0b0e14;
  --bg-soft: #11151d;
  --card: #151a23;
  --card-2: #1a202b;
  --fg: #f2f4f8;
  --fg-muted: #9aa3b4;
  --fg-dim: #6f7889;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --brand: #39c0ff;
  --brand-ink: #06202c;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius: 10px;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 268px;
  --toc-w: 216px;
}

html[data-theme="light"] {
  --bg: #fbfcfe;
  --bg-soft: #f3f5f9;
  --card: #ffffff;
  --card-2: #f7f9fc;
  --fg: #171c26;
  --fg-muted: #57606f;
  --fg-dim: #7c8596;
  --border: rgba(16, 24, 40, 0.10);
  --border-strong: rgba(16, 24, 40, 0.18);
  --brand: #0d7fb8;
  --brand-ink: #ffffff;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: var(--mono); }

code {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.87em;
}

pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  overflow-x: auto;
  position: relative;
  font-size: 13.5px;
  line-height: 1.6;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }

kbd {
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.85em;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
.brand small {
  color: var(--fg-dim);
  font-weight: 500;
  font-size: 11.5px;
  border-left: 1px solid var(--border-strong);
  padding-left: 9px;
  margin-left: 2px;
}

.search-wrap { position: relative; flex: 1; max-width: 420px; margin-left: 8px; }
#search {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  padding: 8px 12px 8px 34px;
  outline: none;
}
#search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.search-wrap::before {
  content: "⌕";
  position: absolute; left: 12px; top: 50%; transform: translateY(-52%);
  color: var(--fg-dim); font-size: 16px; pointer-events: none;
}
#results {
  position: absolute; top: 44px; left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 6px; display: none;
  max-height: 60vh; overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
}
#results.open { display: block; }
#results a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--fg); }
#results a:hover, #results a.active { background: var(--card-2); text-decoration: none; }
#results .r-title { font-weight: 600; font-size: 14px; }
#results .r-page { color: var(--fg-dim); font-size: 12px; }
#results .empty { padding: 10px; color: var(--fg-dim); font-size: 13.5px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 12px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); text-decoration: none; }
.btn-primary {
  background: var(--brand); color: var(--brand-ink);
  border-color: transparent; font-weight: 640;
}
.btn-primary:hover { filter: brightness(1.08); }

#menu-toggle { display: none; }

/* ---------- layout ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 34px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 22px;
}

.sidebar {
  position: sticky; top: 60px; align-self: start;
  height: calc(100vh - 60px); overflow-y: auto;
  padding: 22px 6px 60px 0;
}
.sidebar h4 {
  margin: 20px 0 7px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg-dim);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar a {
  display: block; padding: 6px 11px; border-radius: 7px;
  color: var(--fg-muted); font-size: 14px; line-height: 1.45;
}
.sidebar a:hover { background: var(--card); color: var(--fg); text-decoration: none; }
.sidebar a.active {
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand); font-weight: 600;
}

main { min-width: 0; padding: 30px 0 90px; }

.toc { position: sticky; top: 60px; align-self: start; padding: 30px 0 60px; font-size: 13.5px; }
.toc .toc-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--fg-dim); margin-bottom: 9px;
}
.toc a {
  display: block; padding: 4px 0 4px 11px; color: var(--fg-muted);
  border-left: 2px solid var(--border);
}
.toc a:hover { color: var(--fg); text-decoration: none; }
.toc a.active { color: var(--brand); border-left-color: var(--brand); }

/* ---------- content ---------- */

.eyebrow {
  color: var(--brand); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px;
}
h1 { font-size: 34px; line-height: 1.18; letter-spacing: -0.021em; margin: 0 0 12px; }
.lede { font-size: 17px; color: var(--fg-muted); margin: 0 0 6px; max-width: 70ch; }
h2 {
  font-size: 22px; letter-spacing: -0.014em; margin: 44px 0 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
h3 { font-size: 16.5px; margin: 26px 0 8px; }
p, li { max-width: 74ch; }
ul, ol { padding-left: 20px; }
li { margin: 5px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin: 16px 0;
}
.card h3 { margin-top: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 13px; margin: 18px 0; }
.grid .card { margin: 0; }
.grid .card a { font-weight: 600; }
.grid .card p { font-size: 13.5px; color: var(--fg-muted); margin: 5px 0 0; }

.note, .warn, .tip {
  border-left: 3px solid var(--brand);
  background: var(--card); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 13px 16px; margin: 16px 0;
}
.note strong, .warn strong, .tip strong { display: block; margin-bottom: 3px; }
.warn { border-left-color: var(--warn); }
.tip { border-left-color: var(--ok); }
.note p:last-child, .warn p:last-child, .tip p:last-child { margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--fg-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
td code { white-space: nowrap; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 4px 40px; margin: 0 0 16px;
}
.steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps > li strong { display: block; margin-bottom: 2px; }

.copy {
  position: absolute; top: 8px; right: 8px;
  background: var(--card-2); color: var(--fg-muted);
  border: 1px solid var(--border); border-radius: 6px;
  font: inherit; font-size: 11.5px; padding: 3px 8px; cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
pre:hover .copy { opacity: 1; }
.copy:hover { color: var(--fg); }

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 650;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  background: var(--card-2); border: 1px solid var(--border); color: var(--fg-muted);
}
.pill-free { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-key { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 54px; }
.pager a { flex: 1; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.pager a:hover { border-color: var(--border-strong); text-decoration: none; }
.pager span { display: block; font-size: 11.5px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.pager .next { text-align: right; }

footer {
  border-top: 1px solid var(--border); margin-top: 60px;
  padding: 26px 22px 40px; color: var(--fg-dim); font-size: 13.5px;
}
footer .inner { max-width: 1400px; margin: 0 auto; display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- responsive ---------- */

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  #menu-toggle { display: inline-flex; }
  /* The header ran 104px past the viewport at 390px wide: brand +
     search + three buttons do not fit on a phone. The repo link lives
     in the footer and the sidebar, so it is the one to drop first. */
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar-right .btn:not(.btn-primary):not(#theme-toggle) { display: none; }
  .search-wrap { min-width: 0; }
  .sidebar {
    display: none; position: fixed; inset: 60px 0 0 0; height: auto;
    background: var(--bg); z-index: 40; padding: 18px 18px 60px;
    overflow-y: auto; border-right: 0;
  }
  .sidebar.open { display: block; }
  .search-wrap { max-width: none; }
  .brand small { display: none; }
  h1 { font-size: 27px; }
  main { padding-top: 22px; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
}

@media (max-width: 520px) {
  /* Last thing to go on a very small phone: the download button. Every
     page still links to it in the body, and the menu has everything. */
  .topbar-right .btn-primary { display: none; }
  #theme-toggle { padding: 7px 10px; }
}
