/* ===== 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;
  --brand-input-bg: var(--brand-bg);
  --brand-font-regular: 'Stack Sans Text', sans-serif;
  --brand-font-mono: 'Source Code Pro', monospace;
}

/* Structural dark theme — same brand accent tokens (primary/secondary), only
   the light/dark surface tokens change. Toggled via brand-loader.js/app.js,
   independent of which brand is active. */
html[data-theme="dark"] {
  --brand-bg: #0A0E11;
  --brand-text: #F5F4F2;
  --brand-surface: #12171B;
  --brand-border: #1C2126;
  --brand-muted: #8A8783;
  --brand-input-bg: var(--brand-dark);
}

/* Hidden until brand-loader.js applies the resolved brand, to avoid a flash
   of the fallback brand; loader (or its 1.5s safety timeout) reveals it. */
html { visibility: hidden; }

body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
}

rapidoc { --font-regular: var(--brand-font-regular); }

/* ===== Top bar ===== */
#top_bar_container {
  z-index: 2;
  height: fit-content;
  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;
  position: relative;
  height: 48px;
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
  z-index: 1;
}

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

#brand-logo {
  height: 32px;
  width: auto;
}

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

#status-bar {
  text-align: left;
  font-family: var(--brand-font-mono);
  font-size: smaller;
}

.theme-toggle {
  display: flex;
  align-items: center;
  background: var(--brand-surface);
  border-radius: 6px;
  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: 6px;
  cursor: pointer;
  font-family: var(--brand-font-regular);
}

.theme-toggle-btn svg { flex: 0 0 auto; }

.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;
}

#page_text {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--brand-secondary);
  font-size: large;
}

/* ===== Nav bar (search + auth + top-right buttons) ===== */
#brand-nav {
  background: linear-gradient(to right, var(--brand-secondary) 20%, var(--brand-primary) 80%);
  background-blend-mode: soft-light;
  color: #fff;
  width: 100%;
  height: 34px;
  position: relative;
  float: left;
  z-index: 1;
  border-bottom: solid 1px var(--brand-dark);
}

#searchbox {
  position: absolute;
  top: 3.3px;
  left: 5px;
  background-color: var(--brand-input-bg);
  border-radius: 6px;
  width: 280px;
  height: 28px;
}

#searchbox-magGlass {
  color: var(--brand-secondary);
  position: absolute;
  left: 7px;
  top: 5px;
}

#brand-search-input {
  width: 70%;
  position: relative;
  float: left;
  margin-top: 1px;
  margin-left: 25px;
  height: 25px;
  border: none;
  background: none;
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
}

#brand-search-input:focus,
#brand-search-input:focus-visible {
  border: none;
  background: none;
  box-shadow: none;
  outline: none;
}

#bearerdiv {
  float: left;
  padding: 2px;
  display: none;
}

.brand-input {
  margin-top: 4px;
  margin-left: 10px;
  width: 15em;
  height: 2em;
  border-radius: 6px;
  border: none;
  padding-left: 5px;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: var(--brand-font-regular);
}

.brand-btn {
  margin-top: 4px;
  margin-right: 10px;
  float: right;
  background: none;
  border: solid 1px;
  border-radius: 6px;
  width: fit-content;
  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);
  border: 1px solid var(--brand-secondary);
}

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

/* Hidden on the doc page itself — a "back to documentation" link makes no
   sense there. Shown only on Release Notes / Terms and Conditions, which
   both carry .page-release-notes. */
#btn-topbar-right {
  display: none;
  position: fixed;
  left: 5px;
  top: 48px;
  width: fit-content;
  z-index: 2;
}

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

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

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

/* ===== Search overlay ===== */
#searchbackblur {
  position: fixed;
  left: 0;
  margin-top: 35px;
  width: 100vw;
  height: 100vh;
  background: color-mix(in srgb, var(--brand-primary) 20%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9;
  display: none;
}

#search-result-view {
  padding: 50px;
  overflow: visible;
  position: relative;
  top: 35px;
  margin-left: auto;
  margin-right: auto;
  width: 80%;
  max-height: 500px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  background: linear-gradient(to right top, var(--brand-secondary) 20%, var(--brand-primary) 80%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  display: none;
  z-index: 10;
}

