/* Icon library: {% icon "set/name" %} inline SVGs from static/img/icons/ (docs/styleguide.md "Icon library").
   The SVGs paint with four inputs:
     currentColor        lines (the .icon's `color`)
     --icon-accent       accent strokes (thin lines: accessible accent on light tones)
     --icon-accent-fill  accent fills (areas: the pale cobalt)
     --icon-surface      occluding "paper" fills (the background the icon sits on)
   Tones set them below; components with their own background set --icon-surface. Tokens only, no hex here. */

.icon { display: inline-block; flex: none; vertical-align: middle; overflow: visible; }
svg.icon { max-width: none; } /* never squeezed by the img/svg max-width reset */

/* Line colour. ui-14 glyphs always follow the text colour; the two-tone line-32 and spot-96 drawings use
   --icon-line (the heading navy; a quieter tone on the navy surface). */
.icon--line-32, .icon--spot-96 { color: var(--icon-line, currentColor); }
.icon.icon--inherit { color: inherit; } /* opt out: lines follow the surrounding text colour */

/* ---- tones (design v2): lines in the heading navy, accent strokes action cobalt, accent areas the pale cobalt;
   gp-base.css repeats these per tone class (tone-deep: gold accents, quiet lines on navy). No mint. ---------------- */
:root, body, .tone-white, .tone-light, .tone-black, .tone-dark, .tone-dark-grey {
  --icon-accent: var(--gp-icon-stroke);
  --icon-accent-fill: var(--gp-icon-fill);
  --icon-surface: var(--surface, transparent);
  --icon-line: var(--gp-heading);
}

/* components that sit on their own background */
.topic-card { --icon-surface: var(--card); }
/* support pages: .cat-card, .guide-card, .help-contact … set it in static/css/pages/support.css */
.nav-card__icon { --icon-surface: var(--gp-accent-tint); }

/* ---- links and buttons -------------------------------------------------------------------------------- */
/* Icons inside links/buttons follow the control: lines take the link colour on hover/focus. */
:is(a, button):is(:hover, :focus-visible) .icon { --icon-line: currentColor; }
@media (prefers-reduced-motion: no-preference) {
  .icon { transition: color var(--transition); }
}

/* ---- inside existing components ----------------------------------------------------------------------
   Sizes come from the tag (size=…) or from the component's own class (.cat-card__icon, .guide-card__icon,
   .nav-card__icon, .feature__icon); these only replace rules that components.css writes for <img>. */
.icon-list .icon { margin-top: 1px; }
.tabs__tab .icon { margin-right: 8px; }
