/* elevaite365 brand theme
   Brand orange #FF613C · paper #F2F1ED · ink #2F2E3E · heading #18181B
   Inter, 8px radii, 1px hairline shadows.

   -deep is the same hue darkened for body-text links and hovers, so small
   text stays legible on the paper background. Fills, the header and buttons
   use the brand orange itself. */

:root {
  --e365-orange: #ff613c;
  --e365-orange-deep: #d8431c;
  --e365-orange-light: #ff8a6d;
  --e365-paper: #f2f1ed;
  --e365-paper-2: #eae8e2;
  --e365-card: #ffffff;
  --e365-ink: #2f2e3e;
  --e365-heading: #18181b;
  --e365-muted: #6b6a76;
  --e365-line: rgba(24, 24, 27, 0.09);
  --e365-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --md-text-font: "Inter", system-ui, Avenir, Helvetica, Arial, sans-serif;
}

/* ---------- Light scheme ---------- */
[data-md-color-scheme="elevaite"] {
  --md-hue: 240;
  --md-default-bg-color: var(--e365-paper);
  --md-default-bg-color--light: var(--e365-paper);
  --md-default-fg-color: var(--e365-ink);
  --md-default-fg-color--light: var(--e365-muted);
  --md-default-fg-color--lighter: rgba(47, 46, 62, 0.35);
  --md-default-fg-color--lightest: rgba(47, 46, 62, 0.1);

  --md-primary-fg-color: var(--e365-orange);
  --md-primary-fg-color--light: var(--e365-orange-light);
  --md-primary-fg-color--dark: var(--e365-orange-deep);
  --md-primary-bg-color: #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.75);

  --md-accent-fg-color: var(--e365-orange-deep);
  --md-accent-fg-color--transparent: rgba(255, 97, 60, 0.1);
  --md-accent-bg-color: #ffffff;

  --md-typeset-color: var(--e365-ink);
  --md-typeset-a-color: var(--e365-orange-deep);
  --md-code-bg-color: #ffffff;
  --md-code-fg-color: #34333f;
  --md-footer-bg-color: var(--e365-heading);
  --md-footer-bg-color--dark: #0f0f11;

  color-scheme: light;
}

