/**
 * Site Logo.
 *
 * The variant swap lives entirely here. Peak's header publishes its own state
 * on `.peak-header` — `is-stuck`, `is-transparent`, `is-mobile` — so which
 * artwork shows is a cascade question, not a script one. Order matters: the
 * rules below run main → hero → scrolled → mobile, so a mobile mark wins over
 * everything (a phone header is the one place the full lockup will not fit),
 * and each rule is gated behind a `has-*` class the widget only adds when that
 * artwork actually exists.
 *
 * @package Peak
 */

.peak-site-logo {
	display: flex;
	justify-content: var(--pkl-align, flex-start);
	align-items: center;
	max-width: 100%;
}

.peak-site-logo__link {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	color: var(--pkl-color, inherit);
	text-decoration: none;
	line-height: 0;
	transition: opacity 0.25s ease;
}


.peak-site-logo__img {
	display: block;
	width: var(--pkl-w, 150px);
	max-width: 100%;
	max-height: var(--pkl-h, none);
	height: auto;
	object-fit: contain;
	border-radius: var(--pkl-radius, 0);
	/* A logo that resizes when the header shrinks should glide, not jump. */
	transition: width 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.peak-site-logo__text {
	display: block;
	line-height: var(--pkl-lh, 1.1);
	font-family: var(--pkl-ff, inherit);
	font-size: var(--pkl-fs, 1.25rem);
	font-weight: var(--pkl-fw, 600);
	letter-spacing: var(--pkl-ls, normal);
	text-transform: var(--pkl-tt, none);
	color: var(--pkl-color, inherit);
	white-space: nowrap;
}

/* ---- variants -------------------------------------------------------- */

/* Only the main one by default; the alternates ride along in the DOM so the
   swap costs nothing at the moment it happens. */
.peak-site-logo__img--stuck,
.peak-site-logo__img--light,
.peak-site-logo__img--mobile,
.peak-site-logo__img--dark { display: none; }

/* Over a hero: a transparent header that has not moved yet. */
.peak-header.is-transparent:not(.is-stuck) .peak-site-logo.has-light .peak-site-logo__img--main { display: none; }
.peak-header.is-transparent:not(.is-stuck) .peak-site-logo.has-light .peak-site-logo__img--light { display: block; }

/* Scrolled. */
.peak-header.is-stuck .peak-site-logo.has-stuck .peak-site-logo__img--main,
.peak-header.is-stuck .peak-site-logo.has-stuck .peak-site-logo__img--light { display: none; }
.peak-header.is-stuck .peak-site-logo.has-stuck .peak-site-logo__img--stuck { display: block; }

/* Small screens win over both. */
.peak-header.is-mobile .peak-site-logo.has-mobile .peak-site-logo__img--main,
.peak-header.is-mobile .peak-site-logo.has-mobile .peak-site-logo__img--light,
.peak-header.is-mobile .peak-site-logo.has-mobile .peak-site-logo__img--stuck { display: none; }
.peak-header.is-mobile .peak-site-logo.has-mobile .peak-site-logo__img--mobile { display: block; }

/* A narrower logo once the header sticks — set independently of the artwork,
   so it works with one image just as well as with two. */
.peak-header.is-stuck .peak-site-logo.pkv-pkl-w-stuck .peak-site-logo__img { width: var(--pkl-w-stuck); }

@media (prefers-reduced-motion: reduce) {
	.peak-site-logo__img, .peak-site-logo__link { transition: none; }
}


/* ---- dark mode ---------------------------------------------------------- */

/* Unlike the three above, this one is not about the header: a logo drawn for a
   light background is invisible on a dark one wherever it sits. It therefore
   comes LAST and beats every header state — a scrolled header in dark mode
   still needs the dark-mode artwork, not the scrolled one. */
:root[data-peak-mode="dark"] .peak-site-logo.has-dark .peak-site-logo__img--main,
:root[data-peak-mode="dark"] .peak-site-logo.has-dark .peak-site-logo__img--stuck,
:root[data-peak-mode="dark"] .peak-site-logo.has-dark .peak-site-logo__img--light,
:root[data-peak-mode="dark"] .peak-site-logo.has-dark .peak-site-logo__img--mobile { display: none; }
:root[data-peak-mode="dark"] .peak-site-logo.has-dark .peak-site-logo__img--dark { display: block; }

/* A wordmark needs no second file — it is text, and the ink token has already
   crossed over with everything else. */
