/* Alturos corporate violet. mkdocs.yml sets `primary: custom` / `accent: custom`,
   which makes Material emit these data attributes without shipping any colours
   of its own — the values below are the whole definition. */
[data-md-color-primary="custom"] {
  --md-primary-fg-color:        #4516cb;
  --md-primary-fg-color--light: #6b45d5;
  --md-primary-fg-color--dark:  #3712a2;
  --md-primary-bg-color:        #fff;
  --md-primary-bg-color--light: #ffffffb3;
}

[data-md-color-accent="custom"] {
  --md-accent-fg-color:            #5c2ee0;
  --md-accent-fg-color--transparent: #5c2ee01a;
  --md-accent-bg-color:            #fff;
  --md-accent-bg-color--light:     #ffffffb3;
}

/* On the dark scheme the header takes --md-default-bg-color, so links/accents
   carry the brand instead; lighten it so it stays readable on near-black. */
[data-md-color-scheme="slate"][data-md-color-primary="custom"] {
  --md-typeset-a-color: #9b7cf0;
}

/* Mark external links with a small "open in new" icon.
   Lives in the theme custom_dir, not in docs_dir — knowledge-base/ is
   regenerated by the fetch scripts, so no hand-written asset belongs there.
   MkDocs copies custom_dir files into site_dir, so the path referenced by
   extra_css resolves at build time. */

.md-typeset a[href^="http://"]::after,
.md-typeset a[href^="https://"]::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.2em;
  vertical-align: -0.08em;
  background-color: currentcolor;
  /* material/open-in-new */
  -webkit-mask-image: var(--md-external-icon);
  mask-image: var(--md-external-icon);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
}

:root {
  --md-external-icon: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5c-1.11 0-2 .9-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2v-7h-2v7Z"/></svg>');
}

/* Buttons, images and the "edit this page" style links shouldn't get one. */
.md-typeset a.md-button::after,
.md-typeset a:has(> img)::after,
.md-typeset .headerlink::after {
  content: none;
}

/* ---- feedback comment box -------------------------------------------------
   Material styles the rating icons and the thank-you note; the comment box is
   ours (see overrides/partials/feedback.html), so it needs matching styling.
   Uses the theme's own custom properties so it follows light/dark and the
   Alturos violet without hardcoding either. */
.md-feedback__comment {
  margin-top: .8rem;
  max-width: 30rem;
}
.md-feedback__comment-label {
  display: block;
  margin-bottom: .3rem;
  font-size: .7rem;
  color: var(--md-default-fg-color--light);
}
.md-feedback__comment-input {
  width: 100%;
  padding: .4rem .6rem;
  font: inherit;
  font-size: .7rem;
  color: var(--md-default-fg-color);
  background-color: var(--md-default-bg-color);
  border: .05rem solid var(--md-default-fg-color--lighter);
  border-radius: .2rem;
  resize: vertical;
}
.md-feedback__comment-input:focus {
  outline: none;
  border-color: var(--md-accent-fg-color);
}
.md-feedback__comment-input:disabled {
  opacity: .6;
}
.md-feedback__comment-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .4rem;
}
.md-feedback__comment-send {
  padding: .25rem .8rem;
  font-size: .7rem;
  color: var(--md-primary-bg-color);
  background-color: var(--md-primary-fg-color);
  border: none;
  border-radius: .2rem;
  cursor: pointer;
}
.md-feedback__comment-send:hover:not(:disabled) {
  background-color: var(--md-accent-fg-color);
}
.md-feedback__comment-send:disabled {
  opacity: .5;
  cursor: default;
}
.md-feedback__comment-status {
  font-size: .7rem;
  color: var(--md-default-fg-color--light);
}
/* Material's own thank-you note stays hidden — see the analytics partial. */
.md-feedback__note {
  display: none;
}

/* Material sets `display: flex` on the rating list, which beats the UA sheet's
   `[hidden] { display: none }` — so hiding it after a vote needs an explicit
   rule. (Material's own widget disables the fieldset instead; we cannot, since
   our comment box lives inside the same fieldset and would be disabled too.) */
.md-feedback__list[hidden],
.md-feedback__comment[hidden] {
  display: none;
}

/* Scribe step-by-step guides, Vimeo/YouTube/Synthesia recordings and Content Hub
   assets (Alturos' own host), embedded from the source articles by
   academy-fetch.py. The authored
   height is kept (Scribe decks are not 16:9) but the width is fluid, so they do
   not overflow on a narrow window. */
.academy-embed {
  width: 100%;
  max-width: 100%;
  border: .05rem solid var(--md-default-fg-color--lightest);
  border-radius: .2rem;
  margin: 1em 0;
}

