/* ==========================================================================
   Keepa API Documentation — Stylesheet

   Brand language is taken from the keepa.com web app (_scss/abstracts/_colors,
   _variables): brand blue #256a93, Amazon orange #e47911 for link hovers,
   neutral #444444 greys, Roboto served from Keepa's own CDN.
   ========================================================================== */

/* Roboto — the same self-hosted faces the keepa.com app loads (css/style.css),
   including its local() Segoe UI substitutions, so the docs match the site. */
@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: local("Segoe UI Light"), local("SegoeUILight"), local("Roboto Light"), local("Roboto-Light"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Light/Roboto-Light.woff2?v=1.1.0") format("woff2"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Light/Roboto-Light.woff?v=1.1.0") format("woff");
}
@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local("Segoe UI"), local("SegoeUI"), local("Roboto"), local("Roboto-Regular"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Regular/Roboto-Regular.woff2?v=1.1.0") format("woff2"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Regular/Roboto-Regular.woff?v=1.1.0") format("woff");
}
@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: local("Roboto Medium"), local("Roboto-Medium"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Medium/Roboto-Medium.woff2?v=1.1.0") format("woff2"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Medium/Roboto-Medium.woff?v=1.1.0") format("woff");
}
@font-face {
  font-family: Roboto;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local("Roboto Bold"), local("Roboto-Bold"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Bold/Roboto-Bold.woff2?v=1.1.0") format("woff2"),
       url("https://env.7xmtools.com/cdn/fonts/Roboto/Bold/Roboto-Bold.woff?v=1.1.0") format("woff");
}

:root {
  /* matches $text-font-stack in _scss/abstracts/_variables.scss */
  --font-sans: Roboto, Tahoma, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Keepa brand: blue #256a93 (logo), orange #e47911 (link hover), grey #444444 */
  --bg: #ffffff;
  --bg-sidebar: #f2f5f7;
  --bg-code: #f4f6f8;
  --bg-inline-code: #e9edf1;
  --bg-hover: #e7eef3;
  --bg-active: #dbe7ef;
  --text: #444444;
  --text-muted: #696969;
  --text-faint: #767676;
  --border: #dfe4e8;
  --border-strong: #c3ccd3;
  --accent: #256a93;
  --accent-strong: #1b5780;
  --accent-soft: #e5edf2;
  /* Translucent so a selection stays visible over whatever surface it lands on —
     plain rows, hovered rows (--bg-hover), code blocks. An opaque tint here
     collided with --bg-hover and made selection invisible on hovered table rows. */
  --selection: rgba(37, 106, 147, .25);
  --accent-contrast: #ffffff;
  --link-hover: #e47911;
  --token: #b55f0d;
  --token-bg: #fdf0e0;
  --token-solid: #e47911;
  --ok: #2d7c52;
  --ok-bg: #e8f3ec;
  --ok-solid: #417156;
  --warn: #8a6d08;
  --warn-bg: #fdf7dc;
  --danger: #b32f00;
  --danger-bg: #ffece6;
  --note-bg: #eef4f8;
  --note-border: #a7c3d6;
  --tip-bg: #eef5f1;
  --tip-border: #a7c1b2;
  --warning-bg: #fdf7e3;
  --warning-border: #e8d38a;

  /* code highlighting */
  --hl-key: #1b5780;
  --hl-str: #2d7c52;
  --hl-num: #b55f0d;
  --hl-kw: #8f3fa8;
  --hl-com: #969696;
  --hl-fn: #8f3fa8;

  /* Keepa cross, as a mask so decorative uses can be tinted per theme */
  --keepa-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='121 143.7 351.3 350.3'%3E%3Cpath d='M472.3,373.5H351.8V494H241.5V373.5H121V264.2h120.4V143.7h109.4v120.4h120.4v109.4H472.3z M248,269.7V368h96.4v-98.2L248,269.7L248,269.7z'/%3E%3C/svg%3E");

  --sidebar-w: 288px;
  --toc-w: 224px;
  --content-max: 900px;
  --header-h: 0px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(37, 106, 147, .14);
}

[data-theme="dark"] {
  /* neutral greys from $keepa-palette-grey, accents from $keepa-palette-blue */
  --bg: #1f1f1f;
  --bg-sidebar: #262626;
  --bg-code: #272727;
  --bg-inline-code: #333333;
  --bg-hover: #2e2e2e;
  --bg-active: #1b3d54;
  --text: #dedede;
  --text-muted: #a5a5a5;
  --text-faint: #909090;
  --border: #383838;
  --border-strong: #4c4c4c;
  --accent: #7ec0ff;
  --accent-strong: #a8d5ff;
  --accent-soft: #14344b;
  --selection: rgba(126, 192, 255, .30);
  --accent-contrast: #0d2233;
  --link-hover: #ffa843;
  --token: #ffa843;
  --token-bg: #3a2610;
  --token-solid: #e47911;
  --ok: #6cc691;
  --ok-bg: #1b3227;
  --ok-solid: #417156;
  --warn: #f4d730;
  --warn-bg: #332d0a;
  --danger: #ff8168;
  --danger-bg: #3a1a12;
  --note-bg: #1b2b36;
  --note-border: #2f5570;
  --tip-bg: #1c2b23;
  --tip-border: #34573f;
  --warning-bg: #302a10;
  --warning-border: #63571a;

  --hl-key: #7ec0ff;
  --hl-str: #7ee2a8;
  --hl-num: #ffbd6b;
  --hl-kw: #d9a8ff;
  --hl-com: #8a8a8a;
  --hl-fn: #d9a8ff;

  --shadow: 0 1px 3px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 40px 48px 80px;
  max-width: calc(var(--content-max) + 96px);
  min-width: 0;
}

.toc {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--toc-w);
  flex-shrink: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 40px 24px 40px 0;
  font-size: 13px;
}

