/* ============================================================================
   Custom admonition types
   ============================================================================ */

/* --------------------------------------------------------------------------
   new-addition — fresh green
   -------------------------------------------------------------------------- */

.admonition.new-addition,
.md-typeset details.new-addition {
  background-color: rgba(102, 187, 106, 0.12);
  border: 1px solid rgba(102, 187, 106, 0.45);
}

.md-typeset .new-addition > .admonition-title::before,
.md-typeset .new-addition > summary::before {
  background-color: rgb(102, 187, 106);
  -webkit-mask-image: var(--md-admonition-icon--new-addition);
          mask-image: var(--md-admonition-icon--new-addition);
}

.md-typeset .new-addition > .admonition-title::after,
.md-typeset .new-addition > summary::after {
  color: rgb(102, 187, 106);
}


/* --------------------------------------------------------------------------
   improvement — softened blue
   -------------------------------------------------------------------------- */

.admonition.improvement,
.md-typeset details.improvement {
  background-color: rgba(66, 165, 245, 0.12);
  border: 1px solid rgba(66, 165, 245, 0.45);
}

.md-typeset .improvement > .admonition-title::before,
.md-typeset .improvement > summary::before {
  background-color: rgb(66, 165, 245);
  -webkit-mask-image: var(--md-admonition-icon--improvement);
          mask-image: var(--md-admonition-icon--improvement);
}

.md-typeset .improvement > .admonition-title::after,
.md-typeset .improvement > summary::after {
  color: rgb(66, 165, 245);
}


/* --------------------------------------------------------------------------
   feature-release — purple-pink (aligned)
   -------------------------------------------------------------------------- */

.admonition.feature-release,
.md-typeset details.feature-release {
  background-color: rgba(199, 84, 176, 0.12);
  border: 1px solid rgba(199, 84, 176, 0.45);
}

.md-typeset .feature-release > .admonition-title::before,
.md-typeset .feature-release > summary::before {
  background-color: rgb(199, 84, 176);
  -webkit-mask-image: var(--md-admonition-icon--feature-release);
          mask-image: var(--md-admonition-icon--feature-release);
}

.md-typeset .feature-release > .admonition-title::after,
.md-typeset .feature-release > summary::after {
  color: rgb(199, 84, 176);
}

/* --------------------------------------------------------------------------
   status-available — green
   -------------------------------------------------------------------------- */

.admonition.status-available,
.md-typeset details.status-available {
  background-color: rgba(102, 187, 106, 0.12);
  border: 1px solid rgba(102, 187, 106, 0.45);
}

.md-typeset .status-available > .admonition-title::before,
.md-typeset .status-available > summary::before {
  background-color: rgb(102, 187, 106);
  -webkit-mask-image: var(--md-admonition-icon--status-available);
          mask-image: var(--md-admonition-icon--status-available);
}

.md-typeset .status-available > .admonition-title::after,
.md-typeset .status-available > summary::after {
  color: rgb(102, 187, 106);
}


/* --------------------------------------------------------------------------
   status-disruption — amber
   -------------------------------------------------------------------------- */

.admonition.status-disruption,
.md-typeset details.status-disruption {
  background-color: rgba(255, 179, 0, 0.12);
  border: 1px solid rgba(255, 179, 0, 0.45);
}

.md-typeset .status-disruption > .admonition-title::before,
.md-typeset .status-disruption > summary::before {
  background-color: rgb(255, 179, 0);
  -webkit-mask-image: var(--md-admonition-icon--status-disruption);
          mask-image: var(--md-admonition-icon--status-disruption);
}

.md-typeset .status-disruption > .admonition-title::after,
.md-typeset .status-disruption > summary::after {
  color: rgb(255, 179, 0);
}


/* --------------------------------------------------------------------------
   status-outage — red
   -------------------------------------------------------------------------- */

.admonition.status-outage,
.md-typeset details.status-outage {
  background-color: rgba(239, 83, 80, 0.12);
  border: 1px solid rgba(239, 83, 80, 0.45);
}

