/* Proweb Video Player – layout og tilstander */

.pwvp {
	--pwvp-accent: #2563eb;
	--pwvp-radius: 12px;
	--pwvp-ratio: 16 / 9;
	--pwvp-fg: #fff;
	--pwvp-fg-muted: rgba(255, 255, 255, 0.72);
	--pwvp-shade: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0));
	--pwvp-menu-bg: rgba(18, 20, 26, 0.96);
	--pwvp-menu-fg: #fff;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	margin: 1.5em auto;
	overflow: hidden;
	border-radius: var(--pwvp-radius);
	background: #000;
	color: var(--pwvp-fg);
	font: 14px/1.4 var(--pwvp-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	outline: none;
	isolation: isolate;
	container-type: inline-size;
	-webkit-tap-highlight-color: transparent;
}

.pwvp *, .pwvp *::before, .pwvp *::after { box-sizing: border-box; }

.pwvp:focus-visible { box-shadow: 0 0 0 3px var(--pwvp-accent); }

.pwvp--light {
	--pwvp-fg: #111827;
	--pwvp-fg-muted: rgba(17, 24, 39, 0.66);
	--pwvp-shade: linear-gradient(to top, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0));
	--pwvp-menu-bg: rgba(255, 255, 255, 0.98);
	--pwvp-menu-fg: #111827;
}

/* --- Bilde --- */
.pwvp__stage {
	position: relative;
	aspect-ratio: var(--pwvp-ratio);
	background: #000 center / cover no-repeat;
	cursor: pointer;
}

.pwvp__media {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.pwvp--fit-cover .pwvp__media { object-fit: cover; object-position: var(--pwvp-focus, 50% 50%); }
.pwvp--fit-fill .pwvp__media { object-fit: fill; }

.pwvp--audio .pwvp__stage { aspect-ratio: auto; min-height: 120px; background-color: #111827; }
.pwvp--audio .pwvp__media { display: none; }

/* --- Stor avspillingsknapp (også for YouTube/Vimeo-fasade) --- */
.pwvp__bigplay, .pwvp__facade {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent center / cover no-repeat;
	color: #fff;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.pwvp .pwvp__bigplay, .pwvp .pwvp__facade {
	box-sizing: border-box;
	min-width: 0;
	min-height: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	line-height: 1;
	text-shadow: none;
	text-transform: none;
	letter-spacing: normal;
	filter: none;
	transform: none;
}
.pwvp .pwvp__bigplay:hover, .pwvp .pwvp__bigplay:focus, .pwvp .pwvp__bigplay:active { background-color: transparent; border: 0; box-shadow: none; color: #fff; }
.pwvp .pwvp__facade, .pwvp .pwvp__facade:hover, .pwvp .pwvp__facade:focus, .pwvp .pwvp__facade:active { background-color: #0b0d12; border: 0; box-shadow: none; color: #fff; }
.pwvp__facade::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.18); transition: background 0.2s; }
.pwvp__facade:hover::after { background: rgba(0, 0, 0, 0); }

.pwvp__bigplay-icon {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--pwvp-play, var(--pwvp-accent));
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}

.pwvp__bigplay-icon::before {
	content: "";
	width: 26px;
	height: 26px;
	margin-left: 4px;
	background: #fff;
	clip-path: polygon(14% 4%, 14% 96%, 96% 50%);
}

.pwvp__bigplay:hover .pwvp__bigplay-icon,
.pwvp__facade:hover .pwvp__bigplay-icon { transform: scale(1.08); }

.pwvp__bigplay:focus-visible, .pwvp__facade:focus-visible { outline: 3px solid var(--pwvp-accent); outline-offset: -3px; }

.pwvp.is-playing .pwvp__bigplay,
.pwvp.is-waiting .pwvp__bigplay,
.pwvp.has-error .pwvp__bigplay { opacity: 0; pointer-events: none; }

/* --- Plakatbilde igjen når videoen er ferdig (valgfritt) --- */
.pwvp__poster { position: absolute; inset: 0; background: #000 center / contain no-repeat; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.pwvp.is-stopped .pwvp__poster { opacity: 1; }

/* --- «Klikk for lyd» --- */
.pwvp .pwvp__sound {
	box-sizing: border-box;
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: auto;
	min-width: 0;
	height: 36px;
	min-height: 0;
	margin: 0;
	padding: 0 14px 0 10px;
	border: 0;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.72);
	box-shadow: none;
	color: #fff;
	font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	letter-spacing: normal;
	text-decoration: none;
	text-shadow: none;
	text-transform: none;
	filter: none;
	transform: none;
	cursor: pointer;
	animation: pwvp-fade 0.3s ease;
}
.pwvp .pwvp__sound:hover, .pwvp .pwvp__sound:focus, .pwvp .pwvp__sound:active { background: rgba(0, 0, 0, 0.9); border: 0; box-shadow: none; color: #fff; }
.pwvp .pwvp__sound:focus-visible { outline: 2px solid var(--pwvp-accent); outline-offset: 2px; }
.pwvp .pwvp__sound .pwvp__icon, .pwvp .pwvp__sound .pwvp__icon svg { width: 20px; height: 20px; }

/* --- Embed --- */
.pwvp--embed { aspect-ratio: var(--pwvp-ratio); }

/* Utenfor innholdsbredden: midtstilt, aldri bredere enn skjermen (skriptet finjusterer plasseringen). */
.pwvp.pwvp--breakout { width: var(--pwvp-bw) !important; max-width: none !important; margin-left: calc(50% - var(--pwvp-bw) / 2) !important; margin-right: 0 !important; }

/* Fast høyde i piksler (format følger ikke lenger bredden). */
.pwvp--fixed-h .pwvp__stage { aspect-ratio: auto; height: var(--pwvp-height); }
.pwvp--embed.pwvp--fixed-h { aspect-ratio: auto; height: var(--pwvp-height); }
.pwvp__iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- Ventesymbol, feil og meldinger --- */
.pwvp__spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 48px;
	height: 48px;
	margin: -24px 0 0 -24px;
	border: 4px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--pwvp-spinner, #fff);
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	animation: pwvp-spin 0.8s linear infinite;
	transition: opacity 0.2s;
}
.pwvp.is-waiting .pwvp__spinner { opacity: 1; }

.pwvp__error {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.82);
	color: #fff;
	text-align: center;
}
.pwvp__error[hidden] { display: none; }

.pwvp__flash {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	padding: 10px 18px;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-weight: 600;
	pointer-events: none;
	transform: translate(-50%, -50%);
	animation: pwvp-flash 0.7s ease forwards;
}
.pwvp__flash--left { left: 18%; }
.pwvp__flash--right { left: 82%; }

.pwvp-notice { padding: 12px 16px; border-left: 4px solid #d63638; background: #fcf0f1; color: #50575e; }

/* Skjul markørpekeren når kontrollene er skjult. */
.pwvp.is-idle.is-playing .pwvp__stage { cursor: none; }

@keyframes pwvp-spin { to { transform: rotate(360deg); } }
@keyframes pwvp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pwvp-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.pwvp *, .pwvp *::before { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