#scrollable-results {
  max-height: 100%;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

.searchlinks {
  padding: 5px;
  width: 100%;
  color: var(--brand-text);
}

.searchResultCard {
  color: var(--brand-text);
  background-color: rgba(255, 255, 255, .2);
  border: solid 1px rgba(255, 255, 255, .2);
  border-radius: 6px;
  transition: background-color .2s, border-color .2s, color .2s;
}

.searchResultCard:hover {
  border: solid 1px var(--brand-secondary);
  color: var(--brand-secondary);
  background-color: color-mix(in srgb, var(--brand-primary) 90%, transparent);
}

.brand-mono-text {
  font-family: var(--brand-font-mono) !important;
}

/* ===== Sidebar ===== */
#brand-sidebar {
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-left: 10px;
  float: left;
  height: 100%;
  width: 280px;
  border-right: solid 1px var(--brand-border);
  background-color: var(--brand-bg);
  position: relative;
  font-size: 1rem;
}

#brand-sidebar ul {
  list-style: none;
  padding-left: 0;
  margin: 0 0 12px;
}

#brand-sidebar li {
  margin-bottom: 6px;
}

.brand-sidebar-title {
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 12px;
  color: var(--brand-text);
}

#brand-sidebar .activeNavItem {
  color: var(--brand-secondary) !important;
  border: 1px solid var(--brand-secondary);
  border-radius: 6px;
  font-weight: 700;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-secondary) 8%, transparent);
  transition: background .2s, color .2s;
}

#brand-sidebar .expanded-tag {
  color: var(--brand-secondary) !important;
  font-weight: 700;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-secondary) 8%, transparent);
  transition: background .2s, color .2s;
}

.sidebar-tag-header {
  color: var(--brand-text);
  border: solid 1px transparent;
  border-radius: 6px;
}

.sidebar-tag-header:hover {
  color: var(--brand-secondary) !important;
  border: solid 1px var(--brand-secondary);
}

a.brand-sidebar-link {
  text-decoration: none;
  color: var(--brand-text);
  cursor: pointer;
  font-size: .8rem;
  margin-bottom: 5px;
  transition: color .2s;
  width: fit-content;
  border: solid 1px transparent;
}

a.brand-sidebar-link:hover {
  border: solid 1px var(--brand-secondary);
  color: var(--brand-secondary) !important;
  border-radius: 6px;
}

#docWrap {
  margin-left: 295px;
  /* absolute (not fixed) so 100%-height math resolves against #rapidoc-wrapper,
     which is already inset from the viewport — a fixed child here would
     instead size itself against the full viewport and overflow past the
     bottom by #rapidoc-wrapper's own top offset. */
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  min-width: 80%;
  max-width: 100%;
}

rapi-doc::part(section-overview-title) {
  color: var(--brand-text);
}

#rapidoc-wrapper {
  position: fixed;
  top: 82px; /* top bar (48px) + nav bar (34px) */
  left: 0;
  width: 100%;
  bottom: 52px; /* leaves room for the fixed site footer below */
}

.content_block {
  position: fixed;
  top: 82px; /* top bar (48px) + nav bar (34px) */
  left: 0;
  width: 100%;
  bottom: 52px; /* leaves room for the fixed site footer below */
}

.center_block {
  position: relative;
  width: 80%;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1200px), (orientation: portrait) {
  #brand-sidebar {
    display: none !important;
    position: absolute;
    left: 0;
    width: 210px;
    height: 100%;
  }
  .responsive-status { display: none !important; }
  #docWrap { margin-left: 10px; width: 90%; }
}

/* ===== Status labels (semantic — intentionally not brand-colored) ===== */
.label {
  width: fit-content;
  height: fit-content;
  padding: 4px;
  color: #fff;
  border-radius: 6px;
  font-family: var(--brand-font-regular);
  font-size: small;
  font-weight: bolder;
}