@media (max-width: 1240px) { .toc { display: none; } }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .content { margin-left: 0; padding: 24px 20px 60px; }
  .backdrop { position: fixed; inset: 0; background: rgba(10,15,25,.5); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .backdrop.show { opacity: 1; pointer-events: auto; }
  .mobile-bar { display: flex !important; }
  body { padding-top: 52px; }
}

.mobile-bar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.mobile-bar button {
  background: none; border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 5px 10px; color: var(--text); cursor: pointer; font-size: 15px;
}
.mobile-bar .brand-mini {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px; color: var(--text); text-decoration: none;
}
.mobile-bar .brand-mini .keepa-mark { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- Brand / Keepa logo ---------- */

/* The wordmark paths inherit currentColor (with a faded offset layer that
   reproduces the logo's drop shadow), so the lockup works in both themes.
   The circled cross keeps its fixed brand colours. */
.keepa-logo .wordmark { fill: currentColor; }
.keepa-logo .wordmark-shadow { fill: currentColor; opacity: .22; }

/* ---------- Sidebar ---------- */

.sidebar-head {
  position: relative;
  padding: 18px 20px 13px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--accent-soft), var(--bg-sidebar) 80%);
}
/* Keepa blue fading into Amazon orange — the two colours of the brand */
.sidebar-head::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 52%, var(--token-solid) 100%);
  opacity: .8;
}

.brand { display: block; text-decoration: none; color: var(--text); }
.brand .keepa-logo { display: block; width: 146px; height: auto; }
.brand .brand-sub {
  display: block; margin-top: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent);
}

.sidebar-tools { display: flex; gap: 8px; margin-top: 14px; }

.search-box { position: relative; flex: 1; }
.search-box input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box .search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}
.search-box kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-sans); font-size: 10.5px; color: var(--text-faint);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px;
  background: var(--bg-sidebar);
}

