/**
 * Valhalla for Vikinger — Announcements (front end).
 *
 * All colors come from the Vikinger CSS variables (current preset / dark mode), with fallbacks
 * for other themes. Sizes use the theme type scale formula.
 */

/* ---------------------------------------------------------------------------
 * Style tokens
 * ------------------------------------------------------------------------- */
.vhl-ann-item,
.vhl-ann-box {
	--vhl-ann-color: var(--color-primary, #23d2e2);
	--vhl-ann-shadow: var(--color-primary-shadow, 4px 7px 12px 0 rgba(35, 210, 226, .2));
}

.vhl-ann-item.is-style-secondary,
.vhl-ann-box.is-style-secondary {
	--vhl-ann-color: var(--color-secondary, #615dfa);
	--vhl-ann-shadow: var(--color-secondary-shadow, 4px 7px 12px 0 rgba(97, 93, 250, .2));
}

.vhl-ann-item.is-style-tertiary,
.vhl-ann-box.is-style-tertiary {
	--vhl-ann-color: var(--color-tertiary, #fd4350);
	--vhl-ann-shadow: var(--color-tertiary-shadow, 4px 7px 12px 0 rgba(253, 67, 80, .2));
}

.vhl-ann-item.is-style-dark,
.vhl-ann-box.is-style-dark {
	--vhl-ann-color: var(--color-loading-screen-background, #3e3f5e);
	--vhl-ann-shadow: var(--color-box-shadow, 0 0 40px 0 rgba(94, 92, 154, .06));
}

/* ---------------------------------------------------------------------------
 * Root & zones
 * ------------------------------------------------------------------------- */
.vhl-ann-root {
	font-family: var(--vikinger-font-family-primary, inherit);
}

.vhl-ann-item[hidden],
.vhl-ann-zone[hidden] {
	display: none !important;
}

.vhl-ann-zone-top {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/*
 * Footer-printed top zones wait for the script to move them (into the page .content-grid on
 * Vikinger, to the top of <body> elsewhere): never flash them below the footer.
 */
.vhl-ann-root.is-mode-content > .vhl-ann-zone-top,
.vhl-ann-root.is-mode-body-late > .vhl-ann-zone-top {
	display: none;
}

/* Vikinger: inside the page .content-grid (placed by JS). */
.content-grid > .vhl-ann-zone-top {
	margin-bottom: 24px;
}

.content-grid.full > .vhl-ann-zone-top {
	width: 95%;
	max-width: 1184px;
	margin: 24px auto;
}

/* The theme removes the top margin of the first header/grid of a .content-grid: keep that. */
.content-grid > .vhl-ann-zone-top + .section-header,
.content-grid > .vhl-ann-zone-top + .grid,
.content-grid > .vhl-ann-zone-top + .grid.medium-space {
	margin-top: 0;
}

/* Other themes: full-width bars at the top of <body>. */
.vhl-ann-root.is-mode-body .vhl-ann-zone-top,
body > .vhl-ann-zone-top {
	gap: 0;
	position: relative;
	z-index: 50;
}

.vhl-ann-root.is-mode-body .vhl-ann-bar,
body > .vhl-ann-zone-top .vhl-ann-bar {
	border-radius: 0;
	box-shadow: none;
	padding-left: max(20px, calc((100% - 1184px) / 2));
	padding-right: max(20px, calc((100% - 1184px) / 2));
}

.vhl-ann-zone-floating {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 9990;
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 360px;
	max-width: calc(100vw - 48px);
	pointer-events: none;
	transition: left .35s ease-in-out;
}

.vhl-ann-zone-floating > .vhl-ann-item {
	pointer-events: auto;
}

/* ---------------------------------------------------------------------------
 * Shared item parts
 * ------------------------------------------------------------------------- */
.vhl-ann-item {
	position: relative;
	line-height: 1.5;
	animation: vhl-ann-in .35s ease-out both;
}

.vhl-ann-item.is-leaving {
	animation: vhl-ann-out .25s ease-in both;
}

.vhl-ann-title {
	margin: 0 0 2px;
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1.3em;
}

.vhl-ann-text {
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 500;
	line-height: 1.5em;
	overflow-wrap: anywhere;
}

.vhl-ann-text p {
	margin: 0;
	line-height: 1.5em;
}

.vhl-ann-text p + p {
	margin-top: 6px;
}

.vhl-ann-text a {
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
}

.vhl-ann-icon {
	display: flex;
	flex-shrink: 0;
	justify-content: center;
	align-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
}

.vhl-ann-icon svg {
	width: 18px;
	height: 18px;
	fill: #fff;
}

.vhl-ann-close {
	display: flex;
	flex-shrink: 0;
	justify-content: center;
	align-items: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background-color .2s ease-in-out, opacity .2s ease-in-out;
}

.vhl-ann-close-icon {
	width: 10px;
	height: 10px;
}

.vhl-ann-close:focus-visible,
.vhl-ann-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.vhl-ann-button.button {
	display: inline-flex;
	width: auto;
	height: 40px;
	padding: 0 20px;
	white-space: nowrap;
	text-decoration: none;
}

/* ---------------------------------------------------------------------------
 * Top bar
 * ------------------------------------------------------------------------- */
.vhl-ann-bar {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 64px;
	padding: 12px 16px 12px 20px;
	border-radius: 12px;
	background-color: var(--vhl-ann-color);
	box-shadow: var(--vhl-ann-shadow);
	color: #fff;
}

.vhl-ann-bar .vhl-ann-icon {
	background-color: rgba(255, 255, 255, .18);
}

.vhl-ann-bar .vhl-ann-body {
	flex: 1 1 auto;
	min-width: 0;
}

.vhl-ann-bar .vhl-ann-title,
.vhl-ann-bar .vhl-ann-text,
.vhl-ann-bar .vhl-ann-text p {
	color: #fff;
}

.vhl-ann-bar .vhl-ann-actions {
	flex-shrink: 0;
}

.vhl-ann-bar .vhl-ann-button.button {
	background-color: rgba(255, 255, 255, .2);
	box-shadow: none;
	color: #fff;
}

.vhl-ann-bar .vhl-ann-button.button:hover {
	background-color: #fff;
	color: var(--vhl-ann-color);
}

.vhl-ann-bar.is-style-dark .vhl-ann-button.button:hover {
	color: var(--color-text, #3e3f5e);
}

.vhl-ann-bar .vhl-ann-close {
	background-color: rgba(255, 255, 255, .12);
}

.vhl-ann-bar .vhl-ann-close:hover {
	background-color: rgba(255, 255, 255, .28);
}

.vhl-ann-bar .vhl-ann-close-icon {
	fill: #fff;
}

.vhl-ann-bar.is-style-dark {
	border: 1px solid var(--color-border, rgba(255, 255, 255, .08));
}

/*
 * Readable text on every colour preset (WCAG AA): the bar's text is black on light announcement
 * colours (e.g. a cyan or green primary) and white on dark ones, picked from the colour's relative
 * luminance (Y of XYZ; at 0.18 black and white give the same contrast, 4.6:1). The button becomes
 * a solid chip in that text colour. Browsers without relative colour syntax keep white text.
 */
@supports (color: color(from red xyz-d65 x y z)) {
	.vhl-ann-bar {
		--vhl-ann-on: color(from var(--vhl-ann-color) xyz-d65 clamp(0, (0.18 - y) * 100000, 0.9505) clamp(0, (0.18 - y) * 100000, 1) clamp(0, (0.18 - y) * 100000, 1.089));
		color: var(--vhl-ann-on);
	}

	.vhl-ann-bar .vhl-ann-title,
	.vhl-ann-bar .vhl-ann-text,
	.vhl-ann-bar .vhl-ann-text p {
		color: var(--vhl-ann-on);
	}

	.vhl-ann-bar .vhl-ann-icon {
		background-color: color-mix(in srgb, var(--vhl-ann-on) 16%, transparent);
	}

	.vhl-ann-bar .vhl-ann-icon svg {
		fill: var(--vhl-ann-on);
	}

	.vhl-ann-bar .vhl-ann-button.button {
		background-color: var(--vhl-ann-on);
		color: var(--vhl-ann-color);
	}

	.vhl-ann-bar .vhl-ann-button.button:hover,
	.vhl-ann-bar.is-style-dark .vhl-ann-button.button:hover {
		background-color: color-mix(in srgb, var(--vhl-ann-on) 84%, var(--vhl-ann-color));
		color: var(--vhl-ann-color);
	}

	.vhl-ann-bar .vhl-ann-close {
		background-color: color-mix(in srgb, var(--vhl-ann-on) 12%, transparent);
	}

	.vhl-ann-bar .vhl-ann-close:hover {
		background-color: color-mix(in srgb, var(--vhl-ann-on) 26%, transparent);
	}

	.vhl-ann-bar .vhl-ann-close-icon {
		fill: var(--vhl-ann-on);
	}
}

/* ---------------------------------------------------------------------------
 * Floating card
 * ------------------------------------------------------------------------- */
.vhl-ann-card {
	display: grid;
	grid-template-columns: 40px minmax(0, 1fr);
	grid-template-areas:
		"icon body"
		"icon actions";
	column-gap: 16px;
	padding: 20px 48px 20px 20px;
	border-top: 4px solid var(--vhl-ann-color);
	border-radius: 12px;
	background-color: var(--color-box-background, #fff);
	box-shadow: var(--color-overbox-big-shadow, 3px 5px 40px 0 rgba(94, 92, 154, .1));
	color: var(--color-text, #3e3f5e);
}

.vhl-ann-card.no-icon {
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas:
		"body"
		"actions";
}

.vhl-ann-card .vhl-ann-icon {
	grid-area: icon;
	background-color: var(--vhl-ann-color);
	box-shadow: var(--vhl-ann-shadow);
}

.vhl-ann-card .vhl-ann-body {
	grid-area: body;
	align-self: center;
}

.vhl-ann-card .vhl-ann-title {
	color: var(--color-text, #3e3f5e);
}

.vhl-ann-card .vhl-ann-text,
.vhl-ann-card .vhl-ann-text p {
	color: var(--color-text-alt, #8f91ac);
}

.vhl-ann-card .vhl-ann-text a {
	color: var(--color-primary-dark, var(--vhl-ann-color));
}

.vhl-ann-card .vhl-ann-actions {
	grid-area: actions;
	margin-top: 14px;
}

.vhl-ann-card .vhl-ann-button.button {
	background-color: var(--vhl-ann-color);
	box-shadow: var(--vhl-ann-shadow);
	color: #fff;
}

.vhl-ann-card .vhl-ann-button.button:hover {
	filter: brightness(.94);
}

.vhl-ann-card .vhl-ann-close {
	position: absolute;
	top: 10px;
	right: 10px;
}

.vhl-ann-card .vhl-ann-close:hover {
	background-color: var(--color-box-hover-background, #f2f2f9);
}

.vhl-ann-card .vhl-ann-close-icon {
	fill: var(--color-icon, #adafca);
}

.vhl-ann-card .vhl-ann-close:hover .vhl-ann-close-icon {
	fill: var(--color-icon-highlighted, #3e3f5e);
}

/* ---------------------------------------------------------------------------
 * Shortcode boxes
 * ------------------------------------------------------------------------- */
.vhl-ann-shortcode {
	display: grid;
	gap: 16px;
}

.vhl-ann-shortcode > .section-header {
	margin: 0 0 16px;
}

.vhl-ann-list-title {
	margin: 0 0 8px;
	font-size: calc((20 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
}

.vhl-ann-list {
	display: grid;
	grid-template-columns: repeat(var(--vhl-ann-cols, 1), minmax(0, 1fr));
	gap: 16px;
}

.vhl-ann-list.cols-2 {
	--vhl-ann-cols: 2;
}

.vhl-ann-list.cols-3 {
	--vhl-ann-cols: 3;
}

.vhl-ann-box.widget-box {
	position: relative;
	overflow: hidden;
	margin: 0;
}

.vhl-ann-box:not(.vhl-ann-box-empty)::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 4px;
	background-color: var(--vhl-ann-color);
}

.vhl-ann-box-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	position: absolute;
	top: 28px;
	right: 28px;
	height: 24px;
	padding: 0 12px;
	border-radius: 200px;
	background-color: var(--vhl-ann-color);
	color: #fff;
	font-size: calc((11 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 700;
	line-height: 1;
	text-transform: uppercase;
}

.vhl-ann-box-tag-icon {
	width: 12px;
	height: 12px;
	fill: #fff;
}

.vhl-ann-box.is-pinned .widget-box-title {
	padding-right: 96px;
}

.vhl-ann-box .widget-box-title {
	line-height: 1.3em;
}

.vhl-ann-box-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 14px;
	margin: 0 0 12px;
	color: var(--color-text-alt-2, #adafca);
	font-size: calc((12 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 600;
	line-height: 1.4em;
	text-transform: uppercase;
}

.vhl-ann-box-meta:empty {
	display: none;
}

.vhl-ann-box-text {
	color: var(--color-text, #3e3f5e);
	font-size: calc((14 / var(--vikinger-font-size-base, 16)) * 1rem);
	font-weight: 500;
	line-height: 1.714em;
	overflow-wrap: anywhere;
}

.vhl-ann-box-text p {
	margin: 0;
	line-height: 1.714em;
}

.vhl-ann-box-text p + p {
	margin-top: 12px;
}

.vhl-ann-box-text ul,
.vhl-ann-box-text ol {
	margin: 12px 0 12px 20px;
	list-style: disc;
}

.vhl-ann-box-text ol {
	list-style: decimal;
}

.vhl-ann-box-actions {
	display: flex;
	margin-top: 20px;
}

.vhl-ann-box-actions .button {
	display: inline-flex;
	width: auto;
	padding: 0 24px;
}

/* Non-Vikinger fallbacks for the theme classes used above. */
body.vhl-no-vikinger .vhl-ann-box.widget-box {
	padding: 28px;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: 12px;
	background: #fff;
}

body.vhl-no-vikinger .vhl-ann-box .widget-box-title {
	margin: 0 0 20px;
	font-size: 1rem;
	font-weight: 700;
}

body.vhl-no-vikinger .vhl-ann-root .button,
body.vhl-no-vikinger .vhl-ann-shortcode .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 20px;
	border: 0;
	border-radius: 10px;
	background-color: #3e3f5e;
	color: #fff;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
}

body.vhl-no-vikinger .vhl-ann-shortcode .button.primary {
	background-color: #23d2e2;
}

body.vhl-no-vikinger .vhl-ann-shortcode .button.secondary {
	background-color: #615dfa;
}

body.vhl-no-vikinger .vhl-ann-shortcode .button.tertiary {
	background-color: #fd4350;
}

/* ---------------------------------------------------------------------------
 * Animations
 * ------------------------------------------------------------------------- */
@keyframes vhl-ann-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes vhl-ann-out {
	from {
		opacity: 1;
		transform: none;
	}

	to {
		opacity: 0;
		transform: translateY(8px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.vhl-ann-item,
	.vhl-ann-item.is-leaving {
		animation: none;
	}

	.vhl-ann-zone-floating {
		transition: none;
	}
}

/* ---------------------------------------------------------------------------
 * Responsive (Vikinger breakpoints 1365 / 960 / 680 / 480)
 * ------------------------------------------------------------------------- */
@media screen and (max-width: 960px) {
	.vhl-ann-list.cols-3 {
		--vhl-ann-cols: 2;
	}
}

@media screen and (max-width: 680px) {
	.vhl-ann-list.cols-2,
	.vhl-ann-list.cols-3 {
		--vhl-ann-cols: 1;
	}

	.vhl-ann-bar {
		flex-wrap: wrap;
		gap: 12px;
		padding: 14px 52px 14px 16px;
	}

	.vhl-ann-bar .vhl-ann-icon {
		display: none;
	}

	.vhl-ann-bar .vhl-ann-body {
		flex-basis: 100%;
	}

	.vhl-ann-bar .vhl-ann-close {
		position: absolute;
		top: 12px;
		right: 12px;
	}

	.vhl-ann-zone-floating {
		left: 12px !important;
		right: 12px;
		bottom: 12px;
		width: auto;
		max-width: none;
	}

	.vhl-ann-box-tag {
		position: static;
		margin-bottom: 16px;
	}

	.vhl-ann-box.is-pinned .widget-box-title {
		padding-right: 0;
	}
}

@media print {
	.vhl-ann-root,
	.vhl-ann-zone {
		display: none !important;
	}
}
