/*
 * Evästesuostumus.
 *
 * Lisäosa ei nojaa teeman muuttujiin: suostumusikkunan on toimittava
 * vaikka teema vaihtuisi, joten värit ja mitat ovat tässä omina
 * muuttujinaan. Arvot vastaavat brändin paletteja (theme.json).
 */

/* The floating reopen button is a sibling of the dialog, not a child, so it
   needs the variables declared on it as well. Without them
   var(--vml-consent-accent) is undefined inside .vml-consent-fab:focus-visible,
   the whole outline shorthand becomes invalid at computed-value time and falls
   back to outline-style: none. That rule also outranks the theme's global
   :where(...) focus ring, so the failure took the fallback down with it and the
   button had no visible focus at all (WCAG 2.4.7). */
.vml-consent,
.vml-consent-fab {
	--vml-consent-dark: #003227;
	--vml-consent-accent: #9fffb6;
	--vml-consent-white: #fff;
	--vml-consent-cookie: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor' fill-rule='evenodd'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5z M9.7 8.5a1.2 1.2 0 1 0-2.4 0 1.2 1.2 0 0 0 2.4 0z M17.2 15.5a1.2 1.2 0 1 0-2.4 0 1.2 1.2 0 0 0 2.4 0z M13.2 12a1.2 1.2 0 1 0-2.4 0 1.2 1.2 0 0 0 2.4 0z M12.2 17a1.2 1.2 0 1 0-2.4 0 1.2 1.2 0 0 0 2.4 0z M8.2 14a1.2 1.2 0 1 0-2.4 0 1.2 1.2 0 0 0 2.4 0z'/%3E%3C/svg%3E");
}

.vml-consent[hidden],
.vml-consent-fab[hidden],
[data-vml-consent-view][hidden] {
	display: none;
}

/* --- Peite --- */

.vml-consent__overlay {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background-color: rgb(0 0 0 / 0.6);
	backdrop-filter: blur(4px);
}

/* --- Ikkuna --- */

.vml-consent__modal {
	box-sizing: border-box;
	width: 100%;
	max-width: 560px;
	max-height: calc(100dvh - 2rem);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 2rem 1.25rem;
	background-color: var(--vml-consent-dark);
	text-align: center;
}

@media (min-width: 640px) {

	.vml-consent__modal {
		padding: 2.75rem 2.5rem;
	}
}

@media (min-width: 768px) {

	.vml-consent__modal {
		padding: 3.5rem 3rem;
	}
}

/* --- Kuvakkeet (mask, jotta väri tulee currentcolorista) --- */

.vml-consent__glyph {
	display: inline-block;
	flex-shrink: 0;
	background-color: currentcolor;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}

.vml-consent__glyph--cookie {
	-webkit-mask-image: var(--vml-consent-cookie);
	mask-image: var(--vml-consent-cookie);
}

.vml-consent__icon {
	display: flex;
	justify-content: center;
	margin: 0 0 1.5rem;
}

.vml-consent__icon .vml-consent__glyph {
	width: 64px;
	height: 64px;
	background-color: var(--vml-consent-accent);
}

@media (min-width: 768px) {

	.vml-consent__icon .vml-consent__glyph {
		width: 72px;
		height: 72px;
	}
}

/* --- Tekstit --- */

.vml-consent__title {
	margin: 0 0 1rem;
	color: var(--vml-consent-white);
	font-weight: 500;
	font-size: 1.5rem;
}

@media (min-width: 768px) {

	.vml-consent__title {
		font-size: 1.625rem;
	}
}

.vml-consent__text {
	margin: 0 auto 0.5rem;
	color: rgb(255 255 255 / 0.7);
	font-size: 0.9375rem;
	line-height: 1.7;
}

.vml-consent__link {
	color: var(--vml-consent-accent);
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 200ms ease-out, opacity 200ms ease-out;
}

.vml-consent__link:hover {
	color: var(--vml-consent-accent);
	opacity: 0.8;
}

/* --- Painikkeet --- */

.vml-consent__actions {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin-block-start: 2rem;
}

@media (min-width: 640px) {

	.vml-consent__actions {
		flex-direction: row;
	}
}

.vml-consent__btn {
	flex: 1;
	padding: 0.875rem 1.25rem;
	font-family: inherit;
	font-size: 0.875rem;
	line-height: 1.6;
	font-weight: 500;
	letter-spacing: 0.025em;
	text-transform: uppercase;
	cursor: pointer;
	border: none;
	border-radius: 0;
	background: none;
	transition-property: color, background-color, border-color, opacity, transform;
	transition-duration: 200ms;
	transition-timing-function: ease-out;
}

.vml-consent__btn:focus-visible,
.vml-consent__back:focus-visible {
	outline: 2px solid var(--vml-consent-accent);
	outline-offset: 2px;
}

/* The floating button needs two rings, not one.
 *
 * It is position: fixed, so it can sit over anything: white article text at the
 * top of a page, the dark green footer at the bottom. A single accent ring
 * measures 11.75:1 over the footer but 1.20:1 over white, and WCAG 1.4.11 asks
 * for 3:1 wherever it lands. No single colour satisfies both.
 *
 * The box-shadow paints a dark band from the button edge out to 6px and the
 * outline paints the accent band on top of it at 2..4px, giving dark, light,
 * dark. Over a light background the outer dark band carries the contrast, over
 * a dark one the accent band does. The original drop shadow is repeated here
 * because box-shadow replaces rather than adds.
 */
.vml-consent-fab:focus-visible {
	outline: 2px solid var(--vml-consent-accent);
	outline-offset: 2px;
	box-shadow: 0 0 0 6px var(--vml-consent-dark), 0 2px 8px rgb(0 0 0 / 0.25);
}

