/* SDM Fonde Indlaegs-slider - frontend styles
 * Theme overrides: set the --sdfs-* custom properties on .sdfs or a parent.
 */

.sdfs {
	--sdfs-radius: 12px;
	--sdfs-text: #ffffff;
	--sdfs-overlay: rgba(0, 0, 0, 0.85);
	--sdfs-badge-bg: #1cb78d;
	--sdfs-badge-fg: #04302c;
	--sdfs-btn-bg: rgba(0, 74, 72, 0.78);
	--sdfs-btn-bg-hover: rgba(0, 74, 72, 0.96);
	--sdfs-btn-fg: #ffffff;
	--sdfs-focus: #ffbf47;
	--sdfs-focus-dark: #004a48;
	--sdfs-dot: #6f7a78;
	--sdfs-dot-active: #004a48;
	--sdfs-placeholder: #04302c;
	--sdfs-duration: 500ms;

	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 0 0 1.5rem;
	box-sizing: border-box;
}

.sdfs *,
.sdfs *::before,
.sdfs *::after {
	box-sizing: inherit;
}

/* Visually hidden but available to assistive tech */
.sdfs-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.sdfs__stage {
	position: relative;
}

/* Viewport: always 16:9 (padding-top technique works in all browsers and
   cannot be broken by theme aspect-ratio/height overrides) */
.sdfs__viewport {
	position: relative;
	overflow: hidden;
	height: auto !important;
	border-radius: var(--sdfs-radius);
	background: var(--sdfs-placeholder);
	isolation: isolate;
}

.sdfs__viewport::before {
	content: "";
	display: block;
	width: 100%;
	padding-top: 56.25%; /* 9 / 16 */
}

.sdfs__track {
	position: absolute;
	inset: 0;
	display: flex;
	height: 100%;
	transition: transform var(--sdfs-duration) cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.sdfs__slide {
	position: relative;
	flex: 0 0 100%;
	min-width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
}

.sdfs__link {
	position: relative;
	display: block;
	height: 100%;
	color: var(--sdfs-text);
	text-decoration: none;
}

/* Force white text - also against theme link styles (a, a:visited etc.) */
.sdfs .sdfs__link,
.sdfs .sdfs__link:link,
.sdfs .sdfs__link:visited,
.sdfs .sdfs__link:hover,
.sdfs .sdfs__link:focus,
.sdfs .sdfs__link:active {
	color: var(--sdfs-text) !important;
	text-decoration: none;
}

.sdfs__title,
.sdfs__date {
	color: var(--sdfs-text);
}

.sdfs__link:focus-visible {
	outline: 3px solid var(--sdfs-focus);
	outline-offset: -3px;
}

.sdfs__link:focus-visible .sdfs__title {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* Image: centered, cover, 16:9 */
.sdfs__media {
	position: absolute;
	inset: 0;
	display: block;
	overflow: hidden;
}

.sdfs .sdfs__img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	min-height: 0;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
	object-position: center center;
	transition: transform 600ms ease;
}

.sdfs__link:hover .sdfs__img {
	transform: scale(1.03);
}

.sdfs__link:hover .sdfs__title,
.sdfs__link:hover .sdfs__date,
.sdfs__link:focus-visible .sdfs__title,
.sdfs__link:focus-visible .sdfs__date {
	text-shadow:
		0 2px 6px rgba(0, 0, 0, 0.95),
		0 0 2px rgba(0, 0, 0, 0.9),
		0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Caption overlay */
.sdfs__caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.3rem;
	padding: clamp(1rem, 3vw, 1.75rem) clamp(1rem, 3.5vw, 2rem);
	background: linear-gradient(
		to top,
		var(--sdfs-overlay) 0%,
		rgba(0, 0, 0, 0.7) 55%,
		rgba(0, 0, 0, 0) 100%
	);
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}

.sdfs__date {
	font-size: 0.875rem;
	line-height: 1.3;
	opacity: 0.95;
}

.sdfs__title {
	font-size: clamp(1.05rem, 2.4vw, 1.6rem);
	font-weight: 700;
	line-height: 1.25;
	max-width: 60ch;
}

.sdfs__badge {
	display: inline-block;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: var(--sdfs-badge-bg);
	color: var(--sdfs-badge-fg);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	text-shadow: none;
}

/* Buttons (min. 44x44 target size) */
.sdfs__btn {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sdfs-btn-bg);
	color: var(--sdfs-btn-fg);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 150ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.sdfs__btn:hover {
	background: var(--sdfs-btn-bg-hover);
	color: var(--sdfs-btn-fg);
}

.sdfs__btn:focus-visible {
	outline: 3px solid var(--sdfs-focus);
	outline-offset: 2px;
}

.sdfs__btn svg {
	width: 24px;
	height: 24px;
	fill: currentColor;
}

.sdfs__btn svg[hidden] {
	display: none;
}

.sdfs__btn--prev {
	left: 0.75rem;
}

.sdfs__btn--next {
	right: 0.75rem;
}

.sdfs__btn--play {
	top: 0.75rem;
	right: 0.75rem;
	transform: none;
}

/* Dots / tablist (min. 24x24 target size, WCAG 2.5.8) */
.sdfs__dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.125rem;
	margin: 0.5rem 0 0;
	padding: 0;
}

