/**
 * A core/gallery laid out as a slider.
 *
 * Loaded only on pages carrying .is-style-slider - see blocks.php. The
 * slider is jquery.flexslider.js without its stylesheet, which is written for
 * .flexslider .slides > li: a Gallery block is a <figure class="wp-block-gallery">
 * whose slides are <figure class="wp-block-image"> children. flexslider's
 * `selector` option copes with that. The few rules its stylesheet would
 * have provided are here, with the slider's look.
 */

.oko-karusell {
	position: relative;
	/* The dots hang 65px below the slider, and flexslider sets overflow:
	   hidden on its container. */
	overflow: visible !important;
	margin: 0 0 60px;
}

/* A Gallery block is a wrapping flex row, but flexslider's fade mode stacks
   its slides as floats (`float: left; margin-right: -100%`), which do
   nothing to a flex item. So display: block, and a clearfix to give the
   gallery its height back.

   is-layout-flex is named to outrank core's
   `.wp-block-gallery.is-layout-flex`, of equal weight and printed inline in
   the head. */
.wp-block-gallery.is-style-slider,
.wp-block-gallery.is-style-slider.is-layout-flex {
	display: block;
	position: relative;
	margin: 0;
}

.wp-block-gallery.is-style-slider::after {
	content: "";
	display: table;
	clear: both;
}

.wp-block-gallery.is-style-slider > figure {
	max-width: 100%;
	margin: 0;
}

.wp-block-gallery.is-style-slider > figure img {
	width: 100%;
	height: auto;
	display: block;
	/* A 6px frame, inside the width. */
	border: 6px solid var(--oko-line-soft);
	box-sizing: border-box;
}

/* A caption is a photo credit, small in the bottom right corner inside the
   frame, held off the photo by a soft shadow rather than core's dark band
   and blurred strip across the slide. The selector names has-nested-images
   and figure.wp-block-image to outweigh core's gallery caption rule. */
.wp-block-gallery.has-nested-images.is-style-slider > figure.wp-block-image:has(figcaption)::before {
	content: none;
}

.wp-block-gallery.has-nested-images.is-style-slider > figure.wp-block-image figcaption {
	left: auto;
	right: 6px;
	bottom: 6px;
	background: none;
	color: rgba(255, 255, 255, 0.8);
	text-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
	text-align: right;
	padding: 0 8px 5px;
}

/* A gallery whose slides are light where the caption falls - the word
   clouds, white to their edges - takes .oko-bildetekst-mork: dark text on a
   pale label, which on white is invisible and only clears the words behind
   the caption. */
.wp-block-gallery.has-nested-images.is-style-slider.oko-bildetekst-mork > figure.wp-block-image figcaption {
	background: rgba(255, 255, 255, 0.75);
	color: var(--oko-heading);
	text-shadow: none;
	padding: 0 8px;
}

/* --- Piler og prikker ---------------------------------------------------
   The dots are a row of 13px circles centred 65px below the gallery, each
   a link with its number pushed out of sight. The arrows are 46x90 panels
   of #111, revealed on hover, with the chevron an icon element from
   icons.css. */
.oko-karusell,
.oko-karusell * {
	box-sizing: border-box;
}

/* The margins are !important against the content's list rules in
   style.css, which carry an ID. */
.oko-karusell .flex-control-nav {
	width: 100%;
	position: absolute;
	bottom: -65px;
	margin-left: 0 !important;
	text-align: center;
}

.oko-karusell .flex-control-nav li {
	display: inline-block;
	margin: 0 3px !important;
}

.oko-karusell .flex-control-paging li a {
	display: block;
	width: 13px;
	height: 13px;
	background: #dfdfdf;
	cursor: pointer;
	text-indent: -9999px;
	border-radius: 20px;
}

.oko-karusell .flex-control-paging li a:hover {
	background: #ccc;
}

.oko-karusell .flex-control-paging li a.flex-active {
	background: var(--oko-accent);
	cursor: default;
}

.oko-karusell .flex-direction-nav,
.oko-karusell .flex-direction-nav li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.oko-karusell .flex-direction-nav a {
	background: #111;
	/* !important on both: style.css's content rules give every link a
	   colour and a dotted underline, and a bare declaration here loses to
	   them. */
	border: 0 !important;
	color: #ececec !important;
	/* Flex rather than padding to centre it. An icon from icons.css is
	   an inline-block sitting on a text baseline, so padding centres its line
	   box and leaves the chevron itself sitting low in the panel. */
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 50%;
	margin-top: -45px;
	width: 46px;
	height: 90px;
	padding: 0;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	opacity: 0;
	overflow: hidden;
	z-index: 2;
	transition: all 0.18s ease-in-out;
}

.oko-karusell .flex-direction-nav a .fa {
	font-size: 24px;
	color: #fff;
}

.oko-karusell .flex-direction-nav .flex-prev {
	left: 0;
}

.oko-karusell .flex-direction-nav .flex-next {
	right: 0;
}

.oko-karusell:hover .flex-direction-nav a {
	opacity: 1;
}

.oko-karusell .flex-direction-nav a:hover {
	background: var(--oko-accent);
}

.oko-karusell .flex-direction-nav .flex-disabled {
	opacity: 0 !important;
	cursor: default;
	z-index: -1;
}

/* Text that exists for screen readers only - the arrows' "Previous" and
   "Next". */
.oko-skjermleser {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}
