/* ==========================================================================
   VCO documentation theme
   --------------------------------------------------------------------------
   Lives in docs_config/custom_theme/assets/, the theme.custom_dir that every site
   inherits from docs_config/mkdocs.base.yml. MkDocs copies the files of custom_dir
   into each site, so the admin and user sites of every language share this one file
   (extra_css: assets/vco.css) instead of carrying a copy each.

   WHITE-LABEL RULE: never name a colour. Every accent derives from
   --md-primary-fg-color, which each operator overrides downstream. The default
   below is a neutral slate so an unset or clashing operator colour can never
   dominate the page, and tints use color-mix() so any hue works.
   ========================================================================== */

:root {
  --vco-radius: 8px;
  --vco-border: color-mix(in srgb, var(--md-default-fg-color) 12%, transparent);
  --vco-tint:   color-mix(in srgb, var(--md-primary-fg-color) 6%, transparent);
  --vco-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .06);
}

/* Material's palette.min.css sets these on `[data-md-color-primary=<name>]`,
   an attribute selector on <body> that outranks a plain :root rule — so the
   override has to match that selector, not just declare a higher-specificity
   context. `[data-md-color-primary]` (any value) keeps this independent of
   whatever primary name the config declares. */
[data-md-color-primary] {
  /* The operator-overridable contract. Downstream sets only these. */
  --md-primary-fg-color:        #37474f;
  --md-primary-fg-color--light: #62727b;
  --md-primary-fg-color--dark:  #102027;
  --md-accent-fg-color:         var(--md-primary-fg-color--light);
  --vco-link-color:             #1a5fb4;
}

/* --------------------------------------------------------------------------
   Typography — a tighter, more deliberate scale and a readable measure
   -------------------------------------------------------------------------- */

.md-typeset {
  font-size: .78rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: .6em;
}

/* Hairline rule under section headings gives long pages a visible rhythm. */
.md-typeset h2 {
  font-weight: 650;
  letter-spacing: -.01em;
  margin-top: 2em;
  padding-bottom: .25em;
  border-bottom: 1px solid var(--vco-border);
}

.md-typeset h3 {
  font-weight: 600;
  margin-top: 1.6em;
}

.md-grid {
  max-width: 68rem;
}

/* --------------------------------------------------------------------------
   Links in page content
   --------------------------------------------------------------------------
   Underlined and tinted with --vco-link-color so they stand out from body text.
   Scoped to .md-typeset, so header, tabs, sidebar, TOC and footer links are not
   touched. :where() keeps the specificity at that of Material's own
   `.md-typeset a`, so the styled links below (.vco-topics cards, .md-button)
   and Material's heading anchors and annotation markers keep their own look.
   -------------------------------------------------------------------------- */

