/*
 * SPDX-FileCopyrightText: 2026 ursa.nz <code@ursa.nz>
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 * The ursa look for lab.ursa.nz: the violet accent, and the logo GitLab declines
 * to give a logged-out visitor. Deployed to /etc/gitlab/ursa-brand.css on the
 * silo's config volume and injected into every page by the sub_filter in
 * gitlab.rb, because GitLab ships no custom-stylesheet setting.
 *
 * Both halves below read GitLab's own class and token names, so neither is
 * supported and both want a check after a major upgrade. Each fails
 * cosmetically: the interface returns to stock blue, or the logo returns to the
 * tanuki.
 */

/* --- the violet accent --- */
/*
 * GitLab 19 resolves its whole interface through design tokens, and one palette
 * scale carries the accent: --gl-color-blue-500 fills a primary button,
 * --gl-color-blue-400 is a link in dark mode, and the focus ring, active
 * navigation and progress meters all resolve through the same scale. So
 * redefining the eleven stops of that one scale re-tints every accented surface
 * at once, and nothing else has to be touched. The neutrals stay grey and the
 * semantic red, green and amber stay stock, so a warning still reads as a
 * warning. Informational blue does become violet, since GitLab draws info from
 * the accent scale rather than a scale of its own.
 *
 * GitLab's stops run 50 (lightest) to 950 (darkest) and the ursa ramp has the
 * same eleven, so the mapping is one to one and the key #3F2F66 lands at 700,
 * where GitLab uses it for a hover and a pressed state rather than a button
 * fill. That keeps the tint gentle and keeps the contrast comfortable: violet
 * 500 on white measures 5.5:1, ahead of the 4.7:1 of the blue it replaces.
 *
 * The scale is identical in light and dark (only the semantic tokens above it
 * differ, picking 400 instead of 500), so one ramp serves both and all four
 * selectors GitLab defines it under are listed together. Those selectors match
 * GitLab's own specificity exactly, so this file wins on source order alone. It
 * is injected immediately before </head>, after every GitLab stylesheet, and
 * that position is what makes the override hold. Injecting it any earlier would
 * silently lose the cascade and leave the interface stock blue.
 */

:root,
.gl-light-scope,
:root.gl-dark,
.gl-dark-scope {
	--gl-color-blue-50: #f7f5fb;
	--gl-color-blue-100: #efebf7;
	--gl-color-blue-200: #ddd5ec;
	--gl-color-blue-300: #bcaede;
	--gl-color-blue-400: #9583c7;
	--gl-color-blue-500: #6f5bb0;
	--gl-color-blue-600: #55428e;
	--gl-color-blue-700: #3f2f66;
	--gl-color-blue-800: #2d2149;
	--gl-color-blue-900: #1e1632;
	--gl-color-blue-950: #120d20;
}

/* --- the lab logo for a logged-out visitor --- */
/*
 * GitLab hands the custom header logo to the sidebar only for a signed-in user:
 * `logo_url: current_appearance&.header_logo_path` sits in
 * super_sidebar_logged_in_context and has no counterpart in the logged-out one.
 * With that prop empty the BrandLogo component falls through to its inlined
 * tanuki, so an anonymous visitor sees GitLab's mark where a member sees ours.
 * That is upstream behaviour, not a setting left unfilled.
 *
 * So the tanuki is hidden and the same header logo is drawn in its place. Both
 * rules hang off :has(.tanuki-logo), which is exactly the logged-out condition: a
 * signed-in user gets the component's own <img> and matches neither rule, so the
 * logo is never doubled. If GitLab ever closes the gap and passes the prop to
 * everyone, the tanuki stops rendering, both rules stop matching, and this
 * degrades to GitLab drawing the right logo itself.
 *
 * The height matches the gl-h-6 the component's own <img> carries and the ratio
 * is the asset's own 522x96, so a logged-out header occupies what a signed-in one
 * does. The path is an appearance upload and carries a record id, so re-uploading
 * the logo under Admin, Appearance mints a new path and leaves this rule painting
 * the old file. Check it after changing the logo.
 */

.brand-logo:has(.tanuki-logo) .tanuki-logo {
	display: none;
}

.brand-logo:has(.tanuki-logo)::after {
	content: "";
	display: inline-block;
	height: 1.5rem;
	aspect-ratio: 522 / 96;
	max-width: 100%;
	vertical-align: middle;
	background: url("/uploads/-/system/appearance/header_logo/1/lab_3x.png") left center / contain no-repeat;
}
