/* Icon for the module's item in the Bitrix24 sidebar.
   ==========================================================================
   The row is written into each site's .top.menu.php by Install\LeftMenu with
   a stable menu_item_id = crc32('ithive.ninebox') = 2760235704, which the menu
   component renders as li[data-id="2760235704"] - that is what the selectors
   below hook onto.

   HOW THE PORTAL PAINTS ITS OWN ICONS
   (intranet/.../menu/left_vertical/src/css/menu-item-icon.css)

       .menu-item-icon {
           mask-image: var(--menu-item-icon);
           mask-size: contain;
           background-color: var(--ui-color-design-plain-content-icon-secondary);
       }
       .menu-item-block:hover .menu-item-icon,
       .menu-item-active .menu-item-icon {
           background-color: var(--ui-color-design-selection-content-icon);
       }
       .menu-item-no-icon-state .menu-item-icon {
           mask-image: none;
           background-color: var(--ui-color-base-8);
           border-radius: 50%;
       }

   So the glyph is a MASK and its colour comes from `background-color`, taken
   from two design tokens - never from `currentColor`. We follow that exactly,
   which is what makes our icon the same colour as every neighbour in every
   theme without this file knowing anything about themes.

   WHAT WAS WRONG BEFORE

   This file used to paint the mask with `currentColor` plus `opacity: .7`.
   Both were mistakes:

     - our item carries `menu-item-no-icon-state` (the portal does not know it
       has an icon), and in that state `color` is the colour of the LETTER on
       a pale round chip - a dark value on purpose, because it is meant to sit
       on a light chip. On a dark sidebar that painted our glyph dark while
       every neighbour stayed white;
     - the token already carries its own alpha (measured on the stands:
       rgba(255,255,255,.7)), so an extra `opacity: .7` made our glyph half as
       bright as the neighbouring ones - the washed-out grey mark in the
       report.

   The same measurement killed the other tempting shortcut, switching a
   fixed-colour picture by theme name the way ithive.hrassistant and
   ithive.assessment360 do: both stands report `bitrix24-light-theme` together
   with `--ui-context-edge-dark`, i.e. the "light theme" has a DARK sidebar.
   The theme name does not tell you the colour of the panel; the Air context
   class does (see b24ui-design.mdc). With the mask the question does not
   arise at all - the file's own colours are ignored, only its shape matters.

   The chip: `menu-item-no-icon-state` also gives the element a round pale
   background and a radius, both of which we cancel, so the row looks like the
   vendor items around it rather than like a letter avatar. The letter itself
   is hidden by `font-size: 0`.

   The two glyph files are named the way the whole suite names them - after
   the surface they are for, not after their own colour:

       ninebox_dark.svg  = white glyph   -> dark panel
       ninebox_light.svg = #535C69 glyph -> light panel

   Only the no-mask fallback at the bottom needs that distinction, and it
   chooses between them by the Air context class on <body>.

   Until the files exist this stylesheet is NOT attached at all
   (Handlers\Main\Asset checks for them first): with no glyph, `font-size: 0`
   would hide the letter and leave an empty square.
   ========================================================================== */

li[data-id="2760235704"].menu-item-no-icon-state .menu-item-icon {
    -webkit-mask-image: url("/images/ithive.ninebox/icon/ninebox_dark.svg");
    mask-image: url("/images/ithive.ninebox/icon/ninebox_dark.svg");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    /* The vendor glyphs are drawn on a 24px canvas with their own padding and
       sit in a 26px box under `contain`; ours is an 18px canvas edge to edge,
       so it is sized explicitly to carry the same visual weight. */
    -webkit-mask-size: 22px 22px;
    mask-size: 22px 22px;
    background-color: var(--ui-color-design-plain-content-icon-secondary);
    background-image: none;
    border-radius: 0;
    font-size: 0;
}

li[data-id="2760235704"].menu-item-no-icon-state:hover .menu-item-icon,
li[data-id="2760235704"].menu-item-no-icon-state.menu-item-active .menu-item-icon,
li[data-id="2760235704"].menu-item-no-icon-state[data-contains-active-item="Y"] .menu-item-icon {
    background-color: var(--ui-color-design-selection-content-icon);
}

/* A browser without mask support still gets a glyph, just a fixed-colour one.
   The choice is made by the Air context class the template stamps on <body>,
   because that is the only thing that actually states whether the sidebar is
   dark - the theme name does not. */
@supports not ((-webkit-mask-image: url("")) or (mask-image: url(""))) {
    li[data-id="2760235704"].menu-item-no-icon-state .menu-item-icon {
        background-image: url("/images/ithive.ninebox/icon/ninebox_light.svg");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 22px 22px;
        background-color: transparent;
    }

    body[class*="--ui-context-edge-dark"] li[data-id="2760235704"].menu-item-no-icon-state .menu-item-icon {
        background-image: url("/images/ithive.ninebox/icon/ninebox_dark.svg");
    }
}
