/* Service icons (spec 013). A gradient badge with a white glyph, used by the top bar and the Home cards.
   The glyph is an inline SVG symbol (the sprite in layout/global_nav.html), so the contract is in
   specs/013-service-icons/contracts/icon-markup.md. Light mode only: the application has no dark mode.

   Never size the glyph with a percentage: percentage width/height combined with overflow:visible rendered nothing
   in the spike (research R1). It is calc() from the badge size instead. */

.svc-badge {
  --svc-size: 24px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--svc-size);
  height: var(--svc-size);
  border-radius: 22%;
  color: #fff;
  background: linear-gradient(45deg, var(--svc-g1), var(--svc-g2));
  transition: filter .12s;
}

/* Top bar groups and the Home entry. The same 24px as the menu items: with every group visible (an admin) the bar has
   to fit seven badges, and a 26px badge pushed the last label under the user box at 1280px wide. */
.svc-badge--top { --svc-size: 24px; }

/* The same reason: the bar's entries are tighter on desktop, where they sit in one row (4px less padding a side and
   a 5px gap between badge and label). The mobile drawer (max-width 860px) stacks them and keeps the original look. */
@media (min-width: 861px) {
  .app-navitem--top { padding-left: 6px; padding-right: 6px; gap: 5px; }
}

/* Home cards. */
.svc-badge--card { --svc-size: 48px; }

/* The glyph is 62% of the badge. overflow:visible lets the two glasses glyphs draw past the 24-unit grid. */
.svc-icon {
  width: calc(var(--svc-size) * .62);
  height: calc(var(--svc-size) * .62);
  overflow: visible;
}

/* One gradient per category: --svc-g1 is the dark stop (bottom left), --svc-g2 the light stop (top right).
   Each pair keeps a white glyph at 4.5:1 or better at both stops. */
.svc-badge[data-cat="home"]  { --svc-g1: #576478; --svc-g2: #66768D; }
.svc-badge[data-cat="proc"]  { --svc-g1: #02629E; --svc-g2: #0378C1; }
.svc-badge[data-cat="wt"]    { --svc-g1: #08615E; --svc-g2: #0B827E; }
.svc-badge[data-cat="pay"]   { --svc-g1: #1C660D; --svc-g2: #248611; }
.svc-badge[data-cat="asset"] { --svc-g1: #81540E; --svc-g2: #A16912; }
.svc-badge[data-cat="admin"] { --svc-g1: #C70000; --svc-g2: #EB0000; }
.svc-badge[data-cat="task"]  { --svc-g1: #5F21ED; --svc-g2: #7742F0; }
.svc-badge[data-cat="other"] { --svc-g1: #4B5563; --svc-g2: #6B7280; }

/* States. Hover and keyboard focus brighten the badge, pressing darkens it. Brightened, the white glyph keeps at
   least 3.9:1 (research R13). Pressed is listed after hover so it wins while the button is held. */
.app-navitem:hover .svc-badge,
.app-navitem:focus-visible .svc-badge,
.home-card:hover .svc-badge,
.home-card:focus-visible .svc-badge { filter: brightness(1.10); }

.app-navitem:active .svc-badge,
.home-card:active .svc-badge { filter: brightness(.90); }

/* The current page, and the group that contains it, use the application's accent blue like the label's highlight.
   Three classes out-rank the two of the category rules above. Hover and pressed still compose with it. */
.app-navitem.is-active .svc-badge,
.app-navgroup__toggle.is-current-section .svc-badge { --svc-g1: #1E40AF; --svc-g2: #2563EB; }

@media (prefers-reduced-motion: reduce) {
  .svc-badge { transition: none; }
}