.sdfs__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.sdfs__dot::before {
	content: "";
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--sdfs-dot);
	transition: transform 200ms ease, background-color 200ms ease;
}

.sdfs__dot:hover::before {
	transform: scale(1.2);
}

.sdfs__dot[aria-selected="true"]::before {
	background: var(--sdfs-dot-active);
	transform: scale(1.35);
}

.sdfs__dot:focus-visible {
	outline: 3px solid var(--sdfs-focus-dark);
	outline-offset: 2px;
}

/* Nav bar: on desktop the buttons are absolutely positioned over the image,
   so the bar itself collapses to zero height */
.sdfs__bar {
	position: static;
}

.sdfs__mobilecaption {
	display: none;
}

/* Single-slide state */
.sdfs--single .sdfs__btn,
.sdfs--single .sdfs__bar,
.sdfs--single .sdfs__dots {
	display: none;
}

/* Swipe feedback */
.sdfs__viewport.is-dragging .sdfs__track {
	transition: none;
}

/* Small screens: clean image, caption moves below - between the nav buttons */
@media (max-width: 600px) {
	.sdfs {
		--sdfs-radius: 8px;
	}

	/* Keep the caption in the accessibility tree (it is the link's name),
	   but remove it visually - including the gradient */
	.sdfs__caption {
		position: absolute !important;
		width: 1px;
		height: 1px;
		padding: 0 !important;
		margin: -1px !important;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		clip-path: inset(50%);
		white-space: nowrap;
		border: 0;
		background: none;
		gap: 0;
	}

	.sdfs__bar {
		display: flex;
		align-items: center;
		gap: 0.75rem;
		margin-top: 0.75rem !important;
	}

	.sdfs__btn--prev,
	.sdfs__btn--next {
		position: static;
		transform: none;
		flex: 0 0 auto;
	}

	.sdfs__mobilecaption {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 0.15rem;
		flex: 1 1 auto;
		min-width: 0;
		text-align: center;
		color: inherit;
	}

	.sdfs__mdate {
		font-size: 0.8rem;
		line-height: 1.3;
		opacity: 0.75;
	}

	.sdfs__mtitle {
		font-size: 1rem;
		font-weight: 700;
		line-height: 1.3;
		overflow-wrap: break-word;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	/* Play button stays on the image, top right */
	.sdfs__btn--play {
		top: 0.5rem;
		right: 0.5rem;
	}
}

/* Reduced motion: no sliding animation, no zoom */
@media (prefers-reduced-motion: reduce) {
	.sdfs__track,
	.sdfs__img,
	.sdfs__dot::before,
	.sdfs__btn {
		transition: none;
	}
	.sdfs__link:hover .sdfs__img {
		transform: none;
	}
}

/* High contrast / forced colors */
@media (forced-colors: active) {
	.sdfs__btn,
	.sdfs__dot {
		border: 1px solid CanvasText;
	}
	.sdfs__dot::before {
		background: CanvasText;
	}
	.sdfs__dot[aria-selected="true"]::before {
		background: Highlight;
	}
}