.md-typeset a:where(:not(.md-button, .headerlink, .footnote-ref, .footnote-backref, .md-annotation__index, .vco-topics a)) {
  color: var(--vco-link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

.md-typeset a:where(:not(.md-button, .headerlink, .footnote-ref, .footnote-backref, .md-annotation__index, .vco-topics a)):hover {
  color: var(--vco-link-color);
  text-decoration-thickness: 2px;
}

[data-md-color-scheme="slate"] .md-typeset a:where(:not(.md-button, .headerlink, .footnote-ref, .footnote-backref, .md-annotation__index, .vco-topics a)),
[data-md-color-scheme="slate"] .md-typeset a:where(:not(.md-button, .headerlink, .footnote-ref, .footnote-backref, .md-annotation__index, .vco-topics a)):hover {
  color: color-mix(in srgb, var(--vco-link-color) 60%, white);
}

/* --------------------------------------------------------------------------
   Legacy {== ==} callouts
   --------------------------------------------------------------------------
   ~184 blocks in English (more across the translated trees) use CriticMarkup
   highlighting as a stand-in for admonitions, since the admonition extension
   was never enabled. New content should use real `!!! note` / `!!! warning`
   admonitions; this rule keeps the legacy blocks looking intentional until
   they are all migrated, and stays as a safety net for the translated trees.
   -------------------------------------------------------------------------- */

.md-typeset mark.critic.block {
  display: block;
  background: var(--vco-tint);
  border-left: 3px solid var(--md-primary-fg-color);
  border-radius: 0 var(--vco-radius) var(--vco-radius) 0;
  padding: .8rem 1rem;
  margin: 1.2em 0;
  color: inherit;
}

.md-typeset mark.critic.block > p:last-child {
  margin-bottom: 0;
}

.md-typeset mark.critic.block .twemoji {
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: -.2rem;
  margin-right: .35rem;
  fill: var(--md-primary-fg-color);
}

/* Keep genuine inline CriticMarkup highlighting visually distinct. */
.md-typeset mark.critic:not(.block) {
  background: var(--md-accent-fg-color--transparent);
}

/* --------------------------------------------------------------------------
   Tables — bordered and tinted rather than zebra-striped
   -------------------------------------------------------------------------- */

.md-typeset table:not([class]) {
  border: 1px solid var(--vco-border);
  border-radius: var(--vco-radius);
  box-shadow: none;
  font-size: .72rem;
}

.md-typeset table:not([class]) th {
  background: var(--vco-tint);
  font-weight: 600;
  border-bottom: 1px solid var(--vco-border);
}

.md-typeset table:not([class]) tr:hover {
  background: var(--vco-tint);
}

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

.md-typeset pre > code {
  border-radius: var(--vco-radius);
}

.md-typeset .highlight {
  box-shadow: var(--vco-shadow);
  border-radius: var(--vco-radius);
}

.md-typeset code {
  border-radius: 4px;
  font-size: .85em;
}

/* --------------------------------------------------------------------------
   Landing-page grid cards (require attr_list + md_in_html)
   -------------------------------------------------------------------------- */

.md-typeset .grid.cards > ul > li {
  border: 1px solid var(--vco-border);
  border-radius: var(--vco-radius);
  padding: 1rem 1.1rem;
  box-shadow: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.md-typeset .grid.cards > ul > li:hover {
  border-color: var(--md-primary-fg-color);
  box-shadow: var(--vco-shadow);
  transform: translateY(-2px);
}

.md-typeset .grid.cards > ul > li > hr {
  margin: .6rem 0;
  border-color: var(--vco-border);
}

.md-typeset .grid.cards .twemoji,
.md-typeset .grid.cards svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: var(--md-primary-fg-color);
}

/* --------------------------------------------------------------------------
   Topic links on the landing pages
   --------------------------------------------------------------------------
   One entry point per topic, auto-fitting into as many columns as the viewport
   allows. Deliberately NOT a table of every page: the sidebar already lists
   those, and a duplicated link table on the landing page goes stale the moment
   a page moves. Adding a topic here stays visually calm.
   -------------------------------------------------------------------------- */

/* Consecutive markdown links inside the div collapse into a single <p>, so the
   grid lives on that paragraph rather than on .vco-topics itself. */
.md-typeset .vco-topics > p {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: .5rem;
  margin: 1.2em 0;
}

.md-typeset .vco-topics > p > a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem .9rem;
  border: 1px solid var(--vco-border);
  border-radius: var(--vco-radius);
  color: var(--md-default-fg-color);
  text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s;
}

.md-typeset .vco-topics > p > a:hover {
  border-color: var(--md-primary-fg-color);
  background: var(--vco-tint);
  transform: translateY(-1px);
}

.md-typeset .vco-topics > p > a > .twemoji,
.md-typeset .vco-topics > p > a > svg {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  fill: var(--md-primary-fg-color);
}

/* --------------------------------------------------------------------------
   Buttons carrying a leading icon (e.g. the download buttons)
   -------------------------------------------------------------------------- */

.md-typeset .md-button .twemoji {
  width: 1.1rem;
  height: 1.1rem;
  vertical-align: -.22rem;
  margin-right: .35rem;
  fill: currentColor;
}

/* Equal-width buttons so a row of platform choices reads as one set rather than
   a ragged line. Keep labels short — long ones wrap the row onto two lines. */
.md-typeset .md-button {
  min-width: 8.5rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Operator-only callouts
   --------------------------------------------------------------------------
   `!!! info "Platform operators"` marks content that only appears for operators
   (the Cloud admin menu). Given a distinct look so readers on the full docs site
   can see at a glance that a passage does not apply to them. Customers never see
   these passages' parent sections on the user site.
   -------------------------------------------------------------------------- */

.md-typeset .admonition.info,
.md-typeset details.info {
  border-left-width: 3px;
}

.md-typeset .info > .admonition-title,
.md-typeset .info > summary {
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Sidebar group headers
   --------------------------------------------------------------------------
   With navigation.tabs, each tab's whole tree renders expanded in the
   sidebar by default — sibling groups (e.g. "Getting Started", "Using the
   Portal" under the Docs tab) need to read as distinct section headers
   rather than blend into the page-link list below them. Targets the
   `.md-nav__link` label inside a `.md-nav__item--section` — the group
   title itself, not the individual page links inside it. Material still
   renders this as a real <label for="..."> bound to the section's own
   checkbox, so it stays clickable — see "Collapse sibling groups" below,
   which uses that same checkbox to hide/show the group's own nested <nav>.
   -------------------------------------------------------------------------- */

.md-nav__item--section > .md-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5em;
  margin-top: 1.1em;
  padding-top: .5em;
  border-top: 1px solid var(--vco-border);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--md-default-fg-color--light);
  cursor: pointer;
}

/* First group under a tab shouldn't carry the divider/gap — nothing precedes it. */
.md-nav__item--section:first-child > .md-nav__link {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* --------------------------------------------------------------------------
   Collapse sibling groups by default
   --------------------------------------------------------------------------
   Material already emits a checkbox per section (`.md-nav__toggle`, unchecked
   by default; checked only for the section containing the current page —
   confirmed via the rendered HTML's checked attribute, not assumed) but its
   own tabs-mode CSS doesn't gate the nested <nav>'s visibility on that
   checkbox at our nesting depth, so every sibling group rendered fully
   expanded regardless of state. This adds the missing rule: hide a section's
   nested <nav> unless its own toggle is checked. Scoped to the primary
   sidebar only — the secondary sidebar (page table-of-contents) has a
   different structure and should never collapse.
   -------------------------------------------------------------------------- */

.md-sidebar--primary .md-nav__item--section > input.md-nav__toggle:not(:checked) ~ nav {
  display: none;
}

/* Material ships `.md-nav__item--section > .md-nav__link:not(.md-nav__container) {
   pointer-events: none }` globally, since in its default (non-collapsible) presentation a
   section-title label isn't meant to be interactive. That rule's specificity (3 classes) beats
   a plain `.md-nav__item--section > .md-nav__link` override, so match it exactly here to win. */
.md-nav__item--section > .md-nav__link:not(.md-nav__container) {
  pointer-events: auto;
}

/* Chevron indicating expand/collapse state, using the same checkbox. */
.md-nav__item--section > .md-nav__link::after {
  content: "";
  flex-shrink: 0;
  width: .5em;
  height: .5em;
  border-right: 2px solid currentcolor;
  border-bottom: 2px solid currentcolor;
  transform: rotate(-45deg);
  transition: transform .15s;
}

.md-nav__item--section > input.md-nav__toggle:checked ~ .md-nav__link::after {
  transform: rotate(45deg);
}

/* --------------------------------------------------------------------------
   Portal back-link in the sidebar
   Replaces the hardcoded #0e0e0e inline style from the old nav.html partial.
   -------------------------------------------------------------------------- */

.vco-portal-backlink {
  padding: .6rem .8rem;
}

.vco-portal-backlink .md-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
}

.vco-portal-backlink svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   Dark scheme — keep an unknown brand hue legible
   -------------------------------------------------------------------------- */

[data-md-color-scheme="slate"] {
  --md-hue: 215;
  --vco-border: color-mix(in srgb, var(--md-default-fg-color) 18%, transparent);
}

/* Guarantee header separation regardless of the operator's colour. */
.md-header,
.md-tabs {
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