.theme-toggle {
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 7px;
  width: 34px; height: 34px; cursor: pointer; color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: -42px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(10,15,25,.18);
  max-height: 420px; overflow-y: auto; z-index: 60; display: none;
}
.search-results.show { display: block; }
.search-results a {
  display: block; padding: 9px 14px; text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover, .search-results a.sel { background: var(--bg-hover); }
.search-results .sr-title { font-weight: 500; }
.search-results .sr-title mark, .search-results .sr-ctx mark { background: none; color: var(--accent); font-weight: 700; }
.search-results .sr-ctx { color: var(--text-muted); font-size: 12px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .sr-section { color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.search-results .sr-empty { padding: 14px; color: var(--text-muted); font-size: 13.5px; }

.sidebar-nav { flex: 1; padding: 14px 12px 28px; }

.nav-group { margin-bottom: 4px; }
.nav-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); padding: 14px 10px 5px;
}
.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5.5px 10px; margin: 1px 0;
  color: var(--text-muted); text-decoration: none;
  font-size: 13.5px; border-radius: 6px; line-height: 1.4;
}
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-nav a.active { background: var(--bg-active); color: var(--accent-strong); font-weight: 500; }
.sidebar-nav a .nav-badge {
  font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent-strong); letter-spacing: .03em;
  flex-shrink: 0;
}

/* Signed-in Keepa account, mirrored from the web app's localStorage on this shared origin. */
.sidebar-acct {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); min-width: 0;
}
.acct-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok-solid); flex-shrink: 0;
}
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.acct-key {
  margin-left: auto; flex-shrink: 0;
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
}

.sidebar-foot {
  padding: 13px 20px 15px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-faint); line-height: 1.7;
}
.sidebar-foot a { color: var(--text-muted); text-decoration: none; }
.sidebar-foot a:hover { color: var(--link-hover); }
.sidebar-foot .foot-home {
  display: flex; align-items: center; gap: 7px;
  color: var(--text-muted); font-weight: 500; margin-bottom: 3px;
}
.sidebar-foot .foot-home .keepa-mark { width: 15px; height: 15px; flex-shrink: 0; }

/* ---------- Page header ---------- */

.page-header { margin-bottom: 28px; }

.breadcrumb {
  font-size: 12.5px; color: var(--text-faint); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--link-hover); }
.breadcrumb .sep { color: var(--border-strong); }

/* This page as Markdown: a link, and a copy button the script reveals */
.page-md { margin-left: auto; display: flex; gap: 6px; }
.breadcrumb .page-md a, .page-md button {
  background: none; border: 1px solid var(--border-strong); border-radius: 5px;
  color: var(--text-muted); font-size: 11px; font-family: var(--font-sans); font-weight: 500;
  line-height: 1.5; padding: 1px 9px; cursor: pointer; text-decoration: none;
}
.breadcrumb .page-md a:hover, .page-md button:hover { color: var(--accent); border-color: var(--accent); }
.page-md button.copied { color: var(--ok); border-color: var(--ok); }
.page-md button[hidden] { display: none; }

.page-header h1 {
  margin: 0 0 10px;
  font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
}

.lead { font-size: 16.5px; color: var(--text-muted); margin: 0 0 14px; max-width: 46em; }
.lead a { color: var(--accent); text-decoration: none; }
.lead a:hover { color: var(--link-hover); text-decoration: underline; }

.meta-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 99px; white-space: nowrap;
  background: var(--bg-inline-code); color: var(--text-muted);
}
.badge-token { background: var(--token-bg); color: var(--token); }
/* token marker — a small Keepa cross rather than an emoji */
.badge-token::before {
  content: "";
  width: 9px; height: 9px; flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: var(--keepa-cross) no-repeat center / contain;
  mask: var(--keepa-cross) no-repeat center / contain;
}
.badge-get { background: var(--ok-bg); color: var(--ok); }
.badge-object { background: var(--accent-soft); color: var(--accent-strong); }
.badge-required { background: var(--danger-bg); color: var(--danger); font-size: 10.5px; }
.badge-optional { background: var(--bg-inline-code); color: var(--text-muted); font-size: 10.5px; }