.md-typeset .status-outage > .admonition-title::before,
.md-typeset .status-outage > summary::before {
  background-color: rgb(239, 83, 80);
  -webkit-mask-image: var(--md-admonition-icon--status-outage);
          mask-image: var(--md-admonition-icon--status-outage);
}

.md-typeset .status-outage > .admonition-title::after,
.md-typeset .status-outage > summary::after {
  color: rgb(239, 83, 80);
}

/* --------------------------------------------------------------------------
   outline — neutral grey (transparent background)
   -------------------------------------------------------------------------- */

.admonition.outline,
.md-typeset details.outline {
  background-color: transparent;
  border: 1px solid rgba(158, 158, 158, 0.45);
}

.md-typeset .outline > .admonition-title::before,
.md-typeset .outline > summary::before {
  background-color: rgb(158, 158, 158);
  -webkit-mask-image: var(--md-admonition-icon--outline);
          mask-image: var(--md-admonition-icon--outline);
}

.md-typeset .outline > .admonition-title::after,
.md-typeset .outline > summary::after {
  color: rgb(158, 158, 158);
}

/* --------------------------------------------------------------------------
   Admonition meta subtitle
   -------------------------------------------------------------------------- */

/* The "meta" field of an admonition title/summary — secondary info shown on
   its own line, faded and smaller (a date, "optional", …). Authoring is just
   `<span class="meta">…</span>` in the title; `display: block` puts it on its
   own line, so no manual <br> is needed. Weight and colour inherit from the
   title, so it matches whatever admonition it sits in.
   (0.6rem = 80% of the .75rem typeset base; pinned so steps, whose title is
   bumped to 0.8rem, match the size elsewhere.) */
.md-typeset :is(.admonition-title, summary) .meta {
  display: block;
  opacity: 0.6;
  font-size: 0.6rem;
}

/* --------------------------------------------------------------------------
   step — sky blue (light/dark aware)
   -------------------------------------------------------------------------- */

/* Light mode */
[data-md-color-scheme="default"] .admonition.step,
[data-md-color-scheme="default"] .md-typeset details.step {
  background-color: rgba(240, 249, 255, 0.6);
  border: 2px solid rgba(125, 211, 252, 0.7);
}

/* Title */
[data-md-color-scheme="default"] .md-typeset .step > .admonition-title,
[data-md-color-scheme="default"] .md-typeset .step > summary {
  color: rgb(3, 105, 161);
}

/* Icon */
[data-md-color-scheme="default"] .md-typeset .step > .admonition-title::before,
[data-md-color-scheme="default"] .md-typeset .step > summary::before {
  background-color: rgb(14, 165, 233);
}

/* Dark mode */
[data-md-color-scheme="slate"] .admonition.step,
[data-md-color-scheme="slate"] .md-typeset details.step {
  background-color: rgba(12, 74, 110, 0.2);
  border: 2px solid rgba(56, 189, 248, 0.35);
}

/* Title */
[data-md-color-scheme="slate"] .md-typeset .step > .admonition-title,
[data-md-color-scheme="slate"] .md-typeset .step > summary {
  color: rgb(186, 230, 253);
}

/* Icon */
[data-md-color-scheme="slate"] .md-typeset .step > .admonition-title::before,
[data-md-color-scheme="slate"] .md-typeset .step > summary::before {
  background-color: rgb(56, 189, 248);
}

