/* ===== Brand tokens =====
 * Fallback values only — brand-loader.js overrides these per-visitor by
 * injecting a small <style> block from brands/<id>.json. Nothing below this
 * block should hardcode a brand color or font; use the tokens instead so any
 * brand config just works. */
:root {
  --brand-primary: #3B348B;
  --brand-secondary: #FA7051;
  --brand-dark: #141414;
  --brand-light: #C8C3EF;
  --brand-bg: #FFFFFF;
  --brand-text: #000000;
  --brand-surface: #FBFAF9;
  --brand-border: #F0EEEC;
  --brand-muted: #8A8783;
  /* Panels (search box, dialogs, menus, popups): the page background in
     light mode; in dark mode a few % lighter, derived from the brand's
     background, so they read as sitting above the page */
  --panel-bg: var(--brand-bg);
  --panel-hover: var(--brand-surface);
  --brand-input-bg: var(--panel-bg);
  --brand-accent: var(--brand-primary);
  /* docs content background; brands can override per theme (app.js) */
  --brand-content-bg: var(--brand-bg);
  --brand-font-regular: 'Stack Sans Text', sans-serif;
  --brand-font-mono: 'Source Code Pro', monospace;

  --topbar-h: 48px;
  --navbar-h: 34px;
  --header-h: calc(var(--topbar-h) + var(--navbar-h));
  /* Where the search box sits (the search dialog opens exactly on top of
     it), how wide it is, and where the token dialog opens. The "single"
     top bar layout overrides these (see "Top bar layouts" below). */
  --search-top: calc(var(--topbar-h) + 3px);
  --search-w: min(540px, calc(100vw - 24px));
  --dialog-top: calc(var(--topbar-h) + 3px);
  --footer-h: 52px;

  /* Corner radii, set by the brand's "corners" preset (see "Corners" below).
     These are the "soft" values. Pills and circles (status pill, access
     button, dots) stay round in every preset. */
  --r-small: 4px;     /* keyboard hint */
  --r-control: 6px;   /* buttons, search box, inputs, menu and sidebar items */
  --r-popup: 10px;    /* menus, dialogs, cards */
  --r-panel: 14px;    /* floating top bar, sidebar and footer */
}

/* ===== Corners: brand setting "corners" (html attribute data-corners) =====
   square / soft (default, the values above) / round. Scalar's own radii
   (cards, code blocks, its dialogs) follow too: see --scalar-radius in the
   Scalar mapping below. */
html[data-corners="square"] {
  --r-small: 2px;
  --r-control: 2px;
  --r-popup: 4px;
  --r-panel: 4px;
}

html[data-corners="round"] {
  --r-small: 6px;
  --r-control: 999px;
  --r-popup: 18px;
  --r-panel: 22px;
}

/* Structural dark theme — same brand accent tokens (primary/secondary), only
   the light/dark surface tokens change. */
html[data-theme="dark"] {
  --brand-bg: #0A0E11;
  --brand-text: #F5F4F2;
  --brand-surface: #12171B;
  --brand-border: #1C2126;
  --brand-muted: #8A8783;
  --panel-bg: color-mix(in srgb, var(--brand-bg) 94%, white);
  --panel-hover: color-mix(in srgb, var(--panel-bg) 92%, white);
  --brand-input-bg: var(--panel-bg);
  /* primary purple is too dark to read on the dark background */
  --brand-accent: var(--brand-light);
}

/* Hidden until brand-loader.js applies the resolved brand. */
html { visibility: hidden; }

/* No rubber-band bounce when scrolling past the top or bottom (macOS,
   iOS): the fixed top bar and footer stay put during the bounce while the
   sticky sidebar moves with the page, so it looked like the sidebar jumped */
html, body { overscroll-behavior-y: none; }

body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  padding-top: var(--header-h);
  padding-bottom: var(--footer-h);
}

/* ===== Top bar ===== */
#top_bar_container {
  z-index: 100;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

#top_bar {
  font-family: var(--brand-font-regular);
  background: var(--brand-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--topbar-h);
  padding: 0 20px;
  box-sizing: border-box;
}

#top_bar_logo_wrapper {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#top_bar_logo_wrapper a { display: flex; }

/* logo_height (brand-loader.js sets --brand-logo-h); never taller than the
   bar minus a little air: 40px in the split bar, more in the single bar */
#brand-logo {
  height: var(--brand-logo-h, 32px);
  max-height: calc(var(--topbar-h) - 8px);
  width: auto;
}

/* "Documentation" next to the logo, separated by a thin divider */
#page_text {
  display: flex;
  align-items: center;
  padding-left: 12px;
  border-left: 1px solid var(--brand-border);
  height: 24px;
  color: var(--brand-text);
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

/* Set by app.js when the label would collide with the search box or the
   controls (measured, since logo widths differ per brand) */
#page_text.is-squeezed,
#page_text[hidden] { display: none; }

@media (max-width: 600px) {
  #page_text { display: none; }
  #brand-logo { height: min(var(--brand-logo-h, 32px), 32px); }

  /* A logo too wide for the phone shrinks, keeping its proportions, rather
     than running under the buttons */
  #top_bar_logo_wrapper { flex-shrink: 1; }
  #top_bar_logo_wrapper,
  #top_bar_logo_wrapper a { min-width: 0; }
  #brand-logo {
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
  }
  #top_bar { gap: 16px; }
  #top_bar #top_bar_right { gap: 10px; }
}

#top_bar_right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ===== API status pill (app.js) =====
   Dot + one word; the numbers live in the details panel shown on hover,
   keyboard focus or tap. Status colours are semantic, not brand colours. */
.status-pill-wrap {
  position: relative;
}

.status-pill {
  --status-color: var(--brand-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s;
}

.status-pill:hover,
.status-pill[aria-expanded="true"] { border-color: var(--status-color); }

.status-pill:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

.status-pill.is-ok      { --status-color: #16a34a; }
.status-pill.is-slow    { --status-color: #d97706; }
.status-pill.is-down    { --status-color: #dc2626; }
.status-pill.is-unknown { --status-color: var(--brand-muted); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-color) 20%, transparent);
}

.status-details {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 230px;
  padding: 12px 14px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-popup);
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: ixt-menu-in 160ms cubic-bezier(.2, .8, .2, 1);
}

/* Hover, keyboard focus, or pinned open by a click/tap */
.status-pill-wrap:hover .status-details,
.status-pill-wrap:focus-within .status-details,
.status-pill-wrap.is-open .status-details { display: block; }

.status-details-title {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-muted);
}

.status-details dl {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}

.status-details dt { color: var(--brand-muted); }
.status-details dd { margin: 0; text-align: right; font-weight: 500; }

.status-details-updated {
  margin-top: 10px;
  font-size: 11px;
  color: var(--brand-muted);
}