/* ---------- Header ---------- */
.md-header {
  background-color: var(--e365-orange);
  background-image: url("navbg.png");
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.md-header__title {
  font-weight: 500;
  letter-spacing: -0.2px;
}

.md-header__button.md-logo img {
  height: 1.5rem;
  width: auto;
}

/* Hide the site name next to the wordmark logo, which already says it.
   Only where the logo is actually shown; below that the title is the only
   branding in the header. */
@media screen and (min-width: 76.25em) {
  .md-header__topic:first-child .md-ellipsis {
    display: none;
  }
}

.md-tabs {
  background: transparent;
}

/* ---------- Header layout ----------
   Logo hard left, search centred and wide as the primary action,
   roadmap button trailing right. */
@media screen and (min-width: 60em) {
  /* Full-bleed app bar: Material constrains the header to the content grid,
     which leaves the logo floating inboard on wide screens. */
  .md-header__inner {
    max-width: none;
    padding: 0 0.6rem 0 0;
  }

  /* Equal-growth side groups keep the search optically centred */
  .md-header__title {
    flex: 1 1 0;
    margin-left: 0;
    min-width: 0;
  }

  .md-header__button.md-logo {
    margin-left: 0;
    padding-left: 1rem;
  }

  .md-header__inner {
    position: relative;
  }

  /* Absolute centring. The logo's fixed width would otherwise push a
     flex-centred search off the page's true centre. No transform here: a
     transformed ancestor becomes the containing block for position:fixed,
     which would trap the search overlay inside this box. */
  .md-header > .md-header__inner > .md-search {
    position: absolute;
    left: 0;
    right: 0;
    margin-inline: auto;
    width: clamp(16rem, 40vw, 34rem);
    padding: 0;
  }

  /* Material sizes the inner wrapper, not the form, so override both */
  .md-search__inner {
    float: none;
    width: 100%;
    padding: 0;
  }

  .md-header__source {
    flex: 1 1 0;
    display: flex;
    justify-content: flex-end;
    min-width: 0;
  }

  .md-search__form {
    width: 100%;
    height: 2.1rem;
    background-color: rgba(255, 255, 255, 0.22);
  }

  .md-search__form:hover {
    background-color: rgba(255, 255, 255, 0.3);
  }

  .md-search__input {
    font-size: 0.72rem;
  }
}

/* ---------- Search ---------- */
.md-search__form {
  background-color: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.md-search__form:hover {
  background-color: rgba(255, 255, 255, 0.26);
}

/* ---------- Search, open state ----------
   Material sizes the dim overlay from the .md-search box. Because the search
   is absolutely positioned here, that produced a grey column the width of the
   field instead of dimming the page. Pin it to the viewport instead. */
@media screen and (min-width: 60em) {
  .md-search__overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    border-radius: 0;
    transform: none;
    background-color: rgba(24, 24, 27, 0.4);
    backdrop-filter: blur(1px);
    opacity: 0;
    /* The overlay is a <label for="__search">. It covers the viewport even
       when closed, so it must not take clicks until the search is open,
       or every click on the page opens the search. */
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  [data-md-toggle="search"]:checked ~ .md-header .md-search__overlay {
    width: 100vw;
    height: 100vh;
    opacity: 1;
    pointer-events: auto;
  }

  .md-search__inner {
    z-index: 2;
  }

  /* Material widens the inner wrapper to a fixed 34.4rem when the search
     opens, which overflowed the centred container to the left */
  [data-md-toggle="search"]:checked ~ .md-header .md-search__inner {
    width: 100%;
    left: 0;
    right: 0;
    margin: 0;
    float: none;
  }

  /* Field and results read as one card */
  [data-md-toggle="search"]:checked ~ .md-header .md-search__form {
    background-color: var(--e365-card);
    border-radius: 10px 10px 0 0;
    box-shadow: none;
  }

  [data-md-toggle="search"]:checked ~ .md-header .md-search__input {
    color: var(--e365-ink);
  }

  [data-md-toggle="search"]:checked ~ .md-header .md-search__input::placeholder {
    color: var(--e365-muted);
  }

  [data-md-toggle="search"]:checked ~ .md-header .md-search__icon {
    color: var(--e365-muted);
    opacity: 1;
  }

  .md-search__output {
    top: 2.1rem;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 32px rgba(24, 24, 27, 0.18);
  }

  /* Material widens the scroll wrapper to hide the scrollbar, which spilled
     past the rounded corners */
  .md-search__scrollwrap {
    width: 100% !important;
    background-color: var(--e365-card);
    scrollbar-width: thin;
  }
}

.md-search__form {
  transition: background-color 160ms ease, border-radius 160ms ease;
}

/* Result list */
.md-search-result__meta {
  background-color: var(--e365-paper-2);
  color: var(--e365-muted);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 2.4rem;
  padding-inline: 1rem;
}

.md-search-result__list {
  padding-bottom: 0.3rem;
}

.md-search-result__item {
  box-shadow: 0 -1px 0 var(--e365-line);
}

.md-search-result__item:first-child {
  box-shadow: none;
}

.md-search-result__link {
  padding: 0.1rem 0.4rem;
  transition: background-color 120ms ease;
}

.md-search-result__link:focus,
.md-search-result__link:hover {
  background-color: rgba(255, 97, 60, 0.07);
}

.md-search-result__article {
  padding-inline: 1rem;
}

.md-search-result__article--document .md-search-result__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--e365-heading);
  margin-bottom: 0.2rem;
}

.md-search-result__teaser {
  color: var(--e365-muted);
  line-height: 1.5;
}

.md-search-result mark {
  color: var(--e365-orange-deep);
  background-color: rgba(255, 97, 60, 0.14);
  border-radius: 3px;
  padding: 0 2px;
}

