/* loovl-valot-ennen-jalkeen (restyling.fi, 09.11.2026): before/after blocks of light tinting.
 * The «after» photo is the base, the «before» layer lies on it and is cut at the line (--ve-jako, set by ve.js).
 * Two blocks side by side from 700 px of room (container query), one under the other below.
 * Colours of the car buttons and text - the theme variables (--rp-*), so light and dark themes both work. */

.loovl-ve {
	container-type: inline-size;
}

/* Edges as the intro text of the page (Esiteksti): the page itself gives 30 px at the sides, the row is 1200 px. */
.loovl-ve--palvelu .loovl-ve__sisus {
	max-width: 1200px;
	margin: 0 auto;
	padding: 56px 0 64px;
}

.loovl-ve--artikkeli {
	margin: 8px 0 32px;
}

body .loovl-ve .loovl-ve__otsikko {
	margin: 0 0 24px;
	color: var(--rp-otsikko, #171a20);
	font-family: var(--rp-fontti, inherit);
	font-size: 32px;
	font-weight: 700;
	line-height: 1.2;
	text-transform: none;
	letter-spacing: 0;
}

.loovl-ve__lohkot {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 32px;
}

@container (min-width: 700px) {
	.loovl-ve__lohkot {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 28px;
	}
}

.loovl-ve__yla {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	margin: 0 0 12px;
}

body .loovl-ve p.loovl-ve__nimi {
	margin: 0;
	padding: 0;
	color: var(--rp-otsikko, #171a20);
	font-family: var(--rp-fontti, inherit);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.loovl-ve__autot {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.loovl-ve__autot[hidden] {
	display: none;
}

body .loovl-ve button.loovl-ve__auto {
	min-height: 36px;
	margin: 0;
	padding: 6px 14px;
	border: 1px solid var(--rp-raja, #d5d5d5);
	border-radius: 20px;
	background: transparent;
	box-shadow: none;
	color: var(--rp-heikko, #555);
	font-family: var(--rp-fontti, inherit);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	cursor: pointer;
	transition: background-color .15s, border-color .15s, color .15s;
}

body .loovl-ve button.loovl-ve__auto:hover {
	border-color: var(--rp-aksentti, #e3001b);
	color: var(--rp-otsikko, #171a20);
}

body .loovl-ve button.loovl-ve__auto[aria-pressed="true"] {
	border-color: var(--rp-aksentti, #e3001b);
	background: var(--rp-aksentti, #e3001b);
	color: var(--rp-aksentti-teksti, #fff);
}

body .loovl-ve button.loovl-ve__auto:focus-visible {
	outline: 2px solid var(--rp-aksentti, #e3001b);
	outline-offset: 2px;
}

/* The frame: 4:3, the photos absolute inside (Safari does not apply percent heights in an aspect-ratio frame,
 * an absolute block works everywhere - frontend rule of 04.11.2026). */
.loovl-ve__kuva {
	position: relative;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	border-radius: 12px;
	background: #0c0c0e;
}

.loovl-ve__kuva[hidden] {
	display: none;
}

.loovl-ve__kuva img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	object-fit: cover;
}

.loovl-ve__ennen {
	position: absolute;
	inset: 0;
	clip-path: inset(0 calc(100% - var(--ve-jako, 50%)) 0 0);
}

.loovl-ve__ennen[hidden],
.loovl-ve__merkki[hidden],
.loovl-ve__liuku[hidden] {
	display: none;
}

.loovl-ve__merkki {
	position: absolute;
	z-index: 2;
	top: 12px;
	padding: 4px 10px;
	border-radius: 20px;
	background: rgba(12, 12, 14, .62);
	color: #fff;
	font-family: var(--rp-fontti, inherit);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: .06em;
	text-transform: uppercase;
	pointer-events: none;
}

.loovl-ve__merkki--ennen {
	left: 12px;
}

.loovl-ve__merkki--jalkeen {
	right: 12px;
}

/* The whole frame takes the drag; a finger moving up or down scrolls the page (touch-action: pan-y). */
.loovl-ve__liuku {
	position: absolute;
	z-index: 3;
	inset: 0;
	outline: 0;
	cursor: ew-resize;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.loovl-ve__viiva {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--ve-jako, 50%);
	width: 2px;
	margin-left: -1px;
	background: #fff;
	box-shadow: 0 0 6px rgba(0, 0, 0, .55);
	pointer-events: none;
}

.loovl-ve__kahva {
	position: absolute;
	top: 50%;
	left: var(--ve-jako, 50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: -24px 0 0 -24px;
	border-radius: 50%;
	background: #fff;
	color: #171a20;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
	pointer-events: none;
}

.loovl-ve__liuku:focus-visible .loovl-ve__kahva {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

@media (max-width: 800px) {
	.loovl-ve--palvelu .loovl-ve__sisus {
		padding: 40px 0 48px;
	}

	body .loovl-ve .loovl-ve__otsikko {
		font-size: 26px;
	}
}

@media (prefers-reduced-motion: reduce) {
	body .loovl-ve button.loovl-ve__auto {
		transition: none;
	}
}

@media print {
	.loovl-ve__liuku,
	.loovl-ve__ennen,
	.loovl-ve__merkki,
	.loovl-ve__autot {
		display: none;
	}
}