.endpoint-url {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 14px;
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin: 16px 0;
  overflow-x: auto;
}
.endpoint-url .method {
  font-weight: 700; color: var(--ok); font-size: 12px; letter-spacing: .04em;
  background: var(--ok-bg); padding: 2px 8px; border-radius: 5px;
}

/* ---------- Content ---------- */

.doc { max-width: var(--content-max); }

.doc h2 {
  font-size: 22.5px; font-weight: 700; letter-spacing: -.015em;
  margin: 44px 0 14px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.doc h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.doc h3 { font-size: 17.5px; font-weight: 700; margin: 30px 0 10px; }
.doc h4 { font-size: 15px; font-weight: 700; margin: 22px 0 8px; }

.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 26px; }
.doc li { margin-bottom: 5px; }
/* keepa.com uses blue links that turn Amazon orange on hover ($link-color-hover) */
.doc a { color: var(--accent); text-decoration: none; }
.doc a:hover { color: var(--link-hover); text-decoration: underline; }

.heading-anchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--text-faint); text-decoration: none; font-size: .85em; }
h2:hover .heading-anchor, h3:hover .heading-anchor { opacity: 1; }

code {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-inline-code);
  border-radius: 5px;
  padding: .15em .4em;
  color: var(--text);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
  line-height: 1.55;
  position: relative;
}
pre code { background: none; padding: 0; font-size: 13px; display: block; }

.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: 6px;
  color: var(--text-muted); font-size: 11.5px; font-family: var(--font-sans); font-weight: 500;
  padding: 3px 9px; cursor: pointer; opacity: 0;
  transition: opacity .15s;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); opacity: 1; }

/* ---------- Code tabs ---------- */

