/*
 * koeriersdienst - j6.css
 * New styles for Joomla 4/5/6, loaded after all old stylesheets.
 * Everything that replaces Warp / Widgetkit / Supersized / RSForm / Videobox.
 */

/* Helpers
----------------------------------------------------------------------------------------------------*/

.kd-sr-only {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Old contact page: RSForm's UIkit CSS set "html { background: #fff }", so the body background
 * (#F2F2F2, one viewport high) covered the background photo there. Kept for an identical look;
 * delete this rule to show the photo on the contact page too. */
html.kd-contactpage { background: #fff; }

/* The same UIkit CSS also gave images their UIkit defaults on that page only (e.g. the Regio Transport
 * logo in sidebar-b sits 1px differently). :where() keeps the low specificity UIkit had (0,0,1). */
:where(html.kd-contactpage) :where(audio, canvas, iframe, img, svg, video) { vertical-align: middle; }
:where(html.kd-contactpage) :where(audio, canvas, img, svg, video) { max-width: 100%; height: auto; box-sizing: border-box; }

/* Drop-down menu also opens for keyboard users (Warp only had :hover) */
.menu-dropdown li:focus-within .dropdown { display: block; }


/* Background slideshow (was mod_funsupersized + custom.css #supersized rules)
 * Fixed behind the page, each slide covers the viewport with #F2F2F2,
 * the photo sits in a 1400px wide, max. 690px high box at the top,
 * centred (left aligned when the window is narrower than 1400px, like before).
 * custom.css forced the Supersized <img> to "width: 1400px; height: auto", so the
 * photo is always 1400px wide at its own aspect ratio, top aligned and cut off by
 * the box (not "cover", which would enlarge wide photos and crop their sides).
----------------------------------------------------------------------------------------------------*/

.kd-bgslides {
	position: fixed;
	top: 0;
	left: 0;
	z-index: -999;
	width: 100%;
	height: 100%;
	overflow: hidden;
	pointer-events: none;
}

.kd-bgslide {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background-color: #F2F2F2;
	opacity: 0;
	transition: opacity var(--kd-bgfade, 500ms) ease-in-out;
}

.kd-bgslide.kd-active { opacity: 1; }

.kd-bgslide-img {
	display: block;
	width: 1400px;
	height: 100%;
	max-height: 690px;
	margin: 0 auto;
	overflow: hidden;
	background-repeat: no-repeat;
	background-position: left top;
	background-size: 1400px auto;
}


/* Banner slideshow (was Widgetkit slideshow, style "top")
 * <div class="kd-slideshow" data-interval="5000"><ul class="kd-slides"><li>..</li></ul></div>
 * Size and crop come from #banner in custom.css (max-width 1105px, overflow hidden).
 * The first slide stays in the flow and sets the height, like Widgetkit did.
----------------------------------------------------------------------------------------------------*/

.kd-slideshow { position: relative; }

.kd-slides {
	position: relative;
	width: 100%;
	margin: 0;
	padding: 0;
	overflow: hidden;
	list-style: none;
}

.kd-slides > li {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	visibility: hidden;
	opacity: 0;
	transition: opacity var(--kd-duration, 500ms) cubic-bezier(.37, 0, .63, 1), transform var(--kd-duration, 500ms) cubic-bezier(.37, 0, .63, 1);
}

.kd-slides > li:first-child { position: relative; }

.kd-slides > li img {
	max-width: none;
	height: auto;
	vertical-align: middle;
	border: 0;
}

.kd-slideshow:not(.kd-ready) .kd-slides > li:first-child,
.kd-slides > li.kd-active {
	z-index: 1;
	visibility: visible;
	opacity: 1;
}

/* fade (default): the old slide fades out on top while the new one fades in */
.kd-slides > li.kd-leaving {
	z-index: 2;
	visibility: visible;
	opacity: 0;
}

/* slide (data-effect="slide"): the new slide moves in from the right */
.kd-effect-slide .kd-slides > li { opacity: 1; }
.kd-effect-slide .kd-slides > li.kd-leaving { z-index: 1; transition: none; }
.kd-effect-slide .kd-slides > li.kd-active { z-index: 2; }
.kd-effect-slide .kd-slides > li.kd-enter { transform: translateX(100%); transition: none; }


/* Gallery (was Widgetkit gallery, style "wall", 130x100, margin, lightbox)
 * <div class="kd-gallery"><a class="kd-gallery-item" href="big.jpg"><img src="big.jpg" alt=""></a>..</div>
----------------------------------------------------------------------------------------------------*/

.kd-gallery {
	display: flex;
	flex-wrap: wrap;
	margin: 0 -15px -15px 0;
	padding: 0;
}

/* On the old pages the Widgetkit gallery was followed by an empty <p> (from "<p>[widgetkit]</p>"),
 * whose 15px margin cancelled the -15px. Between other elements (hr, h2) the result is the same as
 * with -15px, but at the end of an article the old page kept the full last row margin: use 0 there. */
#system .item > .content > .kd-gallery:last-child { margin-bottom: 0; }

.kd-gallery-item {
	display: block;
	flex: none;
	width: 130px;
	height: 100px;
	margin: 0 15px 15px 0;
	overflow: hidden;
}

.kd-gallery-item img {
	display: block;
	width: 130px;
	height: 100px;
	max-width: none;
	object-fit: cover;
	object-position: center;
	border: 0;
}

.kd-gallery-item:focus-visible {
	outline: 2px solid #1171b8;
	outline-offset: 2px;
}


/* Lightbox (was the Widgetkit lightbox: grey overlay 70%, white 10px frame,
 * round close button top right, round prev/next buttons on hover)
----------------------------------------------------------------------------------------------------*/

.kd-lightbox {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 1100;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity 300ms ease;
}

.kd-lightbox[hidden] { display: none; }
.kd-lightbox.kd-open { opacity: 1; }

.kd-lightbox-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(119, 119, 119, .7);
	cursor: pointer;
}

.kd-lightbox-dialog {
	position: relative;
	z-index: 1;
	padding: 10px;
	background: #fff;
	box-shadow: 0 0 15px #555;
	outline: none;
}

.kd-lightbox-img {
	display: block;
	width: auto;
	height: auto;
	max-width: calc(100vw - 140px);
	max-height: calc(100vh - 140px);
	min-width: 60px;
	min-height: 60px;
	transition: opacity 200ms ease;
}

.kd-lightbox.kd-loading .kd-lightbox-img { opacity: 0; }

.kd-lightbox.kd-loading .kd-lightbox-dialog::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 30px;
	height: 30px;
	margin: -18px 0 0 -18px;
	border: 3px solid #ddd;
	border-top-color: #152454;
	border-radius: 50%;
	animation: kd-spin 800ms linear infinite;
}

@keyframes kd-spin { to { transform: rotate(360deg); } }

.kd-lightbox button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	cursor: pointer;
}