/* Kaikki valintapainikkeet ovat samannäköisiä: hyväksyminen, kieltäytyminen
   ja valintojen tallennus samalla värillä ja koolla. KHO:2026:65 katsoi
   suostumuksen pätemättömäksi, kun hyväksyntä oli korostettu värillä ja
   kieltäytyminen jätetty himmeäksi tekstiksi. */
.vml-consent__btn--choice {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 1rem 1.25rem;
	background-color: var(--vml-consent-accent);
	color: var(--vml-consent-dark);
}

.vml-consent__btn--choice:hover {
	background-color: var(--vml-consent-accent);
	opacity: 0.9;
}

/* Asetusnäkymän kolme painiketta pinoutuvat aina: rinnakkain ne eivät mahdu
   ikkunaan tasalevyisinä. */
.vml-consent__actions--stack {
	flex-direction: column;
}

/* --- Toissijainen rivi --- */

.vml-consent__secondary-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-block-start: 1.25rem;
}

.vml-consent__back,
.vml-consent__btn--settings {
	display: inline;
	padding: 0.625rem 0;
	border: none;
	background: none;
	font-family: inherit;
	font-size: 0.8125rem;
	line-height: 1.6;
	font-weight: 500;
	letter-spacing: 0;
	text-transform: none;
	color: rgb(255 255 255 / 0.65);
	cursor: pointer;
	transition-property: color, text-decoration-color;
	transition-duration: 200ms;
	transition-timing-function: ease-out;
}

.vml-consent__back:hover,
.vml-consent__btn--settings:hover {
	color: var(--vml-consent-white);
	background: none;
	border-color: transparent;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.vml-consent__btn--settings {
	flex: none;
}

/* --- Asetusnäkymä --- */

.vml-consent__options {
	margin-block-start: 0.5rem;
	text-align: left;
}

.vml-consent__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 0.875rem;
	border-bottom: 1px solid rgb(255 255 255 / 0.08);
}

.vml-consent__option-info {
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
}

.vml-consent__option-label {
	color: var(--vml-consent-white);
	font-weight: 500;
	font-size: 0.9375rem;
}

/* Opacity raised from 0.4 and 0.3. Against the dark #003227 panel those gave
   3.47:1 and 2.57:1, where 13 pixel text needs 4.5:1 (WCAG 1.4.3). They now
   measure 5.99:1 and 5.28:1 and still stay quieter than the label. */
.vml-consent__option-desc {
	color: rgb(255 255 255 / 0.6);
	font-size: 0.8125rem;
}

.vml-consent__always-on {
	color: rgb(255 255 255 / 0.55);
	font-size: 0.8125rem;
	white-space: nowrap;
}

/* --- Liukukytkin --- */

.vml-consent__toggle {
	position: relative;
	display: inline-block;
	width: 44px;
	height: 24px;
	flex-shrink: 0;
	cursor: pointer;
}

.vml-consent__toggle-input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	margin: 0;
}

.vml-consent__toggle-track {
	position: absolute;
	inset: 0;
	background-color: rgb(255 255 255 / 0.2);
	border-radius: 12px;
	transition: background-color 200ms ease-out;
}

.vml-consent__toggle-track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background-color: var(--vml-consent-white);
	border-radius: 50%;
	transition: transform 200ms ease-out;
}

.vml-consent__toggle-input:checked + .vml-consent__toggle-track {
	background-color: var(--vml-consent-accent);
}

.vml-consent__toggle-input:checked + .vml-consent__toggle-track::after {
	transform: translateX(20px);
}

.vml-consent__toggle-input:focus-visible + .vml-consent__toggle-track {
	outline: 2px solid var(--vml-consent-accent);
	outline-offset: 2px;
}

/* --- Kelluva uudelleenavaus --- */

.vml-consent-fab {
	position: fixed;
	bottom: 1.25rem;
	left: 1.25rem;
	z-index: 9998;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: #003227;
	color: #9fffb6;
	cursor: pointer;
	box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
	animation: vml-consent-fab-in 300ms ease-out;
	transition-property: box-shadow, transform;
	transition-duration: 200ms;
	transition-timing-function: ease-out;
}

.vml-consent-fab .vml-consent__glyph {
	width: 26px;
	height: 26px;
	background-color: #9fffb6;
}

.vml-consent-fab:hover {
	background-color: #003227;
	transform: scale(1.1);
	box-shadow: 0 4px 12px rgb(0 0 0 / 0.3);
}

.vml-consent-fab:active {
	transform: scale(0.95);
}

@keyframes vml-consent-fab-in {

	from {
		opacity: 0;
		transform: scale(0.5);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* --- Estetty upotus --- */

.vml-embed-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	aspect-ratio: 16 / 9;
	padding: 1.5rem;
	background-color: #003227;
	color: rgb(255 255 255 / 0.7);
	text-align: center;
}

.vml-embed-placeholder__text {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.7;
	max-width: 34rem;
}

.vml-embed-placeholder__btn {
	padding: 0.875rem 1.5rem;
	border: none;
	background-color: #9fffb6;
	color: #003227;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: 0.025em;
	text-transform: uppercase;
	cursor: pointer;
	transition: opacity 200ms ease-out;
}

.vml-embed-placeholder__btn:hover {
	opacity: 0.9;
}

.vml-embed-placeholder__btn:focus-visible {
	outline: 2px solid #9fffb6;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

	.vml-consent-fab {
		animation: none;
	}

	.vml-consent__btn,
	.vml-consent__toggle-track,
	.vml-consent__toggle-track::after,
	.vml-consent-fab {
		transition-duration: 1ms;
	}
}