.md-search-result__more > summary > div {
  color: var(--e365-orange-deep);
  font-size: 0.66rem;
  padding: 0.5rem 1rem;
}

/* Material pins the magnifier to a fixed top offset, which sits a few pixels
   high in a taller field. Centre it, and lighten it so it reads as a hint
   rather than a control. */
.md-search__form .md-search__icon[for] {
  top: 50%;
  transform: translateY(-50%);
  width: 1.1rem;
  height: 1.1rem;
  opacity: 0.7;
}

.md-search__form .md-search__icon[for] svg {
  width: 100%;
  height: 100%;
}

/* ---------- Roadmap button (Material's "repo" slot) ---------- */
.md-header__source {
  width: auto;
  max-width: none;
  margin-left: 0.6rem;
}

.md-header__source .md-source {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.16);
  font-size: 0.7rem;
  font-weight: 500;
  transition: background-color 120ms ease;
}

.md-header__source .md-source:hover,
.md-header__source .md-source:focus {
  background-color: rgba(255, 255, 255, 0.28);
  opacity: 1;
}

.md-header__source .md-source__icon {
  width: auto;
  height: auto;
  padding: 0;
}

.md-header__source .md-source__icon svg {
  margin: 0;
  width: 1rem;
  height: 1rem;
}

.md-header__source .md-source__repository {
  margin-left: 0;
  padding-left: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

/* No repo facts to show for a non-git link */
.md-header__source .md-source__facts {
  display: none;
}

/* ---------- Typography ---------- */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  color: var(--e365-heading);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.md-typeset h1 {
  font-size: 1.85rem;
  margin-bottom: 0.4em;
}

.md-typeset h2 {
  padding-top: 0.4em;
  border-top: 1px solid var(--e365-line);
  margin-top: 2em;
}

.md-typeset .subtitle {
  color: var(--e365-muted);
  font-size: 0.85rem;
  margin-top: -1.2em;
}

/* ---------- Nav ---------- */
.md-nav__title {
  color: var(--e365-muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.md-nav__link--active,
.md-nav__link:focus,
.md-nav__link:hover,
.md-nav__item--active > .md-nav__link,
.md-nav__item .md-nav__link--active {
  color: var(--e365-orange-deep);
}

.md-sidebar--secondary .md-nav__link--active {
  font-weight: 600;
}

/* ---------- Cards / grid ---------- */
.md-typeset .grid.cards > ul > li,
.md-typeset .grid > .card {
  background: var(--e365-card);
  border: 1px solid var(--e365-line);
  border-radius: 8px;
  box-shadow: var(--e365-shadow);
  padding: 1rem 1.1rem;
  transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.md-typeset .grid.cards > ul > li:hover {
  border-color: rgba(255, 97, 60, 0.4);
  box-shadow: 0 4px 14px rgba(24, 24, 27, 0.07);
  transform: translateY(-1px);
}

.md-typeset .grid.cards > ul > li > hr {
  margin: 0.6em 0;
  border-color: var(--e365-line);
}

/* ---------- Code ---------- */
.md-typeset pre > code,
.md-typeset code {
  border-radius: 8px;
}

.md-typeset pre > code {
  border: 1px solid var(--e365-line);
}

.md-typeset code {
  font-size: 0.82em;
}

/* ---------- Tables ---------- */
.md-typeset table:not([class]) {
  border: 1px solid var(--e365-line);
  border-radius: 8px;
  box-shadow: var(--e365-shadow);
  font-size: 0.72rem;
}

.md-typeset table:not([class]) th {
  background: var(--e365-paper-2);
  color: var(--e365-heading);
  font-weight: 600;
}

/* ---------- Admonitions ---------- */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 8px;
  border-width: 1px;
  border-left-width: 3px;
  box-shadow: var(--e365-shadow);
  font-size: 0.74rem;
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-color: var(--e365-orange);
}

.md-typeset .tip > .admonition-title,
.md-typeset .tip > summary {
  background: rgba(255, 97, 60, 0.08);
}

.md-typeset .tip > .admonition-title::before,
.md-typeset .tip > summary::before {
  background-color: var(--e365-orange);
}

/* ---------- Buttons ---------- */
.md-typeset .md-button {
  border-radius: 8px;
  border-width: 1px;
  font-weight: 500;
}

.md-typeset .md-button--primary {
  background: var(--e365-orange);
  border-color: var(--e365-orange);
  color: #fff;
}

.md-typeset .md-button--primary:hover {
  background: var(--e365-orange-deep);
  border-color: var(--e365-orange-deep);
}

/* ---------- Footer ---------- */
.md-footer-meta {
  font-size: 0.68rem;
}

/* ---------- Home page ---------- */
/* Four destination tiles read best as a 2x2 block, not 3-and-an-orphan */
@media screen and (min-width: 60em) {
  .md-typeset .grid.tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

.md-typeset .popular > ul {
  columns: 2;
  column-gap: 2.5rem;
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.md-typeset .popular > ul > li {
  break-inside: avoid;
  margin-bottom: 0.5em;
  padding-left: 0;
}

@media screen and (max-width: 44.9375em) {
  .md-typeset .popular > ul {
    columns: 1;
  }
}

/* ---------- Inline SVG diagrams ----------
   Self-contained: no CDN, no JS. Material's mermaid support fetches from
   unpkg, which is the wrong dependency for pages security teams read. */
.md-typeset .diagram {
  margin: 1.4em 0;
  overflow-x: auto;
}

.md-typeset .diagram svg {
  display: block;
  width: 100%;
  min-width: 34rem;
  height: auto;
  font-family: var(--md-text-font-family, var(--md-text-font));
}

.md-typeset .diagram .d-panel rect {
  fill: rgba(24, 24, 27, 0.03);
  stroke: var(--e365-line);
  stroke-width: 1;
}

.md-typeset .diagram .d-panel-label {
  fill: var(--e365-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.md-typeset .diagram .d-box rect {
  fill: var(--e365-card);
  stroke: var(--e365-line);
  stroke-width: 1;
}

.md-typeset .diagram .d-box--accent rect {
  stroke: var(--e365-orange);
}

.md-typeset .diagram .d-box--dashed rect {
  stroke-dasharray: 4 3;
}

.md-typeset .diagram .d-h {
  fill: var(--e365-heading);
  font-size: 12.5px;
  font-weight: 600;
}

.md-typeset .diagram .d-p {
  fill: var(--e365-muted);
  font-size: 11px;
}

.md-typeset .diagram .d-flow path {
  fill: none;
  stroke: var(--e365-orange);
  stroke-width: 1.5;
}

.md-typeset .diagram .d-flow--dashed path {
  stroke: var(--e365-muted);
  stroke-dasharray: 4 3;
}

.md-typeset .diagram marker path {
  fill: var(--e365-orange);
  stroke: none;
}

.md-typeset .diagram .d-flow-label {
  fill: var(--e365-ink);
  font-size: 11px;
}

/* ---------- Video embeds ---------- */
.md-typeset .video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.2em 0;
  border: 1px solid var(--e365-line);
  border-radius: 8px;
  box-shadow: var(--e365-shadow);
  overflow: hidden;
  background: #000;
}

.md-typeset .video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.md-typeset .video-caption {
  margin-top: -0.8em;
  font-size: 0.7rem;
  color: var(--e365-muted);
}

/* Video index page: title + duration rows */
.md-typeset .video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 1em 0;
}

/* ---------- Misc ---------- */
.md-typeset kbd {
  border-radius: 5px;
}

.md-typeset hr {
  border-color: var(--e365-line);
}

.md-typeset .status-pill {
  display: inline-block;
  padding: 0.1em 0.55em;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  background: rgba(255, 97, 60, 0.1);
  color: var(--e365-orange-deep);
}