/* prev/next: invisible zones over the left and right part of the photo */
.kd-lightbox .kd-lightbox-prev,
.kd-lightbox .kd-lightbox-next {
	position: absolute;
	top: 10px;
	bottom: 10px;
	z-index: 2;
	width: 35%;
	background: transparent;
	border: 0;
}

.kd-lightbox .kd-lightbox-prev:focus,
.kd-lightbox .kd-lightbox-next:focus { outline: none; }

.kd-lightbox .kd-lightbox-prev { left: 10px; }
.kd-lightbox .kd-lightbox-next { right: 10px; }

.kd-lightbox .kd-lightbox-prev[hidden],
.kd-lightbox .kd-lightbox-next[hidden] { display: none; }

.kd-lightbox-ico {
	position: absolute;
	top: 50%;
	width: 50px;
	height: 50px;
	margin-top: -25px;
	border: 1px solid #c8c8c8;
	border-radius: 50%;
	background: #fafafa linear-gradient(#ffffff, #e6e6e6);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
	opacity: 0;
	transition: opacity 150ms ease;
}

.kd-lightbox-ico::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 12px;
	height: 12px;
	border-top: 4px solid #444;
	border-left: 4px solid #444;
}

.kd-lightbox-prev .kd-lightbox-ico { left: 20px; }
.kd-lightbox-next .kd-lightbox-ico { right: 20px; }
.kd-lightbox-prev .kd-lightbox-ico::before { margin: -8px 0 0 -5px; transform: rotate(-45deg); }
.kd-lightbox-next .kd-lightbox-ico::before { margin: -8px 0 0 -11px; transform: rotate(135deg); }

.kd-lightbox-prev:hover .kd-lightbox-ico,
.kd-lightbox-next:hover .kd-lightbox-ico,
.kd-lightbox-prev:focus-visible .kd-lightbox-ico,
.kd-lightbox-next:focus-visible .kd-lightbox-ico { opacity: 1; }

.kd-lightbox-prev:focus-visible .kd-lightbox-ico,
.kd-lightbox-next:focus-visible .kd-lightbox-ico,
.kd-lightbox .kd-lightbox-close:focus-visible {
	outline: 2px solid #1171b8;
	outline-offset: 2px;
}