.code-tabs { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.code-tabs-bar {
  display: flex; gap: 2px; background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border); padding: 5px 8px 0;
  overflow-x: auto;
}
.code-tabs-bar button {
  background: none; border: none; border-bottom: 2px solid transparent;
  font-family: var(--font-sans); font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); padding: 7px 12px; cursor: pointer; white-space: nowrap;
}
.code-tabs-bar button:hover { color: var(--text); }
.code-tabs-bar button.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.code-tabs .code-panel { display: none; }
.code-tabs .code-panel.active { display: block; }
.code-tabs pre { border: none; border-radius: 0; margin: 0; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
thead th {
  text-align: left; font-weight: 700; font-size: 12px; letter-spacing: .03em;
  color: var(--text-muted); text-transform: uppercase;
  background: var(--bg-sidebar);
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
td code, th code { white-space: nowrap; }
td:first-child code { font-weight: 500; }

/* Dense index -> name reference (graph image csv types). Two balanced columns of
   index/name pairs; the fixed index column keeps the names left-aligned with each
   other instead of running together as prose. */
ul.csv-index-list { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 34px; }
ul.csv-index-list li { display: grid; grid-template-columns: 2.4em 1fr; gap: .5em; break-inside: avoid; line-height: 1.75; }
ul.csv-index-list li code { justify-self: end; }
ul.csv-index-list li span { overflow-wrap: anywhere; }

/* ---------- Callouts ---------- */

.note, .tip, .warning {
  border-radius: var(--radius); padding: 13px 16px 13px 46px; margin: 0 0 16px;
  font-size: 14px; position: relative; border: 1px solid; border-left-width: 3px;
}
.note { background: var(--note-bg); border-color: var(--note-border); border-left-color: var(--accent); }
.tip { background: var(--tip-bg); border-color: var(--tip-border); border-left-color: var(--ok-solid); }
.warning { background: var(--warning-bg); border-color: var(--warning-border); border-left-color: var(--token-solid); }
/* Brand-coloured glyphs instead of emoji, so callouts render identically everywhere */
.note::before, .tip::before, .warning::before {
  position: absolute; left: 15px; top: 14px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-sans); font-size: 12px; font-weight: 700; line-height: 1;
  color: #fff;
}
.note::before { content: "i"; background: var(--accent); color: var(--accent-contrast); }
.tip::before { content: "+"; background: var(--ok-solid); }
.warning::before { content: "!"; background: var(--token-solid); }
.note > :last-child, .tip > :last-child, .warning > :last-child { margin-bottom: 0; }
.note > p:first-child > strong:first-child,
.warning > p:first-child > strong:first-child,
.tip > p:first-child > strong:first-child { display: inline-block; margin-bottom: 2px; }

/* ---------- Cards (landing page) ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 0 0 18px; }
.card {
  display: block; text-decoration: none; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
  background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card .card-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; color: var(--accent-strong); display: flex; align-items: center; gap: 8px; }
.card .card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  padding: 28px 32px 30px;
  margin-bottom: 30px;
  background:
    radial-gradient(130% 150% at 100% 0%, var(--accent-soft) 0%, transparent 62%),
    linear-gradient(135deg, var(--accent-soft), var(--bg) 62%);
}
/* Keepa cross, oversized and faded — the same mark as the logo */
.hero::after {
  content: "";
  position: absolute; right: 30px; top: 50%;
  width: 148px; height: 148px;
  transform: translateY(-50%);
  background-color: var(--accent);
  opacity: .1;
  pointer-events: none;
  -webkit-mask: var(--keepa-cross) no-repeat center / contain;
  mask: var(--keepa-cross) no-repeat center / contain;
}
/* no room for the watermark once the content column narrows */
@media (max-width: 1180px) { .hero::after { display: none; } }
.hero > * { position: relative; }
.hero h1 { margin: 0 0 10px; font-size: 33px; letter-spacing: -.02em; }
.hero p { max-width: 36em; }
.hero p:last-child { margin-bottom: 0; }

/* ---------- TOC ---------- */

.toc .toc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a {
  display: block; padding: 3.5px 0 3.5px 14px; color: var(--text-muted);
  text-decoration: none; line-height: 1.45;
  border-left: 2px solid transparent; margin-left: -1.5px;
}
.toc li a:hover { color: var(--text); }
.toc li a.active { color: var(--accent-strong); border-left-color: var(--accent); font-weight: 500; }
.toc li.toc-h3 a { padding-left: 28px; font-size: 12px; }

/* ---------- Footer / prev-next ---------- */

.page-footer { max-width: var(--content-max); margin-top: 56px; }
.prevnext { display: flex; gap: 14px; margin-bottom: 24px; }
.prevnext a {
  flex: 1; text-decoration: none; border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 16px; color: var(--text);
}
.prevnext a:hover { border-color: var(--accent); }
.prevnext .pn-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.prevnext .pn-title { font-size: 14px; font-weight: 500; color: var(--accent-strong); margin-top: 2px; }
.prevnext .pn-next { text-align: right; }
.source-line { font-size: 12px; color: var(--text-faint); border-top: 1px solid var(--border); padding-top: 14px; }
.source-line a { color: var(--text-muted); }

/* ---------- Try it (live scratchpad) ---------- */

.code-tabs-bar { align-items: center; }
/* .code-tabs-bar .run-btn: outranks the plain tab style (.code-tabs-bar button), which would strip
   the fill and leave a bare word that is easy to miss */
.code-tabs-bar .run-btn {
  margin: 0 2px 5px auto;
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-weight: 700;
  font-size: 12.5px;
  padding: 5px 14px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  /* stays in view at the bar's right edge when the language tabs scroll on a narrow screen */
  position: sticky;
  right: 0;
}
.code-tabs-bar .run-btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-contrast); }
.code-tabs-bar .run-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.scratchpad {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--token);
  border-radius: var(--radius);
  margin: -8px 0 20px;
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.sp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: linear-gradient(90deg, var(--token-bg), var(--bg-sidebar) 60%);
  border-bottom: 1px solid var(--border);
}
.sp-brand {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--token);
  white-space: nowrap;
}
.sp-desc { font-size: 12.5px; color: var(--text-muted); min-width: 0; }
.sp-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.sp-close:hover { color: var(--text); }
.sp-request {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.sp-method {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .05em;
  color: var(--ok);
  background: var(--ok-bg);
  padding: 2px 7px;
  border-radius: 5px;
  flex-shrink: 0;
}
.sp-url-input, .sp-body-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  word-break: break-all;
}
.sp-url-input:focus, .sp-body-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sp-body { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.sp-body-input { word-break: normal; white-space: pre; overflow: auto; max-height: 320px; }
.sp-body-label { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; margin-bottom: 4px; }
.sp-body-label span { font-family: var(--font-sans); font-weight: 400; color: var(--text-faint); margin-left: 6px; }
.sp-send, .sp-reset {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.sp-send { background: var(--accent); color: var(--accent-contrast); border: 1px solid var(--accent); }
.sp-send:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.sp-send:disabled { opacity: .55; cursor: default; }
.sp-reset { background: none; color: var(--text-muted); border: 1px solid var(--border-strong); font-weight: 500; }
.sp-reset:hover { color: var(--accent); border-color: var(--accent); }
.sp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
}
.sp-status { font-size: 12px; color: var(--text-muted); min-width: 0; }
.sp-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sp-result-actions:empty { display: none; }
.sp-copy {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 2px 9px;
  cursor: pointer;
}
.sp-copy:hover { color: var(--accent); border-color: var(--accent); }
.sp-output { max-height: 480px; overflow: auto; }
.sp-output img { display: block; max-width: 100%; padding: 12px; }
.sp-error { padding: 12px 14px; font-size: 13.5px; color: var(--danger); }

/* JSON tree */
.sp-json {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 14px;
}
.jt-row { padding-left: 0; }
.jt-children { padding-left: 20px; border-left: 1px solid var(--border); margin-left: 5px; }
.jt-node > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}
.jt-node > summary::before {
  content: "▸";
  display: inline-block;
  width: 13px;
  color: var(--text-faint);
  transition: transform .12s;
}
.jt-node[open] > summary::before { transform: rotate(90deg); }
.jt-node > summary:hover .jt-prev { color: var(--accent); }
.jt-key { color: var(--hl-key); }
.jt-str { color: var(--hl-str); overflow-wrap: anywhere; }
.jt-num { color: var(--hl-num); }
.jt-kw { color: var(--hl-kw); }
.jt-prev { color: var(--text-faint); font-style: italic; }
.jt-more {
  background: var(--bg-inline-code);
  border: none;
  border-radius: 4px;
  color: var(--accent);
  font-size: 10.5px;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 1px 7px;
  margin-left: 6px;
  cursor: pointer;
}
.jt-primarray {
  color: var(--text-muted);
  overflow-wrap: anywhere;
  padding: 2px 0 2px 13px;
}