/* Shared title font styling */
.md-typeset .step > .admonition-title,
.md-typeset .step > summary {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Shared icon size */
.md-typeset .step > .admonition-title::before,
.md-typeset .step > summary::before {
  -webkit-mask-image: var(--md-admonition-icon--step);
          mask-image: var(--md-admonition-icon--step);
  width: 1.2rem;
  height: 1.2rem;
}

/* Auto-numbered step titles: writing `!!! step` (no title) renders "Step",
   and this appends the counter to produce "Step 1", "Step 2", …
   Counter resets at each H2 so each section starts from 1.
   Steps carrying a subtitle (below) are excluded — they generate their own
   "Step N" label so it can sit above the subtitle.

   NOTE: do NOT also reset on .md-typeset (the parent <article>). CSS counter
   self-nesting means an ancestor reset + an h2 reset of the same counter makes
   the steps (which are *following siblings* of the h2, not its children)
   resolve against the article's single continuous counter — so numbering runs
   straight through H2s instead of restarting. An unset counter auto-starts at 0,
   so steps before the first H2 still number correctly without the parent reset. */
.md-typeset h2 { counter-reset: step-counter; }
.md-typeset .admonition.step,
.md-typeset details.step { counter-increment: step-counter; }
/* STATIC steps (`!!! step`) render the title as <p class="admonition-title">,
   which has no theme ::after, so the counter goes straight there. */
.md-typeset .step > .admonition-title:not(:has(> .meta))::after {
  content: " " counter(step-counter);
}

/* COLLAPSIBLE steps (`??? step` / `???+ step`) render the title as <summary>,
   whose two pseudo-elements are both owned by the theme: ::before = the type
   icon (left), ::after = the fold/unfold chevron (right, rotates on open). The
   number needs a slot and there are only two, so one of the icons has to give.

   We keep the type ICON native: it stays a masked ::before driven by
   var(--md-admonition-icon--step) (via the shared step rules above), so
   changing `step = "lucide/…"` in zensical.toml updates collapsible steps too,
   and it recolours per scheme for free. In exchange:
     • the number takes over ::after as plain inline text after the "Step"
       label, so we strip the chevron's mask / absolute positioning / rotation;
     • the chevron is redrawn as a background-image in the right gutter, with
       colour (= step title colour) and glyph (right = closed, down = open)
       baked per scheme/state. It toggles on open but no longer animates.
   If you restyle the chevron or the step title colour, update the four baked
   SVGs below. Scoped to :not(:has(> .meta)) so subtitled steps (static-only
   today) are untouched. */
.md-typeset details.step > summary:not(:has(> .meta)) {
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 1rem 1rem;
}
.md-typeset details.step > summary:not(:has(> .meta))::after {
  content: " " counter(step-counter);
  -webkit-mask-image: none;
          mask-image: none;
  background-color: transparent;
  position: static;
  width: auto;
  height: auto;
  transform: none; /* cancel the theme's open-state rotate(90deg) on this text */
}
/* Chevron (baked): light/dark = step title colour; right = closed, down = open. */
[data-md-color-scheme="default"] .md-typeset details.step > summary:not(:has(> .meta)) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%230369a1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}
[data-md-color-scheme="default"] .md-typeset details.step[open] > summary:not(:has(> .meta)) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%230369a1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-md-color-scheme="slate"] .md-typeset details.step > summary:not(:has(> .meta)) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23bae6fd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
}
[data-md-color-scheme="slate"] .md-typeset details.step[open] > summary:not(:has(> .meta)) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23bae6fd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Step subtitle — same convention as the System Updates page: the subtitle
   lives inside the title/summary as a `.meta`, so it stays visible when a
   step is collapsed (`??? step`). Because the title slot is otherwise used
   to auto-generate "Step N", a subtitled step writes only the meta and we
   regenerate the "Step N" label here, stacked above it:

       !!! step "<span class=\"meta\">optional</span>"

   The label can only be generated at the end of the title (::after), so we
   flex-column and use `order` to lift it above the meta. The icon is
   absolutely positioned, so the column only stacks the text. */
.md-typeset .step > .admonition-title:has(> .meta),
.md-typeset .step > summary:has(> .meta) {
  display: flex;
  flex-direction: column;
}
.md-typeset .step > .admonition-title:has(> .meta)::after {
  content: "Step " counter(step-counter);
  order: 1;
}
/* Lift the generated "Step N" label above the meta subtitle; the faded/sized
   styling is shared with all admonitions (see "Admonition meta subtitle"). */
.md-typeset .step > .admonition-title > .meta,
.md-typeset .step > summary > .meta {
  order: 2;
}