.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--brand-surface);
  border-radius: var(--r-control);
  padding: 3px;
  gap: 2px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-muted);
  background: none;
  border: none;
  border-radius: var(--r-control);
  cursor: pointer;
  font-family: var(--brand-font-regular);
}

.theme-toggle-btn[aria-pressed="true"] {
  background: var(--brand-bg);
  color: var(--brand-secondary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* ===== Nav bar (search + top-right buttons) ===== */
#brand-nav {
  position: relative;
  /* --brand-nav-bg comes from a brand's optional "top_bar_gradient" setting */
  background: var(--brand-nav-bg, linear-gradient(to right, var(--brand-secondary) 20%, var(--brand-primary) 80%));
  color: #fff;
  height: var(--navbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px;
  box-sizing: border-box;
}

/* Centered, and as wide as Scalar's search dialog, which opens right on top
   of it (see .scalar-modal-search) so the box appears to expand into the
   results instead of a second search field showing up further down */
#searchbox {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--brand-input-bg);
  border: none;
  border-radius: var(--r-control);
  width: var(--search-w);
  height: 28px;
  padding: 0 7px;
  cursor: text;
  font-family: var(--brand-font-regular);
  font-size: 13px;
  text-align: left;
}

#searchbox-magGlass { color: var(--brand-secondary); }
#searchbox-placeholder { flex: 1; color: var(--brand-muted); }

#searchbox-kbd {
  font-family: var(--brand-font-mono);
  font-size: 11px;
  color: var(--brand-muted);
  border: 1px solid var(--brand-border);
  border-radius: var(--r-small);
  padding: 0 4px;
}

#searchbox:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* "Back to documentation" is only shown on Release Notes / Terms (both carry
   .page-release-notes), where it takes the search box's place on the left —
   search only makes sense on the doc page. */
#btn-topbar-right {
  display: none;
}

.page-release-notes #searchbox { display: none; }
.page-release-notes #btn-topbar-right { display: block; }

#btn-topbar-right .brand-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
}

#btn-topbar-right .brand-btn:hover {
  background: none;
  color: var(--brand-primary);
  text-decoration: underline;
}

.brand-btn {
  background: none;
  border: solid 1px;
  border-radius: var(--r-control);
  height: 2em;
  color: #fff;
  font-family: var(--brand-font-regular);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}

.brand-btn:hover {
  color: var(--brand-secondary);
  background: var(--brand-bg);
  border-color: var(--brand-secondary);
}

.brand-btn:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* ===== Footer — slim strip fixed to the viewport bottom ===== */
.brand-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--footer-h);
  z-index: 100;
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
  /* grid, not flex+space-between, so the version sits at the true midpoint
     regardless of how wide the terms/contact blocks are */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  font-family: var(--brand-font-regular);
  box-sizing: border-box;
}

.brand-footer-terms,
.brand-footer-version {
  font-size: 12px;
  color: var(--brand-muted);
  text-decoration: none;
}

.brand-footer-terms { justify-self: start; }
.brand-footer-version { justify-self: center; }

/* Terms is only a link when the brand has a terms_url (an href) */
.brand-footer-terms[href]:hover,
.brand-footer-version:hover {
  color: var(--brand-secondary);
  text-decoration: underline;
}

.brand-footer-contact {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 20px;
  font-size: 12px;
  color: var(--brand-muted);
}

.brand-footer-contact a {
  color: var(--brand-secondary);
  text-decoration: none;
}

.brand-footer-contact a:hover { text-decoration: underline; }

/* footer.style (brand-loader.js sets data-footer-style):
   "plain" (default): the rules above.
   "line": a 3px line in the top bar gradient along the top edge. Drawn as
           the top border with the gradient behind the padding box, so it
           follows rounded and pill corners (thinning out at the sides).
   "gradient": the footer is filled with the top bar gradient; text and
           links turn white.
   footer.shadow: true adds a soft shadow above (rule further down).
   footer.gradient (optional) gives the footer its own gradient instead:
   --brand-footer-bg, set by brand-loader.js. */
html[data-footer-style="line"] .brand-footer {
  border-top: 3px solid transparent;
  background:
    linear-gradient(var(--brand-surface), var(--brand-surface)) padding-box,
    var(--brand-footer-bg, var(--brand-nav-bg, linear-gradient(to right, var(--brand-secondary) 20%, var(--brand-primary) 80%))) border-box;
}

/* footer.shadow: true: a soft shadow above the footer, mirroring the top
   bar's (flat only; the floating footer has its own). The plain footer
   drops its border line for it; "line" keeps its gradient line. */
html[data-layout-style="flat"][data-footer-shadow="on"] .brand-footer {
  box-shadow: 0 -1px 0 var(--brand-border), 0 -2px 6px rgba(0, 0, 0, .06), 0 -6px 20px rgba(0, 0, 0, .10);
}

html[data-layout-style="flat"][data-footer-shadow="on"][data-footer-style="plain"] .brand-footer {
  border-top: none;
}

html[data-footer-style="gradient"] .brand-footer {
  border-top: none;
  background: var(--brand-footer-bg, var(--brand-nav-bg, linear-gradient(to right, var(--brand-secondary) 20%, var(--brand-primary) 80%)));
}

html[data-footer-style="gradient"] .brand-footer-terms,
html[data-footer-style="gradient"] .brand-footer-version,
html[data-footer-style="gradient"] .brand-footer-contact {
  color: rgba(255, 255, 255, .85);
}

html[data-footer-style="gradient"] .brand-footer-contact a,
html[data-footer-style="gradient"] .brand-footer-terms[href]:hover,
html[data-footer-style="gradient"] .brand-footer-version:hover {
  color: #fff;
}

html[data-footer-style="gradient"] .brand-footer-contact a { text-decoration: underline; text-underline-offset: 2px; }

/* ===== Scalar ↔ brand token mapping =====
 * Scalar's "default" theme defines its variables on body.light-mode /
 * body.dark-mode; setting them on .scalar-app itself wins over inheritance. */