.keymodal-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 20, .55); z-index: 100; }
.keymodal {
  position: fixed;
  z-index: 101;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 22px 24px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}
.keymodal h3 { margin: 0 0 8px; font-size: 17px; }
.keymodal p { font-size: 13.5px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.55; }
/* The modal lives outside .doc, so it needs its own link color. */
.keymodal a { color: var(--accent); text-decoration: none; }
.keymodal a:hover { color: var(--link-hover); text-decoration: underline; }
.keymodal input {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 14px;
}
.keymodal input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.km-actions { display: flex; gap: 8px; justify-content: flex-end; }
.km-status { margin: 0 0 12px; font-size: 13px; }
.km-status.ok { color: var(--text-muted); }
.km-status.err { color: var(--danger); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent-strong); }

/* Settings page */
.settings-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 18px;
  background: var(--bg-sidebar);
  max-width: 560px;
}
.settings-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.settings-row { display: flex; gap: 8px; margin-bottom: 12px; }
/* API key fields are type="text" so the browser's password manager does not treat them as a
   credential field and autofill the Keepa account password (the docs share keepa.com's origin).
   Masking is therefore done in CSS rather than by the input type. */
input.masked {
  -webkit-text-security: disc;
  text-security: disc;
}

.settings-row input {
  flex: 1;
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}
.settings-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Current-key context, above the input. Muted so the action feedback below stays the
   louder of the two when both are on screen. */
