/* WISER branding for Material for MkDocs.
   Shared by every space; copied into each site's docs/brand/ by convert.py.
   Three goals:
     1. Brand red (#EF3C42) as the primary/accent color.
     2. A clean, bannerless header + tabs that blend into the page background
        instead of showing a colored top bar.
     3. Dark (slate) surfaces ramped off the brand dark #242944.
   Loaded via `extra_css` (after the theme bundle), so these definitions win. */

/* --- brand palette ------------------------------------------------------- */
/* Scoped to the scheme attribute (on <body>) so it overrides the theme's
   generated [data-md-color-primary] values, which live on the same element. */

[data-md-color-scheme="default"] {
  --md-primary-fg-color:        #EF3C42;   /* brand red */
  --md-primary-fg-color--light: #f26d72;   /* lighter tint (header gradient) */
  --md-primary-fg-color--dark:  #c9282e;   /* darker shade (hover/active)     */
  --md-accent-fg-color:         #EF3C42;
  --md-typeset-a-color:         #EF3C42;   /* links: brand red per request.
       NOTE: ~3.9:1 on white — just under WCAG AA (4.5:1) for body text.
       For AA-compliant links swap in #c9282e (~5.5:1). */
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #EF3C42;   /* brand red */
  --md-primary-fg-color--light: #f26d72;
  --md-primary-fg-color--dark:  #c9282e;
  --md-accent-fg-color:         #EF3C42;
  --md-typeset-a-color:         #EF3C42;   /* links: brand red per request.
       NOTE: ~3.7:1 on the dark bg — just under AA. For AA swap in #f26d72. */

  /* Dark surfaces ramped off the brand dark #242944 (hsl 231° 31%). The page
     sits one shade below the brand dark for a deeper background; #242944 itself
     becomes the first raised-surface tint. Lighter steps are borders and row
     hovers; code and footer recede darker still. Material's slate text colors
     are white-opacity based, so they read on all of these. */
  --md-default-bg-color:           #1c2035;   /* base: page + header/tabs     */
  --md-default-bg-color--light:    #242944;   /* brand dark; raised surface   */
  --md-default-bg-color--lighter:  #292f52;   /* borders, dividers            */
  --md-default-bg-color--lightest: #32395f;   /* strongest tint               */
  --md-code-bg-color:              #16192a;   /* code blocks: recessed panel  */
  --md-footer-bg-color:            #16192a;
  --md-footer-bg-color--dark:      #10121e;
}

/* --- clean header: match the page background ----------------------------- */

.md-header,
.md-tabs {
  background-color: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

/* Subtle divider so the header is still delineated at the top of the page;
   Material swaps in a drop shadow once the user scrolls. */
.md-header {
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  box-shadow: none;
  transition: color 250ms, background-color 250ms, box-shadow 250ms,
              border-color 250ms;
}
.md-header--shadow {
  border-bottom-color: transparent;
  box-shadow: 0 0 0.2rem rgba(0, 0, 0, 0.1), 0 0.2rem 0.4rem rgba(0, 0, 0, 0.1);
}

/* Search box: legible on a light header (it defaults to a tint of the old
   colored bar). */
.md-search__input {
  background-color: var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color);
}
.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}
.md-search__input + .md-search__icon {
  color: var(--md-default-fg-color--light);
}

/* --- steppers ------------------------------------------------------------ */
/* convert.py wraps each GitBook {% stepper %} in <div class="steps"> around a
   plain numbered list. Here we hide the native numbering and draw a brand
   badge + a vertical connector line per step, restoring the GitBook look.
   Everything is scoped with `>` so nested lists and ordinary numbered lists
   elsewhere on the page are untouched. Uses Material CSS variables, so it is
   correct in both light and dark schemes. */

.md-typeset .steps > ol {
  counter-reset: step;
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.md-typeset .steps > ol > li {
  counter-increment: step;
  position: relative;
  margin-left: 0;
  padding-left: 2.2rem;
  padding-bottom: 0.9rem;
}

/* the numbered badge */
.md-typeset .steps > ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background-color: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color, #fff);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.6rem;
  text-align: center;
  z-index: 1;
}

/* the vertical connector line joining consecutive badges */
.md-typeset .steps > ol > li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: calc(0.8rem - 1px);
  top: 1.6rem;
  bottom: -0.6rem;
  width: 2px;
  background-color: var(--md-default-fg-color--lightest);
}

/* align the step's first block with the badge, and drop the last step's
   trailing space so the box closes cleanly */
.md-typeset .steps > ol > li > :first-child {
  margin-top: 0;
}
.md-typeset .steps > ol > li:last-child {
  padding-bottom: 0;
}

/* --- video embeds -------------------------------------------------------- */
/* convert.py turns {% embed %} YouTube URLs into
   <div class="video-embed"><iframe ...></div>. Responsive 16:9. */
.md-typeset .video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1em 0;
}
.md-typeset .video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0.2rem;
}

/* ---- landing-page cards (GitBook <table data-view="cards">) ----
   convert.py turns cards tables into Material grid cards (div.grid.cards).
   Crop covers to a uniform banner like GitBook's card view. */
.md-typeset .grid.cards img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.2rem;
  margin: 0 0 0.6rem;
}
.md-typeset .grid.cards > ul > li > p {
  margin: 0.4em 0;
}

/* Red lock badge on the cover of cards that link into a gated space (the
   auth-walled paths per _routes.json: /supplier, /installation, /kit-setup).
   The cover anchor is the card's first paragraph; :has(> img) keeps the badge
   off text-only cards. Browsers without :has() just show no badge. */
.md-typeset .grid.cards a:has(> img) {
  position: relative;
  display: block;
}
.md-typeset .grid.cards
  a:is([href^="/supplier"], [href^="/installation"], [href^="/kit-setup"]):has(> img)::after {
  content: "";
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92)
    url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cpath fill="%23EF3C42" d="M12 17a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2 2 2 0 0 0 2 2m6-9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2h1V6a5 5 0 0 1 5-5 5 5 0 0 1 5 5v2h1M12 3a3 3 0 0 0-3 3v2h6V6a3 3 0 0 0-3-3z"/%3E%3C/svg%3E')
    center / 62% no-repeat;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* --- sidebar: section headers vs. links ----------------------------------
   Inspired by the Doks-themed sidebar at docs.paperd.ink: give section titles
   a clearly heavier tier than the page links beneath them, and rule a line
   between sections. In Material a section title is a <label> while a page link
   is an <a> — both carry .md-nav__link, so we key off the element to tell them
   apart. Scoped to the left (primary) nav; the right-hand table of contents is
   untouched. Uses theme variables, so it is correct in light and dark. */

/* Section titles: bold, a touch larger than links, full-strength text color —
   reads as a heading rather than a clickable item. */
.md-nav--primary .md-nav__item--section > label.md-nav__link {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--md-default-fg-color);
}

/* Horizontal divider above each section, mirroring the Doks section breaks.
   The rule sits on the list item, so nested sections indent their divider with
   the hierarchy. The first section in a list drops its leading rule. */
.md-nav--primary .md-nav__item--section {
  border-top: 1px solid var(--md-default-fg-color--lightest);
  margin-top: 0.4rem;
  padding-top: 0.4rem;
}
.md-nav--primary .md-nav__list > .md-nav__item--section:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}