.scalar-app.scalar-app {
  --scalar-custom-header-height: var(--header-h);

  --scalar-font: var(--brand-font-regular);
  --scalar-font-code: var(--brand-font-mono);

  --scalar-background-1: var(--brand-content-bg);
  --scalar-background-2: var(--brand-surface);
  --scalar-background-3: color-mix(in srgb, var(--brand-text) 6%, var(--brand-bg));
  --scalar-background-accent: color-mix(in srgb, var(--brand-accent) 10%, transparent);
  --scalar-border-color: var(--brand-border);

  --scalar-color-1: var(--brand-text);
  --scalar-color-2: color-mix(in srgb, var(--brand-text) 72%, var(--brand-bg));
  --scalar-color-3: var(--brand-muted);
  --scalar-color-accent: var(--brand-accent);

  /* From the corners preset: 6/8/10px for "soft". Capped at 8px so "round"
     doesn't turn code blocks and cards into pills. */
  --scalar-radius: min(var(--r-control), 8px);
  --scalar-radius-lg: calc((min(var(--r-control), 8px) + var(--r-popup)) / 2);
  --scalar-radius-xl: var(--r-popup);

  --scalar-sidebar-width: 280px;
  --scalar-sidebar-background-1: var(--brand-bg);
  --scalar-sidebar-border-color: var(--brand-border);
  --scalar-sidebar-color-1: var(--brand-text);
  --scalar-sidebar-color-2: var(--brand-text);
  --scalar-sidebar-color-active: var(--brand-secondary);
  /* sidebar.hover_color (brand-loader.js), else the secondary colour */
  --scalar-sidebar-item-hover-color: var(--brand-sidebar-hover-color, var(--brand-secondary));
  --scalar-sidebar-item-hover-background: transparent;
  --scalar-sidebar-item-active-background: transparent;
  --scalar-sidebar-font-weight-active: 700;
  --scalar-sidebar-indent-border-active: var(--brand-secondary);
  --scalar-sidebar-indent-border-hover: var(--brand-secondary);
}

/* Sidebar stops above the fixed footer instead of running underneath it.
   The sidebar's size, float, shadow and border rules are for the desktop
   sidebar only, a direct child of .scalar-app ("> .t-doc__sidebar"). On
   phones Scalar shows its own copy of it as a menu (see "Phone menu"),
   which must keep Scalar's own scrolling. Link styles apply to both. */
.scalar-app > .t-doc__sidebar {
  height: calc(100dvh - var(--header-h) - var(--footer-h)) !important;
}

/* "API Reference" title above the nav, as in the original */
.scalar-app .t-doc__sidebar::before {
  content: "API Reference";
  display: block;
  padding: 16px 20px 4px;
  font-weight: bold;
  letter-spacing: 1px;
  font-size: 1.1rem;
  color: var(--brand-text);
}

/* Hide Scalar's own sidebar search row — the gradient nav bar's search box
   opens the same modal instead. */
.scalar-app div:has(> button.bg-sidebar-b-search) {
  display: none !important;
}

/* Sidebar items: outlined orange pill on hover/active, as in the original */
.scalar-app .t-doc__sidebar a {
  border: 1px solid transparent;
  border-radius: var(--r-control);
  transition: color .2s, border-color .2s, background-color .2s;
  /* Scalar gives the active Introduction link the arrow (cursor-auto);
     every link can be clicked, so all get the hand */
  cursor: pointer;
}

.scalar-app .t-doc__sidebar a:hover {
  border-color: var(--brand-secondary);
}

/* Scalar marks the active section (Sims, Realtime, ...) with coloured text,
   but the active page (Introduction) with .bg-sidebar-b-active. Make the
   page look like an active section: coloured, bold text, no box. */
.scalar-app .t-doc__sidebar a.bg-sidebar-b-active {
  background: transparent;
  color: var(--scalar-sidebar-color-active);
  font-weight: var(--scalar-sidebar-font-weight-active);
}

.scalar-app .t-doc__sidebar a.bg-sidebar-b-active:not(:hover) {
  border-color: transparent;
}

/* Brand setting sidebar.hover_border: bottom — hover underlines the link
   instead of outlining it (square ends, so the line runs straight) */
html[data-sidebar-border="bottom"] .scalar-app .t-doc__sidebar a {
  border-radius: 0;
}

html[data-sidebar-border="bottom"] .scalar-app .t-doc__sidebar a:hover {
  border-color: transparent;
  border-bottom-color: var(--brand-secondary);
}

/* Endpoint links under a section get no line either: hover just colours the
   text, as with "full" */
html[data-sidebar-border="bottom"] .scalar-app .t-doc__sidebar ul ul a:hover {
  border-bottom-color: transparent;
}

/* Endpoint links nested under a section: no outline box (it clashed with
   Scalar's vertical indent line) — hover/active just colours the text */
.scalar-app .t-doc__sidebar ul ul a,
.scalar-app .t-doc__sidebar ul ul a:hover,
.scalar-app .t-doc__sidebar ul ul a.bg-sidebar-b-active {
  border-color: transparent;
}

/* Brand setting sidebar.hover_border: none — hover only colours the text */
html[data-sidebar-border="none"] .scalar-app .t-doc__sidebar a:hover {
  border-color: transparent;
}

/* Brand setting sidebar.hover_background: a background behind the link on
   hover (every link, endpoints too). In dark mode the same colour as a
   faint tint, so a light colour doesn't glare on the dark sidebar. */
html[data-sidebar-hover-bg="on"] .scalar-app .t-doc__sidebar a:hover {
  background-color: var(--brand-sidebar-hover-bg);
}

html[data-theme="dark"][data-sidebar-hover-bg="on"] .scalar-app .t-doc__sidebar a:hover {
  background-color: color-mix(in srgb, var(--brand-sidebar-hover-bg) 16%, transparent);
}

/* API client (Test Request / Open API Client): same blur + tint as the
   search. The blur goes on the full-screen container rather than its
   .scalar-app-exit backdrop: the container's will-change: opacity makes it
   its own backdrop root, so a blur on the backdrop inside it sees nothing. */