.settings-current { font-size: 13px; margin: 0 0 10px; color: var(--text-muted); }
.settings-current[hidden] { display: none; }

.settings-status { font-size: 13px; margin: 12px 0 0; }
.settings-status.ok { color: var(--ok); }
.settings-status.err { color: var(--danger); }

/* ---------- Field links & hover tooltip ---------- */

.tok-key a.field-link {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, currentColor 55%, transparent);
  text-underline-offset: 3px;
}
.tok-key a.field-link:hover { color: var(--accent-strong); text-decoration-style: solid; }

.field-tooltip {
  position: fixed;
  z-index: 90;
  display: none;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 14px 44px rgba(8, 12, 20, .3);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--font-sans);
  pointer-events: none;
}
.field-tooltip .ft-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-strong);
  margin-bottom: 4px;
}
.field-tooltip .ft-meta { font-weight: 400; margin-left: 4px; }
.field-tooltip .ft-body {
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 9;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.field-tooltip .ft-body table { display: none; }
.field-tooltip .ft-body ul { padding-left: 18px; margin: 4px 0 0; }
.field-tooltip .ft-body code { font-size: .85em; }

tr:target { background: var(--bg-active); }
tr:target td { border-color: var(--accent); }

/* ---------- Syntax highlighting ---------- */

.tok-key { color: var(--hl-key); }
.tok-str { color: var(--hl-str); }
.tok-num { color: var(--hl-num); }
.tok-kw  { color: var(--hl-kw); font-weight: 500; }
.tok-com { color: var(--hl-com); font-style: italic; }
.tok-fn  { color: var(--hl-fn); }

/* ---------- Misc ---------- */

::selection { background: var(--selection); }
hr { border: none; border-top: 1px solid var(--border); margin: 30px 0; }

.field-type { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }

.kbd-hint kbd {
  font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--bg-sidebar);
}

/* ---------- Mobile refinements ---------- */

/* ---------- Graph Image builder ---------- */
.gb {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-sidebar);
  padding: 4px 20px 20px;
  margin: 0 0 22px;
}
.gb-section { margin-top: 18px; }
.gb-section h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* graph type selector */
.gb-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gb-seg-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color .12s, background .12s;
}
.gb-seg-btn:hover { border-color: var(--accent); }
.gb-seg-btn strong { font-size: 13.5px; font-weight: 600; }
.gb-seg-btn span { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.gb-seg-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.gb-seg-btn.active strong { color: var(--accent-strong); }

/* generic field grid */
.gb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 16px; }
.gb-grid[hidden] { display: none; }
.gb-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.gb-field > label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.gb-hint { font-size: 11.5px; color: var(--text-faint); }
.gb input[type="text"],
.gb input[type="number"],
.gb select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.gb input[type="text"]:focus,
.gb input[type="number"]:focus,
.gb select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.gb-check { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.gb-toggles { display: flex; flex-direction: column; gap: 8px; justify-content: flex-end; }

/* colour control: swatch + default/reset affordance */
.gb-color { display: flex; align-items: center; gap: 7px; }
.gb-color input[type="color"] {
  width: 34px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  opacity: .5;
  transition: opacity .12s;
}
.gb-color.is-set input[type="color"] { opacity: 1; }
.gb-color-reset {
  font: inherit;
  font-size: 11.5px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}
.gb-color-reset:hover { border-color: var(--border-strong); color: var(--text-muted); }
.gb-color.is-set .gb-color-reset { color: var(--accent); border-color: var(--accent); }

/* csv series picker */
.gb-series { columns: 2; column-gap: 26px; }
.gb-series[hidden] { display: none; }
.gb-series-row {
  display: grid;
  grid-template-columns: auto 2.2em 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  break-inside: avoid;
  cursor: pointer;
  font-size: 13px;
}
.gb-series-row[hidden] { display: none; }
.gb-series-row > code { justify-self: end; font-size: 12px; }
.gb-series-name { overflow-wrap: anywhere; }
.gb-note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-faint); }