/* ===== Footer — a slim, quiet strip, fixed to the viewport bottom =====
 * Lives as its own top-level element (not slotted into rapi-doc), so it's
 * always visible regardless of how far the doc content scrolls, and isn't
 * subject to rapi-doc's own internal shadow-DOM scroll-container sizing. */
.brand-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 52px;
  z-index: 2;
  background: var(--brand-surface);
  border-top: 1px solid var(--brand-border);
  /* grid, not flex+space-between: the version needs to sit at the true
     midpoint of the bar regardless of how wide the name/contact blocks are,
     which space-between can't do since it only gaps between neighbors. */
  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 {
  font-size: 12px;
  color: var(--brand-muted);
  text-decoration: none;
  margin: 0;
  justify-self: start;
}

/* Only styled as an interactive link when a brand actually has a terms_url
   (an href) — otherwise it's plain company-name text, no hover affordance. */
.brand-footer-terms[href]:hover {
  color: var(--brand-secondary);
  text-decoration: underline;
}

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

.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;
}

table { border-radius: 8px !important; }

/* ===== rapi-doc part overrides ===== */
rapi-doc::part(section-navbar) {
  background-color: var(--brand-bg);
  color: var(--brand-dark) !important;
  border-right: solid 1px var(--brand-dark);
  display: none !important;
}

rapi-doc::part(section-navbar-search) { border-color: transparent !important; }
rapi-doc::part(nav-bar) a[href="#overview"] { color: var(--brand-text); font-weight: 700; }
rapi-doc::part(nav-bar) { color: var(--brand-text); }

rapi-doc::part(section-navbar-item) {
  color: var(--brand-text);
  border-top: solid 1px transparent;
  border-bottom: solid 1px transparent;
  border-radius: 6px;
  margin-left: 10px;
  margin-top: 2px;
  width: 92%;
}

rapi-doc::part(section-navbar-item):hover {
  background-color: var(--brand-bg);
  color: var(--brand-secondary);
  border-radius: 6px;
  border: solid 1px var(--brand-secondary);
}

rapi-doc::part(section-navbar-active-item) {
  color: #fff !important;
  border: solid 1px var(--brand-secondary);
  background-color: var(--brand-secondary);
}

rapi-doc::part(section-navbar-active-item):hover {
  color: #fff !important;
  background-color: var(--brand-secondary);
}

rapi-doc::part(btn-clear-filter) { border-radius: 15px; color: #fff; }

rapi-doc::part(textbox-nav-filter) {
  width: 100%;
  background: var(--brand-bg);
  color: var(--brand-text);
  border: none;
  border-radius: 6px;
}

rapi-doc::part(section-servers) {
  margin-left: auto;
  margin-right: auto;
  width: 90%;
  border-radius: 10px;
  border-left: 4px solid var(--brand-secondary);
  background: var(--brand-surface);
  padding: 1.25rem 1.5rem;
  color: var(--brand-text);
  accent-color: var(--brand-secondary);
}

rapi-doc::part(btn) { border-radius: 8px; }

/* ===== Release notes page ===== */
.page-release-notes #searchbox { display: none; }

.page-release-notes .header-text {
  padding: 10px;
  color: var(--brand-text);
}

.page-release-notes .scrollable_block {
  z-index: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  height: 100%; /* .content_block (its parent) is already inset top+bottom */
}

.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: 10px 10px 10px 20px;
  border-radius: 8px;
  margin-bottom: 40px;
  font-family: var(--brand-font-regular);
}

.release-wrapper li { margin-bottom: 12px; }
.release-wrapper li:last-child { margin-bottom: 0; }

/* Terms page has one block of text, not a stack of cards to visually
   separate — no need for the release-notes card background/border here. */
.page-terms .release-wrapper {
  background-color: transparent;
  border: none;
}

/* Matched to portal.ixt.io/releasenotes — font and card/text colors in both
   themes, scoped to this page only via .page-changelog rather than the
   shared .page-release-notes (which .page-terms also carries), AND to the
   default IXT brand only: this is IXT's own portal being matched, not
   something a reseller's brand config asked for — other brands keep their
   own configured font/colors here via the normal --brand-* tokens. */
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);
}