.scalar-container.scalar-client--open {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.scalar-container .scalar-app-exit {
  background: color-mix(in srgb, var(--brand-primary) 20%, transparent) !important;
}

/* Search modal: blur + brand tint over the whole page, top bar included */
.scalar-modal-layout:has(.scalar-modal-search) {
  /* !important: Scalar's own bg-backdrop utility wins otherwise */
  background: color-mix(in srgb, var(--brand-primary) 20%, transparent) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Doubled-up selector beats Scalar's own scoped .scalar-modal[data-v] rule */
.scalar-modal-layout .scalar-modal.scalar-modal-search {
  /* Open the dialog right on top of the nav bar's search box (3px below the
     top bar), so its input sits where the visitor clicked */
  margin-top: var(--search-top) !important;
  max-width: var(--search-w) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  /* Roll out downwards from the search box instead of Scalar's default
     fade + slide-up; the dialog is created fresh on every open */
  opacity: 1 !important;
  transform: none !important;
  animation: ixt-search-rollout 260ms cubic-bezier(.2, .8, .2, 1) backwards !important;
}

/* Starts clipped to the search box's height (28px) and unrolls to full
   size; the end state reaches past the edges so the shadow isn't cut */
@keyframes ixt-search-rollout {
  from { clip-path: inset(0 0 calc(100% - 28px) 0 round 6px); }
  to   { clip-path: inset(0 -24px -24px -24px round 8px); }
}

@media (prefers-reduced-motion: reduce) {
  .scalar-modal-layout .scalar-modal.scalar-modal-search { animation: none !important; }
}

/* Intro cards (server / auth / client libraries): rounded like the other
   panels, no accent edge */
.scalar-app .introduction-card {
  border-radius: var(--r-popup);
}

/* Tables in descriptions (webhook event types, delivery outcomes, headers):
   Scalar's fixed layout sizes the columns by the header row, so a short
   header ("Type") squeezes names like connectivity.session_rejected onto two
   lines. Size columns by their content instead, and keep a name in the first
   column on one line; the text in the other columns wraps. Doubled-up
   selector beats Scalar's own .scalar-app .markdown rules. */
.scalar-app.scalar-app .markdown table {
  table-layout: auto;
}

.scalar-app.scalar-app .markdown td:first-of-type code {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

/* Page title in a light weight, like ixt.io's large headlines; section and
   endpoint titles keep Scalar's semibold so the reference stays easy to scan */
.scalar-app h1.section-header-label {
  font-weight: 300;
  font-size: 32px;
}

/* ===== Release notes page ===== */
.page-release-notes .release-notes {
  width: min(80%, 900px);
  margin: 0 auto;
  padding: 24px 0 40px;
}

.page-release-notes .header-text {
  color: var(--brand-text);
  font-weight: 400;
}

.release-wrapper {
  background-color: color-mix(in srgb, var(--brand-light) 20%, var(--brand-surface));
  border: solid 1px color-mix(in srgb, var(--brand-text) 15%, transparent);
  color: var(--brand-text);
  padding: 12px 20px;
  border-radius: var(--r-popup);
  margin-bottom: 24px;
}

.release-wrapper h3 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 4px 0 8px;
}

.release-version { font-family: var(--brand-font-mono); }
.release-date { font-size: 14px; font-weight: 400; color: var(--brand-muted); }

.release-wrapper li { margin-bottom: 8px; }

/* Long paths and codes break instead of widening the page on phones */
.release-wrapper { overflow-wrap: anywhere; }
.release-wrapper li:last-child { margin-bottom: 0; }

/* Terms is one block of text, not a stack of cards */
.page-terms .release-wrapper {
  background-color: transparent;
  border: none;
}

/* Changelog matched to portal.ixt.io/releasenotes — default IXT brand only,
   so resellers keep their own configured fonts/colors here. */
html[data-brand="default"] .page-changelog .header-text,
html[data-brand="default"] .page-changelog .release-wrapper {
  font-family: 'DM Sans', sans-serif;
}

html[data-brand="default"][data-theme="dark"] .page-changelog .release-wrapper {
  background-color: #171D22;
  border-color: #1E252B;
}

html[data-brand="default"][data-theme="light"] .page-changelog .header-text,
html[data-brand="default"][data-theme="light"] .page-changelog .release-wrapper h3 {
  color: #1C1917;
}

html[data-brand="default"][data-theme="light"] .page-changelog .release-wrapper {
  background-color: #F5F5F4;
  border-color: #D6D3D1;
}

html[data-brand="default"][data-theme="light"] .page-changelog .release-wrapper li {
  color: rgba(0, 0, 0, 0.87);
}

/* ===== Side panels: release notes and terms (docs page, app.js) =====
   The footer's version and terms links open a panel from the right, over
   the docs (a centred dialog on desktop, see below), on the same blurred
   backdrop as the search and token dialogs.
   The panel carries its page's class (.page-changelog / .page-terms), so
   its content looks as it does on that page. */
.ixt-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  justify-content: flex-end;
  background: color-mix(in srgb, var(--brand-primary) 20%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ixt-panel-overlay[hidden] { display: none; }

/* The docs behind don't scroll while the panel is open */
html.ixt-panel-open { overflow: hidden; }

.ixt-panel {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  height: 100%;
  box-sizing: border-box;
  background: var(--brand-content-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  box-shadow: -8px 0 32px rgba(0, 0, 0, .25);
  animation: ixt-panel-in 240ms cubic-bezier(.2, .8, .2, 1);
}

/* layout: floating: the panel floats too, like the sidebar */
html[data-layout-style="floating"] .ixt-panel-overlay { padding: var(--float-gap); }

html[data-layout-style="floating"] .ixt-panel {
  border-radius: var(--float-radius);
  box-shadow: var(--float-shadow);
  overflow: hidden;
}

.ixt-panel-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  padding: 14px 14px 12px 24px;
  border-bottom: 1px solid var(--brand-border);
}

.ixt-panel-head h2 {
  flex: 1;
  margin: 0;
  font-size: 22px;
  font-weight: 400;
}

.ixt-panel-page {
  font-size: 13px;
  color: var(--brand-muted);
  text-decoration: none;
  white-space: nowrap;
}

.ixt-panel-page:hover {
  color: var(--brand-secondary);
  text-decoration: underline;
}

.ixt-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}

.ixt-panel-close:hover {
  background: color-mix(in srgb, var(--brand-text) 8%, transparent);
  color: var(--brand-text);
}

.ixt-panel-page:focus-visible,
.ixt-panel-close:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

/* The list scrolls on its own; focusable so arrow keys scroll it */
.ixt-panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 24px;
}

.ixt-panel-body:focus { outline: none; }
.ixt-panel-body:focus-visible { outline: 2px solid var(--brand-secondary); outline-offset: -2px; }

.ixt-panel-body .release-wrapper:last-child { margin-bottom: 0; }

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

/* Terms: the page's text block, without its card padding */
.ixt-panel.page-terms .release-wrapper {
  padding: 0;
  margin-bottom: 0;
}

.ixt-panel.page-terms .release-wrapper h3 { margin-top: 0; }

@keyframes ixt-panel-in {
  from { transform: translateX(32px); opacity: 0; }
}

/* Desktop: a centred dialog instead of a side panel, like the search and
   token dialogs. As tall as its content (the short terms text makes a small
   dialog), at most 85% of the window, then the content scrolls inside.
   Tablets and phones keep the side panel (full screen on phones). */
@media (min-width: 801px) {
  .ixt-panel-overlay,
  html[data-layout-style="floating"] .ixt-panel-overlay {
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
  }

  .ixt-panel,
  html[data-layout-style="floating"] .ixt-panel {
    width: min(680px, 100%);
    height: auto;
    max-height: min(85dvh, 900px);
    border-radius: var(--r-popup);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
    overflow: hidden;
  }

  .ixt-panel { animation-name: ixt-panel-pop; }
}

@keyframes ixt-panel-pop {
  from { transform: translateY(12px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ixt-panel { animation: none; }
}

@media (max-width: 600px) {
  .ixt-panel-head { padding: 10px 8px 10px 16px; gap: 12px; }
  .ixt-panel-head h2 { font-size: 20px; }
  .ixt-panel-body { padding: 16px; }
}

/* ===== Narrow screens ===== */
@media (max-width: 800px) {
  /* Just the dot on small screens, in a circle the size of the search and
     access buttons; details still open on tap */
  #status-text { display: none; }
  .status-pill {
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
  }
  .status-dot { width: 10px; height: 10px; }
  #searchbox-kbd { display: none; }
  #top_bar { padding: 0 12px; }
  .brand-footer-contact span { display: none; }
}

/* Phones: the three footer columns don't fit, so the footer becomes one row
   that wraps (to two lines in the same height if it must). The company name
   goes (it's only there when the brand has no terms link); the terms link,
   version and email stay. */
@media (max-width: 600px) {
  .brand-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    align-content: center;
    column-gap: 16px;
    row-gap: 2px;
    padding: 0 12px;
  }

  .brand-footer-terms:not([href]) { display: none; }

  .brand-footer-terms,
  .brand-footer-version,
  .brand-footer-contact { white-space: nowrap; }
}

/* "Test Request" button on code examples: icon only. The label stays in the
   DOM (visually hidden) so screen readers still announce it. Doubled class
   beats Scalar's own scoped [data-v] rules. */
.scalar-app .show-api-client-button.show-api-client-button {
  padding: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scalar-app .show-api-client-button.show-api-client-button > svg {
  width: 12px;
  height: 12px;
  margin: 0;
}

.scalar-app .show-api-client-button.show-api-client-button > span:not(.screenreader-only) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Hide Scalar's "Powered by Scalar" row at the bottom of the sidebar */
.scalar-app .darklight-reference > div:has(a[href*="scalar.com"]) {
  display: none !important;
}

/* Tag sections without a description: drop the empty left column so the
   "Operations" card sits under the heading, at the width of the content
   column, instead of floating alone on the right */
.scalar-app .tag-section-container .section-columns > .section-column:first-child:has(> .markdown:empty:only-child) {
  display: none;
}

.scalar-app .tag-section-container .section-columns:has(> .section-column:first-child > .markdown:empty:only-child) > .section-column:last-child {
  max-width: calc(50% - 24px);
}

@media (max-width: 1000px) {
  .scalar-app .tag-section-container .section-columns > .section-column:last-child {
    max-width: none !important;
  }
}

/* Operations list: left-align the method labels so methods and paths form
   two clean columns (Scalar right-aligns them in a fixed-width slot) */
.scalar-app .endpoints .endpoint-method {
  justify-content: flex-start;
  min-width: 4.5em;
}

/* Round close cross in the top-right corner of the search overlay (app.js),
   matching Scalar's API client close button */
.ixt-search-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .1);
  color: #fff;
  cursor: pointer;
  transition: background .2s;
}

.ixt-search-close:hover {
  background: rgba(255, 255, 255, .1);
}

.ixt-search-close:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* "Open API Client" sidebar button (app.js) — opens the in-page client */
.ixt-open-client {
  width: 100%;
  text-align: center;
  padding: 6px 10px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-control);
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  font-size: 14px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.ixt-open-client:hover {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
}

.ixt-open-client:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* ===== Bearer token: top-bar button + dialog (app.js) ===== */
.token-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-control);
  background: var(--brand-surface);
  color: var(--brand-muted);
  font-family: var(--brand-font-regular);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.token-btn:hover,