/* Footer links beside the copyright (see overrides/partials/copyright.html).
   Material's footer text is deliberately low-contrast; these are links, so they
   get the normal footer link treatment plus a separator. */
.md-copyright__links {
  /* flex, not inline-flex: block-level so Material's "Made with" line does not
     run on from our links. */
  display: flex;
  flex-wrap: wrap;
  gap: 0 .8rem;
  margin-top: .2rem;
}
.md-copyright__links a {
  color: var(--md-footer-fg-color--light);
  text-decoration: none;
}
.md-copyright__links a:hover,
.md-copyright__links a:focus {
  color: var(--md-footer-fg-color);
  text-decoration: underline;
}

/* Product icons on the root-level nav entries.
 *
 * Material renders `icon:` frontmatter as an inline <svg> and styles it
 * `height: 1.3em` but sets no width, so our square icons would keep their 24px
 * attribute width and come out stretched. Nothing else in a .md-nav__link is an
 * <svg> — the collapse chevrons are CSS-masked spans — so this selector only
 * ever hits them. See overrides/.icons/alturos/ for where the icons come from.
 */
.md-nav__link > svg {
  width: 1.3em;
  margin-inline-end: 0.5em;
}

/* ---- signed-in user in the top bar ----------------------------------------
   Widget markup and behaviour: overrides/partials/user.html, fed by the Go
   server's /api/me. Colours come from the theme's own custom properties so the
   widget follows both palettes; the header is violet on the default scheme and
   near-black on slate, and --md-primary-bg-color (white) reads on both. */
.md-user {
  position: relative;
  display: flex;
  align-items: center;
  margin-inline-start: .2rem;
  color: var(--md-primary-bg-color);
  font-size: .7rem;
  /* The header is a flex row of shrinkable items; without this the page title
     can squeeze the name to nothing before it wraps. */
  flex-shrink: 0;
}
/* An explicit `display` beats the UA sheet's [hidden] rule, so the two elements
   that have one need this — the widget is hidden until the script knows whether
   anyone is signed in, and the tier badge only appears above the floor tier.
   The rest (the account details, the login link, the email) carry no `display`
   of their own and the UA sheet hides them correctly. */
.md-user[hidden],
.md-user__tier[hidden] {
  display: none;
}

.md-user__button {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .4rem;
  border-radius: 1rem;
  cursor: pointer;
  /* Both are needed: Firefox draws the triangle from list-style, WebKit from
     the pseudo-element below. */
  list-style: none;
}
.md-user__button::-webkit-details-marker {
  display: none;
}
.md-user__button:hover,
.md-user__account[open] .md-user__button {
  background-color: rgba(255, 255, 255, .15);
}
.md-user__button:focus-visible {
  outline: .05rem solid currentcolor;
  outline-offset: .1rem;
}

.md-user__avatar {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .25);
  font-size: .6rem;
  font-weight: 700;
  line-height: 1;
}