.kd-lightbox .kd-lightbox-close {
	position: absolute;
	top: -17px;
	right: -17px;
	z-index: 3;
	width: 34px;
	height: 34px;
	border: 1px solid #c8c8c8;
	border-radius: 50%;
	background: #fafafa linear-gradient(#ffffff, #e6e6e6);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
	color: #444;
	font: bold 22px/30px Arial, Helvetica, sans-serif;
	text-align: center;
}

.kd-lightbox .kd-lightbox-close:hover { color: #000; }

@media (prefers-reduced-motion: reduce) {
	.kd-lightbox,
	.kd-lightbox-img,
	.kd-lightbox-ico,
	.kd-bgslide,
	.kd-slides > li { transition: none !important; }

	.kd-lightbox.kd-loading .kd-lightbox-dialog::after { animation-duration: 2400ms; }
}


/* Video (was the Videobox plugin, 420x280 iframe), now responsive 16:9
 * <div class="kd-video"><iframe src="https://www.youtube-nocookie.com/embed/ID" title="Video" loading="lazy" allowfullscreen></iframe></div>
----------------------------------------------------------------------------------------------------*/

.kd-video {
	position: relative;
	width: 100%;
	height: 0;
	padding-bottom: 56.25%;
	overflow: hidden;
	background: #000;
}

.kd-video iframe {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}


/* Contact form (was RSForm! Pro with the UIkit 2 form layout)
 * Values are the computed styles of the old form: RSForm/UIkit CSS together with base.css.
----------------------------------------------------------------------------------------------------*/

#system .formContainer {
	margin: 15px 0;
	padding: 0;
	border: 0;
}

#system .formContainer .uk-form-row:before,
#system .formContainer .uk-form-row:after {
	content: "";
	display: table;
}

#system .formContainer .uk-form-row:after { clear: both; }

#system .formContainer .uk-form-row + .uk-form-row { margin-top: 15px; }

#system .formContainer .uk-form-label {
	display: block;
	margin-bottom: 5px;
	font-weight: bold;
}

#system .formContainer strong.formRequired {
	margin-left: 3px;
	font-weight: bold;
	font-style: normal;
}

#system .formContainer .uk-form-controls > :first-child { margin-top: 0; }
#system .formContainer .uk-form-controls > :last-child { margin-bottom: 0; }

#system .formContainer input.rsform-input-box,
#system .formContainer textarea.rsform-input-box,
#system .formContainer select {
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	width: 90%;
	max-width: 100%;
	height: 30px;
	margin: 0;
	padding: 4px 6px;
	border: 1px solid #ddd;
	border-radius: 0;
	background: #fff;
	color: #444;
	font: inherit;
	vertical-align: middle;
	-webkit-appearance: none;
	appearance: none;
	-webkit-transition: all .2s linear;
	-webkit-transition-property: border, background, color, box-shadow, padding;
	transition: all .2s linear;
	transition-property: border, background, color, box-shadow, padding;
}

#system .formContainer textarea.rsform-input-box {
	height: auto;
	overflow: auto;
	vertical-align: top;
}

#system .formContainer input.rsform-input-box:focus,
#system .formContainer textarea.rsform-input-box:focus,
#system .formContainer select:focus {
	border-color: #99baca;
	outline: 0;
	background: #f5fbfe;
	color: #444;
}

/* Joomla form validation (old Warp colours: #system .invalid / label.invalid are red) */
#system .formContainer .rsform-input-box.invalid { border-color: #ff0000; }

#system .formContainer .form-control-feedback {
	display: block;
	font-size: 10px;
	font-weight: bold;
}

#system .formContainer .rsform-submit-button {
	display: inline-block;
	-webkit-box-sizing: border-box;
	box-sizing: border-box;
	min-height: 30px;
	margin: 0;
	padding: 10px 15px;
	overflow: visible;
	border: 1px solid #152454;
	border-radius: 0;
	background: #152454;
	color: #fff;
	font: bold 16px/20px Arial, Helvetica, sans-serif;
	text-align: center;
	text-transform: none;
	text-decoration: none;
	vertical-align: middle;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

#system .formContainer .rsform-submit-button:hover,
#system .formContainer .rsform-submit-button:focus {
	border-color: #1171b8;
	background: #1171b8;
	color: #fff;
}

#system .formContainer .rsform-submit-button:focus-visible {
	outline: 2px solid #152454;
	outline-offset: 2px;
}


/* Error / offline debug output */
.kd-error-debug {
	position: relative;
	margin-top: 100vh;
	padding: 20px;
	background: #fff;
}