.token-btn.is-set {
  color: var(--brand-secondary);
  border-color: var(--brand-secondary);
}

.token-btn:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

/* Green dot when a token is saved */
.token-dot {
  display: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #23c55e;
}

.token-btn.is-set .token-dot { display: block; }

/* No Scalar on release notes / terms, so nothing to authorize there */
.page-release-notes .token-btn { display: none; }

.ixt-token-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--dialog-top) 12px 0;
  background: color-mix(in srgb, var(--brand-primary) 20%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ixt-token-overlay[hidden] { display: none; }

.ixt-token-dialog {
  width: min(480px, 100%);
  box-sizing: border-box;
  padding: 20px;
  border-radius: var(--r-popup);
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  animation: ixt-search-rollout 260ms cubic-bezier(.2, .8, .2, 1) backwards;
}

.ixt-token-dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.ixt-token-help {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--brand-muted);
}

.ixt-token-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
}

.ixt-token-field {
  display: flex;
  gap: 6px;
}

.ixt-token-field input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-control);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-mono);
  font-size: 13px;
}

.ixt-token-field input:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 0;
}

.ixt-token-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.ixt-token-spacer { flex: 1; }

.ixt-token-dialog button {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-control);
  background: var(--brand-surface);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  font-size: 13px;
  cursor: pointer;
}

.ixt-token-dialog button:hover {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
}

.ixt-token-dialog button:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 1px;
}

.ixt-token-dialog .ixt-token-save {
  border-color: var(--brand-secondary);
  background: var(--brand-secondary);
  color: #fff;
  font-weight: 600;
}

.ixt-token-dialog .ixt-token-save:hover { color: #fff; filter: brightness(1.08); }

/* Text-link style for "Get an access token" */
.ixt-token-dialog .ixt-token-get {
  padding: 0;
  border: none;
  background: none;
  color: var(--brand-secondary);
  font-size: 12px;
}

.ixt-token-dialog .ixt-token-get:hover { text-decoration: underline; }

@media (max-width: 800px) {
  #token-btn-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ixt-token-dialog { animation: none; }
}

/* The Introduction's own Bearer token field is hidden: the top-bar Token
   button is the one place to set it (the API client keeps its own field) */
.scalar-app .scalar-reference-intro-auth {
  display: none !important;
}

/* The Introduction's "Client Libraries" picker is hidden too: each endpoint's
   code sample has its own language menu */
.scalar-app .scalar-reference-intro-clients {
  display: none !important;
}

/* ===== Access menu: round button + dropdown (app.js) =====
   Mirrors the user circle on portal.ixt.io. Grey + open padlock = no token,
   green + closed padlock = token set. */
.access-menu {
  position: relative;
}

.access-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--brand-surface);
  color: var(--brand-muted);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}

.access-btn:hover,
.access-btn[aria-expanded="true"] {
  border-color: var(--brand-secondary);
  color: var(--brand-secondary);
}

.access-btn.is-set {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}

.access-btn.is-set:hover,
.access-btn.is-set[aria-expanded="true"] {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}

.access-btn:focus-visible {
  outline: 2px solid var(--brand-secondary);
  outline-offset: 2px;
}

/* Padlock open when no token, closed when one is set */
.access-btn .lock-closed { display: none; }
.access-btn.is-set .lock-open { display: none; }
.access-btn.is-set .lock-closed { display: block; }

.access-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 200;
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--brand-border);
  border-radius: var(--r-popup);
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  transform-origin: top right;
  animation: ixt-menu-in 160ms cubic-bezier(.2, .8, .2, 1);
}

.access-menu-panel[hidden] { display: none; }

@keyframes ixt-menu-in {
  from { opacity: 0; transform: scale(.96) translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.access-menu-section + .access-menu-section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--brand-border);
}

