/* ============================================================================
   KHADAMAT CHROME OVERRIDES
   ----------------------------------------------------------------------------
   Khadamat-branded recolour of the two fixed controls every page carries, for
   khadamatfm.ae only: the back-to-top tile and the assistant launcher.

   Why a separate file and not another values-only block in khadamat-theme.css:
   the theme layer loads BEFORE sdeira-search.css / sdeira-assistant.css /
   sdeira-nav-controls.css (see scripts/generate_pages.py::head()), so an
   equal-specificity override there would lose on source order to the shared
   sheet that sets the Sdeira-brand colours. This file loads after all of
   them, so plain selectors win by order alone - no !important, no
   specificity gymnastics.

   Why these can't be done by reassigning the ROLE tokens or the --brand-*
   primitives: the assistant paints its launcher with the Sdeira identity
   primitives directly (--brand-sweihan / --brand-razeen / --brand-al-khatim),
   and the T4 charter forbids touching a --brand-* primitive site-wide. So the
   launcher is recoloured here with explicit khadamat selectors, the way a
   named variant of a shared component is allowed to differ (AGENTS.md
   "Component consistency"). The main sdeiragroup.ae site never links this
   file, so its orange launcher and its grey back-to-top are untouched.

   Colours are the four Khadamat brand greens from sdeira-tokens.css, reused
   not re-declared: Deep Forest (#29523D, --brand-khadamat-green-deep), Olive
   (#547035, --brand-khadamat-green), Basil (#809C50, --brand-khadamat-green-
   soft) and Soft Sage (#BABF84, --brand-khadamat-lime).
   ========================================================================== */

/* ---- Back-to-top: grey at rest, Khadamat green only on hover/focus ------- */
/* Site owner, 31 Aug 2026: a solid-green tile at rest read as an always-on
   accent, not the low-priority utility control every other page treats it
   as - Khadamat's own green belongs to the ACTIVE (hover/focus) state, the
   same lifecycle every other icon-tile control here uses (rest = neutral,
   interaction = brand colour). Rest now matches the shared sheet's own grey
   tile exactly (rgba(65, 64, 66, .55), sdeira-subpage.css's un-overridden
   default) rather than inventing a second grey; only the two interactive
   states below stay Khadamat-branded. */
.scroll-top {
  background: rgba(65, 64, 66, .55);
  color: var(--brand-white);
}

.scroll-top.visible {
  opacity: .55;
}

/* Hover lifts to Olive (darker than Basil so the white glyph keeps clear AA),
   focus stays on the Deep Forest fill. Both states override the shared rule
   that lifted the tile to the Sdeira Razeen/black pair. */
.scroll-top:hover,
.scroll-top:focus-visible {
  background: var(--brand-khadamat-green);
  color: var(--brand-white);
  opacity: 1;
}

/* ---- Assistant launcher: Sdeira orange mark -> Khadamat green mark ------- */
/* The fixed launcher button's own glyph colour (the caret that replaces the
   mark while open) and the resting emphasis colour. */
.ai-chat-toggle {
  color: var(--brand-khadamat-green-deep);
}

.ai-chat-toggle:is(:hover, :focus-visible) {
  color: var(--brand-khadamat-green-deep);
}

/* The centre mark WAS the Sdeira shape (sdeira-mark.png) used as a CSS mask,
   painted from a Sweihan->Razeen gradient with orange glows, then a
   three-stop Khadamat-green gradient with green glows, then a flat single
   Khadamat green with no gradient. Site owner, 25 Aug 2026, final pass: use
   Khadamat's own emblem file directly - "Khadamat Emblem/1- Full Colour",
   supplied by the site owner, assets/images/brand/khadamat-mark.svg - not a
   silhouette recoloured to stand in for it. The emblem is already flat, four
   discrete brand greens with no blend between them and no glow (see the
   file's own four `fill` values), so this drops the mask/gradient/filter
   entirely rather than trying to reproduce them: a plain background-image,
   no mask. */
.ai-star-field,
.ai-star-field::before {
  filter: none;
}

.ai-star-field::before {
  background: url("../images/brand/khadamat-mark.svg?v=3b14d73bb9372478") center / contain no-repeat;
  -webkit-mask: none;
  mask: none;
}

/* The five orbiting sparks are removed on Services: the launcher keeps the
   single emblem mark alone, per the owner's direction (the emblem icon only,
   no four-point stars). The shared sheet paints these against the shared
   Sdeira identity, so they are dropped here for the khadamat variant rather
   than recoloured. */
.ai-brand-star {
  display: none;
}

/* No hover treatment on the mark itself - "no effect on the icon" covers
   hover too, and the emblem has no single fill to step a colour on. Both
   filters restated as none: the shared sheet's own hover rules
   (sdeira-assistant.css) put a Sweihan glow and a background-position shift
   back on the field and the mark, which this selector must beat on
   specificity/order, not just omit. The launcher button's own glyph colour
   (.ai-chat-toggle above) still carries the hover cue. */
.ai-chat-toggle:is(:hover, :focus-visible) .ai-star-field,
.ai-chat-toggle:is(:hover, :focus-visible) .ai-star-field::before {
  filter: none;
  background-position: center;
}

/* ---- Panel head: Black bar + Sdeira wordmark -> Khadamat green + Khadamat
   lockup ----------------------------------------------------------------
   The launcher above is fully Khadamat-branded closed; open, the panel head
   still said Sdeira's identity twice over - sdeira-assistant.css grounds it
   on --surface-inverse (Black, the group's own dark, not one of the four
   Khadamat greens) and its one piece of content is the Sdeira wordmark
   ("the logo says whose assistant this is" - sdeira-assistant.css's own
   comment on that element). Regrounded on Deep Forest, Khadamat's primary
   (--surface-brand-deep, already reassigned to it in section 1 above, not a
   new value), with the supplied Khadamat lockup rather than the Sdeira one -
   no new asset. White already holds AAA on Deep Forest, so the close glyph
   and its focus ring need no change to stay legible. */
.ai-chat-head {
  /* Deep Forest itself (#29523D, brand book 4.1). --surface-brand-deep is a
     30% black mix of Olive Green made for the nav button's hover wipe and is
     not a palette colour (owner, 18 Oct 2026). */
  background: var(--brand-khadamat-green-deep);
}

/* ONE LOCKUP FOR BOTH LANGUAGES, and one rule for both. Khadamat's book
   publishes the bilingual lockup alone: there is no Arabic-only and no
   English-only Khadamat file to take per language, so the panel head reads
   the same white file on the Arabic site and on the English one, which is
   what the header and footer partials do too. The rule was two rules, one
   per lang attribute, while the site carried the pre-rebrand per-language
   rasters; a rule per language that resolves to one file is a second
   answer to a question the brand book only answers once. */
html:is([lang="ar"], [lang="en"]) .ai-chat-logo {
  content: url("../images/companies/khadamat-logo-dual-white.svg?v=f2cf786c7de159b2");
}

/* ---- Message avatar: the same emblem, same reason as the launcher --------
   .ai-message-avatar::before masked sdeira-mark.png with --surface-brand
   (Khadamat green) and a hardcoded --brand-razeen (Sdeira gold/orange) glow.
   Same fix as the launcher mark above: the real emblem file directly, no
   mask, no glow. */
.ai-message-avatar::before {
  background: url("../images/brand/khadamat-mark.svg?v=3b14d73bb9372478") center / contain no-repeat;
  -webkit-mask: none;
  mask: none;
  filter: none;
}