/* request line + output */
.gb-request { border-top: 1px solid var(--border); padding-top: 16px; }
.gb-url {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-code);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: normal;
}
.gb-actions { display: flex; gap: 10px; margin-top: 12px; }
.gb-out:not(:empty) { margin-top: 14px; }
.gb-out img { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; display: block; }
.gb-status { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; font-family: var(--font-mono); }
.gb-error {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text);
}

@media (max-width: 900px) {
  .gb { padding: 4px 14px 16px; }
  .gb-seg { grid-template-columns: 1fr; }
  .gb-series { columns: 1; }
}

@media (max-width: 900px) {
  html { scroll-padding-top: 64px; }
  body { font-size: 15px; }
  .content { padding: 20px 16px 48px; }
  .page-header h1 { font-size: 25px; }
  .lead { font-size: 15px; }
  .hero { padding: 20px 18px; }
  .hero h1 { font-size: 25px; }
  .doc h2 { font-size: 19.5px; margin-top: 34px; }
  .doc h3 { font-size: 16.5px; }
  pre { padding: 11px 12px; }
  pre code { font-size: 12.5px; }
  .endpoint-url { font-size: 12.5px; padding: 9px 12px; }
  thead th, tbody td { padding: 8px 10px; }
  td code, th code { white-space: normal; overflow-wrap: anywhere; }
  ul.csv-index-list { columns: 1; }
  .prevnext { flex-direction: column; }
  .prevnext .pn-next { text-align: left; }
  .copy-btn { opacity: 1; }

  /* Tables with 3+ columns collapse into stacked cards.
     app.js adds .responsive-stack and per-cell data-label from the thead. */
  .responsive-stack > thead { display: none; }
  .responsive-stack,
  .responsive-stack > tbody,
  .responsive-stack > tbody > tr,
  .responsive-stack > tbody > tr > td { display: block; width: 100%; }
  .responsive-stack > tbody > tr {
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  .responsive-stack > tbody > tr:last-child { border-bottom: none; }
  .responsive-stack > tbody > tr:hover { background: none; }
  .responsive-stack > tbody > tr > td { border: none; padding: 3px 0; }
  .responsive-stack > tbody > tr > td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-faint);
    margin-bottom: 1px;
  }
  .responsive-stack > tbody > tr > td:first-child::before { display: none; }
  .responsive-stack > tbody > tr > td:first-child { font-size: 14px; padding-bottom: 5px; }
}

@media print {
  .sidebar, .toc, .mobile-bar, .copy-btn, .prevnext { display: none !important; }
  .content { margin-left: 0; }
}

/* --------------------------------------------------------------------------
   Collapsible technical-reference sections (details.tech, used on mcp.html)
   -------------------------------------------------------------------------- */
details.tech {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 12px;
}
details.tech > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
}
details.tech > summary::-webkit-details-marker { display: none; }
details.tech > summary::before {
  content: "\25B8";
  color: var(--text-faint);
  transition: transform .12s;
  flex: none;
}
details.tech[open] > summary::before { transform: rotate(90deg); }
details.tech > summary:hover { background: var(--bg-hover); }
details.tech[open] > summary {
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.doc details.tech > summary h2 {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 17.5px;
}
details.tech > .tech-body { padding: 16px 16px 4px; }
.doc details.tech > .tech-body > h3:first-child { margin-top: 0; }