.access-menu-heading {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-muted);
}

.access-menu-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 10px 6px;
  font-size: 13px;
  color: var(--brand-muted);
}

.access-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-muted);
}

.access-menu-status.is-set { color: var(--brand-text); }
.access-menu-status.is-set .access-status-dot { background: #16a34a; }

.access-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--r-control);
  background: none;
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.access-menu-item[hidden] { display: none; }

.access-menu-item:hover,
.access-menu-item:focus-visible {
  background: var(--brand-surface);
  color: var(--brand-secondary);
  outline: none;
}

/* Selected theme */
.access-menu-item[aria-checked="true"] {
  color: var(--brand-secondary);
  font-weight: 600;
}

.access-menu-item[aria-checked="true"]::after {
  content: "✓";
  margin-left: auto;
}

/* No Scalar on release notes / terms: only the theme section there */
.page-release-notes .access-token-section { display: none; }
.page-release-notes .access-token-section + .access-menu-section {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ===== Top bar layouts =====
   Chosen per brand in brands/*.yaml (brand-loader.js sets the html
   attributes):
   - "top_bar_layout": "split" (default) — white top bar + gradient row with
     the search below it
   - "top_bar_layout": "single" — one bar, same total height (82px), logo,
     search and controls centred vertically; with top_bar_style
       "gradient" (default) — gradient fills the whole bar
       "line" — white bar, 3px gradient line underneath
       "plain" — white bar, no line
     top_bar.shadow: true adds a shadow under any of them (data-topbar-shadow)
     (the html attribute data-topbar-gradient is "fill" / "line" / "plain") */
html[data-topbar="single"] {
  --topbar-h: 82px;
  --navbar-h: 0px;
  --search-top: calc((var(--topbar-h) - 28px) / 2);
  --search-w: clamp(140px, calc(100vw - 480px), 460px);
  --dialog-top: calc(var(--header-h) + 8px);
}

html[data-topbar="single"][data-topbar-gradient="line"] {
  --topbar-h: 79px;
  --navbar-h: 3px;
}

/* The gradient row collapses (to nothing, or to the 3px line); its contents
   (search box, back button) are positioned against the whole fixed header */
html[data-topbar="single"] #brand-nav {
  position: static;
  padding: 0;
}

html[data-topbar="single"][data-topbar-gradient="fill"] #brand-nav,
html[data-topbar="single"][data-topbar-gradient="plain"] #brand-nav {
  height: 0;
  background: none;
}

html[data-topbar="single"] #searchbox {
  top: var(--search-top);
}

html[data-topbar="single"][data-topbar-gradient="line"] #searchbox,
html[data-topbar="single"][data-topbar-gradient="plain"] #searchbox {
  border: 1px solid var(--brand-border);
}

/* Release notes / terms: "Back to documentation" takes the search box's
   place in the middle of the bar */
html[data-topbar="single"] .page-release-notes #btn-topbar-right {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
}

html[data-topbar="single"][data-topbar-gradient="line"] #btn-topbar-right .brand-btn,
html[data-topbar="single"][data-topbar-gradient="plain"] #btn-topbar-right .brand-btn {
  color: var(--brand-text);
}

html[data-topbar="single"][data-topbar-gradient="line"] #btn-topbar-right .brand-btn:hover,
html[data-topbar="single"][data-topbar-gradient="plain"] #btn-topbar-right .brand-btn:hover {
  color: var(--brand-secondary);
}

/* --- top_bar.shadow: true: a soft shadow under the bar, in any look.
   Flat only: the floating bar has its own shadow. Under the white "plain"
   bar it's lighter, after a 1px border-coloured edge so the bar still has
   an edge in dark mode where shadows barely show; under coloured bars it's
   a little stronger so it shows under a dark bar too. --- */
html[data-layout-style="flat"][data-topbar-shadow="on"] #top_bar_container {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .10), 0 8px 24px rgba(0, 0, 0, .16);
}

html[data-layout-style="flat"][data-topbar-shadow="on"][data-topbar-gradient="plain"] #top_bar_container {
  box-shadow: 0 1px 0 var(--brand-border), 0 2px 6px rgba(0, 0, 0, .06), 0 6px 20px rgba(0, 0, 0, .10);
}

/* --- "fill": the gradient is the bar --- */
html[data-topbar="single"][data-topbar-gradient="fill"] #top_bar_container {
  background: var(--brand-nav-bg, linear-gradient(to right, var(--brand-secondary) 20%, var(--brand-primary) 80%));
}

html[data-topbar="single"][data-topbar-gradient="fill"] #top_bar {
  background: transparent;
}

html[data-topbar="single"][data-topbar-gradient="fill"] #page_text {
  color: #fff;
  border-left-color: rgba(255, 255, 255, .35);
}

html[data-topbar="single"][data-topbar-gradient="fill"] #btn-topbar-right .brand-btn,
html[data-topbar="single"][data-topbar-gradient="fill"] #btn-topbar-right .brand-btn:hover {
  color: #fff;
}

/* Status pill and access circle as translucent "glass" chips on the
   gradient (a set token keeps its solid green) */
html[data-topbar="single"][data-topbar-gradient="fill"] .status-pill,
html[data-topbar="single"][data-topbar-gradient="fill"] .access-btn:not(.is-set) {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

html[data-topbar="single"][data-topbar-gradient="fill"] .status-pill:hover,
html[data-topbar="single"][data-topbar-gradient="fill"] .status-pill[aria-expanded="true"],
html[data-topbar="single"][data-topbar-gradient="fill"] .access-btn:not(.is-set):hover,
html[data-topbar="single"][data-topbar-gradient="fill"] .access-btn:not(.is-set)[aria-expanded="true"] {
  background: rgba(255, 255, 255, .24);
  border-color: rgba(255, 255, 255, .7);
  color: #fff;
}

html[data-topbar="single"][data-topbar-gradient="fill"] .status-dot {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .35);
}

@media (max-width: 800px) {
  html[data-topbar="single"] {
    --search-w: clamp(120px, calc(100vw - 260px), 460px);
  }
}

/* --- The middle item as an icon (app.js sets data-topbar-center="icon") ---
   When the centred search box (docs page) or "Back to documentation"
   (release notes, terms) would touch the logo or the buttons, it turns into
   a round button like the access button, first in the row on the right.
   The search dialog it opens gets the full width again. */
html[data-topbar-center="icon"] {
  --search-w: min(540px, calc(100vw - 24px));
}

/* Split top bar on a phone: the search has moved up into the bar, so its
   gradient row below shrinks to a thin gradient line */
html[data-topbar="split"][data-topbar-center="icon"] {
  --navbar-h: 4px;
}