.md-user__name {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Below Material's md breakpoint the search collapses to an icon and the header
   gets tight; the avatar alone still says who is signed in, and the menu behind
   it has the full name. Above it there is room, so the name is shown. */
@media screen and (max-width: 59.9375em) {
  .md-user__name {
    display: none;
  }
}

/* The caret, drawn rather than included as an icon: an SVG include here would
   be a second file to keep in step with the header copy. */
.md-user__button::after {
  content: "";
  width: .3rem;
  height: .3rem;
  margin-inline-start: .1rem;
  border-right: .075rem solid currentcolor;
  border-bottom: .075rem solid currentcolor;
  transform: translateY(-.05rem) rotate(45deg);
  transition: transform .2s;
}
.md-user__account[open] .md-user__button::after {
  transform: translateY(.05rem) rotate(225deg);
}

.md-user__menu {
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  z-index: 1;
  min-width: 11rem;
  max-width: 16rem;
  margin-top: .2rem;
  padding: .6rem;
  color: var(--md-default-fg-color);
  background-color: var(--md-default-bg-color);
  border-radius: .2rem;
  box-shadow: var(--md-shadow-z2);
}

.md-user__identity {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding-bottom: .4rem;
  border-bottom: .05rem solid var(--md-default-fg-color--lightest);
}
.md-user__menu-name {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.md-user__email {
  color: var(--md-default-fg-color--light);
  font-size: .62rem;
  overflow-wrap: anywhere;
}

/* Which tier this reader is served — the same value that picked their document
   root, so the badge cannot disagree with what they can open. Shown only above
   the floor tier; "you see the public site" is not news to anyone. */
.md-user__tier {
  display: inline-block;
  margin-top: .4rem;
  padding: .05rem .35rem;
  color: var(--md-accent-fg-color);
  background-color: var(--md-accent-fg-color--transparent);
  border-radius: .2rem;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02rem;
  cursor: help;
}

.md-user__logout {
  display: block;
  margin-top: .4rem;
  padding: .25rem 0;
  color: var(--md-typeset-a-color);
  text-decoration: none;
}
.md-user__logout:hover,
.md-user__logout:focus {
  color: var(--md-accent-fg-color);
  text-decoration: underline;
}

/* Sits in the header, so it is styled like the button rather than the menu. */
.md-user__login {
  padding: .2rem .5rem;
  color: inherit;
  border: .05rem solid rgba(255, 255, 255, .4);
  border-radius: 1rem;
  text-decoration: none;
}
.md-user__login:hover {
  background-color: rgba(255, 255, 255, .15);
}

/* ---- header wordmark ------------------------------------------------------
   The Alturos Academy wordmark replaces the site-name text in the header
   title (see overrides/partials/header.html). White artwork on transparency,
   which is why it works on the violet header and on slate's near-black one
   without a second file.

   It sits in the title rather than the theme's logo slot because that slot caps
   its image at 1.2rem and is hidden below 76.234375em — far too small for a
   4.6:1 wordmark, and invisible at the widths most readers are on. Material
   swaps the title for the current page title on scroll, so the wordmark behaves
   exactly as the site name it replaces. */
/* The topic is absolutely positioned and only as tall as its content, so the
   44px wordmark sat flush against the top edge with the 4px slack below it.
   Stretching the topic to the title's full 2.4rem gives align-items something
   to centre against. Only the first topic holds the wordmark — the second is
   the page title Material swaps in on scroll — and Material animates the topics
   with transform and opacity, never height, so this does not disturb that. */
.md-header__topic:first-child {
  height: 100%;
  align-items: center;
}

.md-header__logo-link {
  display: flex;
  align-items: center;
  min-width: 0;
  color: inherit;
}

.md-header__logo {
  display: block;
  /* 44px at Material's 20px root. The artwork carries ~16% of its own vertical
     padding, so the ink lands around 37px inside the 2.4rem header. */
  height: 2.2rem;
  width: auto;
  /* On a narrow window the title box shrinks; contain scales the wordmark down
     inside it instead of squashing the aspect ratio. */
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

/* The theme's own logo slot would sit beside the wordmark above 76.234375em
   and show the same Alturos mark twice — the wordmark already contains it.
   `theme.logo` in mkdocs.yml is still set, because that same image is what the
   navigation drawer's title block uses on small screens. */
.md-header__button.md-logo {
  display: none;
}

/* ---- landing page architecture figure (knowledge-base/index.md) -----------
   Inline SVG so it follows light/dark via the theme's own custom properties;
   no image file in docs_dir, which the fetch scripts regenerate. */
/* Material sizes figure to fit-content, which collapses a viewBox-only SVG. */
.md-typeset figure.academy-architecture {
  width: 100%;
  max-width: 760px;
}
.academy-architecture svg {
  width: 100%;
  max-width: 760px;
  height: auto;
}
.academy-architecture .a-frame {
  fill: var(--md-accent-fg-color--transparent);
  stroke: var(--md-primary-fg-color);
  stroke-width: 1.5;
}
.academy-architecture .a-box {
  fill: var(--md-default-bg-color);
  stroke: var(--md-primary-fg-color);
  stroke-width: 1.5;
  transition: fill .15s;
}
.academy-architecture .a-box--alt {
  stroke-dasharray: 6 4;
}
.academy-architecture a:hover .a-box,
.academy-architecture a:focus .a-box {
  fill: var(--md-accent-fg-color--transparent);
}
.academy-architecture .a-ext {
  fill: none;
  stroke: var(--md-default-fg-color--lighter);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}
.academy-architecture .a-link {
  stroke: var(--md-default-fg-color--lighter);
  stroke-width: 1.5;
}
.academy-architecture text {
  fill: var(--md-default-fg-color);
  font-family: var(--md-text-font-family);
}
.academy-architecture .a-frame-label {
  font-size: 15px;
  font-weight: 700;
  fill: var(--md-primary-fg-color);
}
[data-md-color-scheme="slate"] .academy-architecture .a-frame-label {
  fill: var(--md-typeset-a-color);
}
.academy-architecture .a-row-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  fill: var(--md-default-fg-color--light);
}
.academy-architecture .a-name {
  font-size: 14px;
  font-weight: 700;
  text-anchor: middle;
}
.academy-architecture .a-sub {
  font-size: 11px;
  text-anchor: middle;
  fill: var(--md-default-fg-color--light);
}
