/* Notification ticker (RSPH-195) — see templates/app/_ticker.html.twig for the markup and why the
   item list appears twice. The track holds both copies side by side and slides left by exactly
   50% of its own width (one copy), so the loop has no visible seam. Tokens (--bs-*) are the same
   ones app.css re-tokenises for dark mode, so this follows the theme toggle with no extra rule.

   --ticker-height is the authoritative rendered height (single-line content, so it's genuinely
   fixed) — app.css's mobile block (@media max-width:860px) reads the same variable to push the
   fixed .appbar/.sidebar/.appbar__scrim down when a ticker is actually present, via
   #app-ticker-mount:has(.ticker). Keep min-height in step with .ticker__item's padding/font-size
   below if either changes, or the mobile offset drifts out of sync. */
:root {
    --ticker-height: 55px;
}

.ticker {
    background: var(--bs-ink);
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid var(--bs-line);
    min-height: var(--ticker-height);
}

.ticker__track {
    display: flex;
    width: max-content;
    animation: ticker-scroll 30s linear infinite;
}

.ticker:hover .ticker__track {
    animation-play-state: paused;
}

/* min-width guarantees each group spans at least a full viewport, so the loop technique above
   (translate by exactly one group's width) always keeps the second, aria-hidden copy clipped
   outside .ticker's overflow:hidden box. Without this, short content (few items, a short
   message) made each group narrower than the ticker bar itself, so BOTH copies sat inside the
   visible area at once — the message appeared to be duplicated on screen rather than looping.
   vw, not a percentage, so it resolves against the viewport rather than the track's own
   max-content-sized containing block (a percentage min-width there computes to 0/auto). */
.ticker__group {
    display: flex;
    flex-shrink: 0;
    min-width: 100vw;
}

.ticker__item {
    padding: 0.85rem 2.5rem;
    font-size: 1.1rem;
    font-family: var(--bs-font-ui);
}

.ticker__item a {
    color: inherit;
    text-decoration: none;
}

.ticker__item a:hover,
.ticker__item a:focus-visible {
    text-decoration: underline;
}

/* The category badge (RSPH-195 follow-up) — "Job:", "Parts:", "Finance:" — replaces the plain
   colour dot this used to be: same colour-coding-by-tone principle as the alerts panel's
   badge-flag--{tone} chips (see NotificationType::tone(), whose values these modifiers are named
   after, and templates/notification/index.html.twig which pairs badge-flag--{tone} with the
   type's own label the same way). Same chip shape/typography as .badge-flag (mono, uppercase,
   letter-spacing, 6px radius) for one visual "badge" language app-wide, but its own colours: the
   ticker bar is always the dark --bs-ink surface regardless of the page's own light/dark theme, so
   badge-flag's pastel-on-white palette would read flat/washed-out here — these borrow app.css's
   dark-mode "neon" badge palette instead, at low opacity so the badge reads as a tinted chip
   rather than a solid block. */
.ticker__badge {
    display: inline-block;
    font-family: var(--bs-font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    padding: calc(0.15rem * var(--rs-pill-pad)) calc(0.55rem * var(--rs-pill-pad));
    border-radius: var(--rs-pill-radius);
    margin-inline-end: 0.6rem;
    vertical-align: middle;
}

.ticker__badge--green { background: rgba(61, 220, 151, 0.16); color: #3ddc97; border: 1px solid rgba(61, 220, 151, 0.5); }
.ticker__badge--amber { background: rgba(255, 176, 46, 0.16); color: #ffb02e; border: 1px solid rgba(255, 176, 46, 0.5); }
.ticker__badge--red { background: rgba(255, 107, 99, 0.16); color: #ff6b63; border: 1px solid rgba(255, 107, 99, 0.5); }
.ticker__badge--blue { background: rgba(95, 180, 240, 0.16); color: #5fb4f0; border: 1px solid rgba(95, 180, 240, 0.5); }

@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* A seizure/vestibular-safety concern, not just a preference: an infinite sideways scroll is
   exactly the motion prefers-reduced-motion exists to suppress. Falls back to a plain scrollable
   bar so the content is still reachable. */
@media (prefers-reduced-motion: reduce) {
    .ticker__track { animation: none; }
    .ticker { overflow-x: auto; }
}

/* A registration named in a ticker message is drawn as the country's number plate (app/_ticker_message.html.twig), one compact
   height, H, in the line of text. Same approach as the vehicle card's plate (app.css .vehicle-card__plate): the catalogue plates
   carry their job-page height inline, hence the !important; the UK plate is sized in rem so it is rescaled measure by measure. */
.ticker__plate { --h: 1.5rem; vertical-align: middle; margin: 0 0.15rem; white-space: nowrap; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.ticker__plate.plate { --plate-h: var(--h) !important; }
.ticker__plate.reg-plate--uk {
    --strip: calc(var(--h) * 0.59 + 1px);
    box-sizing: border-box; height: var(--h); font-size: calc(var(--h) * 0.78); letter-spacing: 0.03em;
    padding: 0 calc(var(--h) * 0.24) 0 calc(var(--h) * 0.79);
    border-width: 1.5px; border-radius: 4px;
}
.ticker__plate.reg-plate--uk.reg-plate--long { font-size: calc(var(--h) * 0.78 * 7 / var(--plate-chars, 8)); letter-spacing: 0.01em; }
.ticker__plate.mofa { --plate-h: 1.95rem; }
a:hover > .ticker__plate, a:focus-visible > .ticker__plate { transform: none; }