html[data-topbar-center="icon"] #searchbox,
html[data-topbar-center="icon"] .page-release-notes #btn-topbar-right {
  position: static;
  transform: none;
  flex-shrink: 0;
  height: auto;
}

html[data-topbar-center="icon"] #searchbox,
html[data-topbar-center="icon"] #btn-topbar-right .brand-btn {
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--brand-surface);
  color: var(--brand-text);
  cursor: pointer;
}

/* Arrow only; the label stays as (zero-size) text for screen readers */
html[data-topbar-center="icon"] #btn-topbar-right .brand-btn { font-size: 0; gap: 0; }
html[data-topbar-center="icon"] #btn-topbar-right .brand-btn svg { width: 16px; height: 16px; }

html[data-topbar-center="icon"] #searchbox:hover,
html[data-topbar-center="icon"] #btn-topbar-right .brand-btn:hover {
  border-color: var(--brand-secondary);
  background: var(--brand-surface);
  color: var(--brand-secondary);
  text-decoration: none;
}

html[data-topbar-center="icon"] #searchbox-placeholder,
html[data-topbar-center="icon"] #searchbox-kbd { display: none; }

html[data-topbar-center="icon"] #searchbox-magGlass { font-size: 15px; line-height: 1; }

/* On the gradient bar: a "glass" chip like the status pill and access button */
html[data-topbar-center="icon"][data-topbar-gradient="fill"] #searchbox,
html[data-topbar-center="icon"][data-topbar-gradient="fill"] #btn-topbar-right .brand-btn {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .35);
  color: #fff;
}

html[data-topbar-center="icon"][data-topbar-gradient="fill"] #searchbox:hover,
html[data-topbar-center="icon"][data-topbar-gradient="fill"] #btn-topbar-right .brand-btn:hover {
  background: rgba(255, 255, 255, .24);
  border-color: rgba(255, 255, 255, .7);
  color: #fff;
}

html[data-topbar-center="icon"][data-topbar-gradient="fill"] #searchbox-magGlass { color: #fff; }

/* ===== layout_style: floating =====
   The top bar, the sidebar and the footer sit inset from the window edges
   and from each other, with rounded corners and a soft shadow, so they look
   like they float. The page behind them gets the docs content colour, so
   the gaps read as one surface with the docs. The header space (--header-h)
   and the footer space grow by the gaps, so content starts and ends where it
   should. */
html[data-layout-style="floating"],
html[data-sidebar-style="floating"] {
  --float-gap: 10px;
  --float-radius: var(--r-panel);
  --float-shadow: 0 0 0 1px var(--brand-border), 0 2px 6px rgba(0, 0, 0, .08), 0 8px 28px rgba(0, 0, 0, .18);
}

html[data-layout-style="floating"] {
  --header-h: calc(var(--topbar-h) + var(--navbar-h) + 2 * var(--float-gap));
  --footer-space: calc(var(--footer-h) + 2 * var(--float-gap));
  background: var(--brand-content-bg);
}

html[data-layout-style="floating"] body {
  background: var(--brand-content-bg);
  padding-bottom: var(--footer-space);
}

/* Top bar */
html[data-layout-style="floating"] {
  --topbar-radius: var(--float-radius);
}

/* corners: round makes the top bar a pill: radius half its height, and a
   little more side padding so the logo and buttons clear the curves */
html[data-layout-style="floating"][data-corners="round"] {
  --topbar-radius: calc((var(--topbar-h) + var(--navbar-h)) / 2);
}

html[data-layout-style="floating"][data-corners="round"] #top_bar {
  padding: 0 calc(var(--topbar-radius) * .6);
}

html[data-layout-style="floating"] #top_bar_container {
  top: var(--float-gap);
  left: var(--float-gap);
  right: var(--float-gap);
  width: auto;
  border-radius: var(--topbar-radius);
  box-shadow: var(--float-shadow);
}

/* Round the parts that paint a background (no overflow: hidden, which would
   clip the status and access menus) */
html[data-layout-style="floating"] #top_bar {
  border-radius: var(--topbar-radius) var(--topbar-radius) 0 0;
}

html[data-layout-style="floating"] #brand-nav {
  border-radius: 0 0 var(--topbar-radius) var(--topbar-radius);
}

html[data-layout-style="floating"][data-topbar="single"][data-topbar-gradient="fill"] #top_bar,
html[data-layout-style="floating"][data-topbar="single"][data-topbar-gradient="plain"] #top_bar {
  border-radius: var(--topbar-radius);
}

/* Pill with the thin gradient line: the bar is fully round and the line
   runs under its straight part only */
html[data-layout-style="floating"][data-corners="round"][data-topbar="single"][data-topbar-gradient="line"] #top_bar {
  border-radius: var(--topbar-radius);
}

html[data-layout-style="floating"][data-corners="round"][data-topbar="single"][data-topbar-gradient="line"] #brand-nav {
  margin: 0 var(--topbar-radius);
  border-radius: 3px;
}

/* Search dialog and token dialog open in the window, so move them down by
   the gap too */
html[data-layout-style="floating"] .scalar-modal-layout .scalar-modal.scalar-modal-search {
  margin-top: calc(var(--search-top) + var(--float-gap)) !important;
}

html[data-layout-style="floating"][data-topbar="split"] {
  --dialog-top: calc(var(--float-gap) + var(--topbar-h) + 3px);
}

/* Phones: the search dialog opens below the round close cross (8px from
   the top, 36px tall) instead of over the search box, and across the full
   width. The second selector beats the floating rule above. */
@media (max-width: 600px) {
  html .scalar-modal-layout .scalar-modal.scalar-modal-search,
  html[data-layout-style="floating"] .scalar-modal-layout .scalar-modal.scalar-modal-search {
    margin-top: 52px !important;
    max-width: calc(100vw - 24px) !important;
  }
}

/* Footer */
html[data-layout-style="floating"] .brand-footer {
  left: var(--float-gap);
  right: var(--float-gap);
  bottom: var(--float-gap);
  width: auto;
  border-top: none;
  border-radius: var(--float-radius);
  box-shadow: var(--float-shadow);
}

html[data-layout-style="floating"][data-footer-style="line"] .brand-footer {
  border-top: 3px solid transparent;
}

/* corners: round makes the footer a pill too, matching the top bar */
html[data-layout-style="floating"][data-corners="round"] .brand-footer {
  border-radius: calc(var(--footer-h) / 2);
  padding: 0 calc(var(--footer-h) * .6);
}

/* Sidebar: ends one gap above the footer. The floating look itself is keyed
   on data-sidebar-style, which the floating layout always sets, and which
   sidebar_style: floating sets on its own in the flat layout (rules at the
   end of this file). */
html[data-layout-style="floating"] .scalar-app > .t-doc__sidebar {
  height: calc(100dvh - var(--header-h) - var(--footer-space)) !important;
}

html[data-sidebar-style="floating"] .scalar-app > .t-doc__sidebar {
  margin-left: var(--float-gap);
  width: calc(var(--scalar-sidebar-width) - var(--float-gap)) !important;
  min-width: calc(var(--scalar-sidebar-width) - var(--float-gap));
  border: none;
  border-radius: var(--float-radius);
  box-shadow: var(--float-shadow);
  overflow: hidden;
}

@media (max-width: 800px) {
  html[data-layout-style="floating"],
  html[data-sidebar-style="floating"] {
    --float-gap: 6px;
    --float-radius: min(var(--r-panel), 10px);
  }
}

/* ===== Panels: one background for every popup =====
   --panel-bg (see the colour tokens at the top): white in light mode, the
   page background +6% white in dark mode. Hover rows go a little lighter
   still in dark mode. */
.status-details,
.ixt-token-dialog,
.access-menu-panel {
  background: var(--panel-bg);
}

.access-menu-item:hover,
.access-menu-item:focus-visible {
  background: var(--panel-hover);
}

/* Scalar's search dialog: re-point its main background variable inside the
   dialog only */
.scalar-modal-layout .scalar-modal.scalar-modal-search {
  --scalar-background-1: var(--panel-bg);
  background: var(--panel-bg) !important;
}

/* Brand setting api_client: false — hide every way into the in-page API
   client (Scalar's Test Request buttons are switched off in app.js). The
   access token stays: it still fills the code examples. */
html[data-api-client="off"] .ixt-open-client,
html[data-api-client="off"] .access-menu-item[data-action="get-token"],
html[data-api-client="off"] .ixt-token-get {
  display: none !important;
}

/* An API without the token endpoint (the portal API): nothing to get a
   token from here, the token is pasted (app.js sets data-token-endpoint) */
html[data-token-endpoint="off"] .access-menu-item[data-action="get-token"],
html[data-token-endpoint="off"] .ixt-token-get {
  display: none !important;
}

/* Phones: no API client either. On a phone people look things up and copy
   code examples; sending a test request means typing client credentials or
   pasting a token there, and the client is cramped at that width. The same
   entry points as api_client: false, plus Scalar's Test Request buttons
   (that setting switches them off in Scalar, which can't depend on the
   screen width) and the code example's bottom strip they sit alone in.
   With nothing to send, the access (padlock) menu goes too, on every page;
   the theme then follows the phone's light/dark setting (or a choice saved
   earlier in this browser). */
@media (max-width: 600px) {
  .access-menu,
  .ixt-open-client,
  .access-menu-item[data-action="get-token"],
  .ixt-token-get,
  .scalar-app .show-api-client-button,
  .scalar-app .request-card > .scalar-card-content:has(> .flex > .show-api-client-button:only-child) {
    display: none !important;
  }
}

/* ===== footer.position: "end" =====
   The footer comes after the docs instead of being pinned to the window
   bottom: visitors see it once they scroll to the end. Kept last in this
   file so it wins over the fixed-footer rules above (flat and floating).
   The body becomes a full-height column so that on short pages (release
   notes, terms) the footer still sits at the window bottom. */
html[data-footer-position="end"] body {
  padding-bottom: 0;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

html[data-footer-position="end"] .brand-footer {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  width: auto;
  flex-shrink: 0;
  margin-top: auto;
}

html[data-footer-position="end"][data-layout-style="floating"] .brand-footer {
  margin: auto var(--float-gap) var(--float-gap);
}

/* No footer to stop above: the sidebar runs to the window bottom (one gap
   short of it when floating) */
html[data-footer-position="end"] .scalar-app > .t-doc__sidebar {
  height: calc(100dvh - var(--header-h)) !important;
}

html[data-footer-position="end"][data-layout-style="floating"] .scalar-app > .t-doc__sidebar {
  height: calc(100dvh - var(--header-h) - var(--float-gap)) !important;
}

/* ===== sidebar.shadow: true in the flat layout =====
   A soft shadow along the sidebar's right edge instead of its border line,
   like the top bar's and footer's shadows. Lifted above the docs content
   so the content's background doesn't cover the shadow. */
html[data-sidebar-style="flat"][data-sidebar-shadow="on"] .scalar-app > .t-doc__sidebar {
  position: sticky;
  z-index: 2;
  border-right-color: transparent;
  box-shadow: 1px 0 0 var(--brand-border), 2px 0 6px rgba(0, 0, 0, .06), 6px 0 20px rgba(0, 0, 0, .10);
}

/* ===== sidebar_style: "floating" in the flat layout =====
   Only the sidebar floats: one gap below the top bar and above the footer
   (or the window bottom with footer.position: end). */
html[data-layout-style="flat"][data-sidebar-style="floating"] .scalar-app > .t-doc__sidebar {
  top: calc(var(--header-h) + var(--float-gap)) !important;
  margin-top: var(--float-gap);
  height: calc(100dvh - var(--header-h) - var(--footer-h) - 2 * var(--float-gap)) !important;
}

html[data-footer-position="end"][data-layout-style="flat"][data-sidebar-style="floating"] .scalar-app > .t-doc__sidebar {
  height: calc(100dvh - var(--header-h) - 2 * var(--float-gap)) !important;
}

/* ===== dark_mode: false =====
   The brand is light only: app.js keeps the light theme, and the theme
   choice disappears from the top bar menu. */
html[data-dark-mode="off"] .access-menu-section[aria-labelledby="access-theme-heading"] {
  display: none;
}

/* ===== shadow: false on a floating part =====
   top_bar.shadow, sidebar.shadow and footer.shadow: false take the floating
   shadow away and keep only the thin outline, so the part still has an
   edge. Left out ("auto"), floating parts keep their shadow. */
html[data-layout-style="floating"][data-topbar-shadow="off"] #top_bar_container,
html[data-layout-style="floating"][data-footer-shadow="off"] .brand-footer,
html[data-sidebar-style="floating"][data-sidebar-shadow="off"] .scalar-app > .t-doc__sidebar {
  box-shadow: 0 0 0 1px var(--brand-border);
}

/* ===== Phone menu =====
   Below Scalar's 1000px breakpoint the sidebar becomes a menu under the
   "☰ Introduction" row: Scalar's own copy of the sidebar in .t-doc__header,
   filling the rest of the window and scrolling by itself. It only needs its
   end kept clear of the fixed footer (no footer to clear with
   footer.position: end), and its scrolling kept from passing on to the page. */
.scalar-app .t-doc__header > .t-doc__sidebar {
  margin-bottom: var(--footer-h);
  overscroll-behavior: contain;
}

html[data-layout-style="floating"] .scalar-app .t-doc__header > .t-doc__sidebar {
  margin-bottom: var(--footer-space);
}

html[data-footer-position="end"] .scalar-app .t-doc__header > .t-doc__sidebar {
  margin-bottom: 0;
}
