/* Reusable components: buttons, titles, carousel, cards, CTA, search form. */

/* Buttons --------------------------------------------------------------- */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	min-height: 4rem;
	padding: 1rem 1.6rem;
	border: 1px solid transparent;
	border-radius: var(--radius-pill);
	font-family: var(--font-body);
	font-size: 1.4rem;
	font-weight: 600;
	line-height: 1.5;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Bricks global_button-primary: borderless, 0.5px tracking. */
.button--primary {
	border-width: 0;
	background: var(--action);
	color: var(--accent);
	letter-spacing: 0.05rem;
}

.button--primary:hover {
	background: #007c51;
	color: var(--accent);
	box-shadow: 0 0 4px 2px rgba(129, 156, 147, 0.7);
}

.button--outline {
	border-color: var(--action);
	background: var(--white);
	color: var(--action);
}

.button--outline:hover {
	border-color: #007c51;
	color: var(--action);
	box-shadow: 0 0 5px 2px rgba(129, 156, 147, 0.7);
}

.button--video {
	min-width: 18rem;
	padding: 0.7rem 1.4rem;
	letter-spacing: 0.05rem;
}

/* Titles ---------------------------------------------------------------- */

.section-title {
	margin-bottom: 1rem;
	color: var(--action);
	font-size: 4.5rem;
	font-weight: 400;
	text-align: center;
}

.section-title--left {
	text-align: left;
}

.section-title--inverted {
	color: var(--accent);
	font-size: var(--h2);
}

.page-title {
	color: var(--base);
	font-size: 4.5rem;
	font-weight: 700;
	text-transform: uppercase;
}

.page-intro {
	margin-bottom: 5rem;
	color: var(--action);
	font-size: 2.4rem;
	text-align: center;
}

.page-intro p {
	margin: 0;
}

/* Sections -------------------------------------------------------------- */

.section--tight {
	padding-block: 2rem var(--section-space-m);
}

.section--action {
	background: var(--action);
}

/* Carousel -------------------------------------------------------------- */

.carousel {
	position: relative;
}

.carousel__track {
	display: flex;
	gap: var(--carousel-gap, 2.4rem);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
}

.carousel__track::-webkit-scrollbar {
	display: none;
}

.carousel__track:focus-visible {
	outline-offset: 4px;
}

.carousel__slide {
	flex: 0 0 var(--carousel-slide, 100%);
	scroll-snap-align: start;
	min-width: 0;
}

.carousel__arrow {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: inline-flex;
	padding: 0.4rem;
	border: 0;
	background: none;
	color: var(--action);
	cursor: pointer;
	transform: translateY(-50%);
}

.carousel__arrow--prev {
	left: var(--space-xs);
}

.carousel__arrow--next {
	right: var(--space-xs);
}

.carousel__dots {
	display: flex;
	justify-content: center;
	gap: 1rem;
	margin-top: 3rem;
}

.carousel__dots:empty {
	display: none;
}

.carousel__dot {
	width: 1rem;
	height: 1rem;
	padding: 0;
	border: 1px solid var(--dot-color, var(--action));
	border-radius: 2em;
	background: transparent;
	cursor: pointer;
	transition: width var(--transition), background-color var(--transition);
}

.carousel__dot[aria-current='true'] {
	width: 3rem;
	background: var(--dot-color, var(--action));
}

/*
 * 37rem cards on a full-width track (Frames slider with breakout): the slider box is the
 * section minus the gutters, cards overflow visibly to both viewport edges and scrolling
 * stops when the last card meets the right gutter (Splide trimSpace).
 */
.carousel--cards {
	--carousel-slide: min(37rem, calc(100vw - 2 * var(--gutter)));
	--carousel-gap: 2rem;
}

.carousel--cards .carousel__track {
	padding-block: 0;
	padding-inline: var(--gutter);
	scroll-padding-inline: var(--gutter);
}

.carousel--on-action {
	--dot-color: var(--white);
}

/* Card slider dots hang below the cards without adding height (Splide pagination, bottom: -5rem). */
.carousel--cards .carousel__dots {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 3.5rem);
	margin: 0;
}

.carousel--cards .carousel__dot {
	transition: none;
}

/* All cards fit: Splide centres the list, counting the last slide's trailing gap. */
.carousel--cards.is-static .carousel__track {
	justify-content: center;
}

.carousel--cards.is-static .carousel__slide {
	position: relative;
	left: calc(var(--carousel-gap) / -2);
}



/* Logos carousel (Splide perPage 7 / 1240: 5 / 991: 4 / 767: 3 / 478: 1) */

.carousel--logos {
	--carousel-gap: 0;
	--carousel-slide: calc(100% / 7);
}

@media (max-width: 1240px) {
	.carousel--logos {
		--carousel-slide: calc(100% / 5);
	}
}

@media (max-width: 991px) {
	.carousel--logos {
		--carousel-slide: calc(100% / 4);
	}
}

@media (max-width: 767px) {
	.carousel--logos {
		--carousel-slide: calc(100% / 3);
	}
}

@media (max-width: 478px) {
	.carousel--logos {
		--carousel-slide: 100%;
	}
}

/* Loop mode: the track only clips, main.js moves the list. */
[data-loop] .carousel__track {
	overflow: hidden;
	scroll-snap-type: none;
}

.carousel__list {
	display: flex;
	width: 100%;
	gap: var(--carousel-gap, 0);
}

.carousel__list > .carousel__slide {
	flex: 0 0 var(--carousel-slide, 100%);
}

.carousel--logos .carousel__slide {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 8rem;
	padding: 1rem;
}

.partner-logo {
	max-width: 14rem;
	max-height: 6rem;
	height: 6rem;
	object-fit: contain;
}

/* Teaser card (front page sliders, Akcijas) ------------------------------ */

.teaser {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	height: 100%;
	padding: 3rem 3.5rem;
	border-radius: var(--card-radius);
	background: var(--shade-ultra-light);
	color: var(--base);
}

.carousel--on-action .teaser,
.teaser--tall {
	background: var(--white);
}

.teaser--tall {
	box-shadow: 0 0 10px 0 rgba(0, 43, 27, 0.12);
}

.teaser__media {
	flex-shrink: 0;
	height: 20rem;
	overflow: hidden;
}

.teaser__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.teaser__title {
	color: var(--base);
	font-size: 3.2rem;
}

/* "Vēl Jums varētu patikt" kept the default h3 size in Bricks. */
.teaser--plain .teaser__title {
	color: var(--text-color);
	font-size: var(--h3);
}

.teaser__text {
	color: var(--base);
	font-family: var(--font-body);
	font-size: 1.6rem;
}

.teaser:hover .teaser__title {
	color: var(--action);
}

/* Row card (section lists) ---------------------------------------------- */

.row-list {
	display: grid;
	gap: 5rem;
}

/* ACSS grid--1-3 grid--l-1 (minmax(0, …) tracks, stacked from 992px). */
.row-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
	align-items: start;
	color: var(--base);
}

.row-card__media {
	max-height: 24rem;
	overflow: hidden;
}

.row-card--cover .row-card__media {
	height: 24rem;
}

/* Category archives: natural proportions, clipped at 24rem. Section pages: cropped to fill. */
.row-card__media img {
	width: 100%;
	height: auto;
}

.row-card--cover .row-card__media img {
	height: 100%;
	object-fit: cover;
}

@media (min-width: 992px) {
	.row-card--fill .row-card__media img {
		height: 24rem;
		object-fit: cover;
	}
}

.row-card__body {
	display: flex;
	flex-direction: column;
	gap: 3rem;
	padding: 2.8rem 0 0 6rem;
	border-top: 1px solid var(--muted);
}

.row-card__title {
	max-width: 65%;
	color: var(--text-color);
	font-size: 3.2rem;
}

.row-card__text {
	color: var(--base);
	font-family: var(--font-body);
	font-size: 1.6rem;
}

.row-card:hover .row-card__title {
	color: var(--action);
}

/* Side by side: the rule runs across the whole card (over the image too) and the image is centred
   vertically against the text. */
@media (min-width: 993px) {
	.row-card {
		padding-top: 2.8rem;
		border-top: 1px solid var(--muted);
	}

	.row-card__media {
		display: flex;
		align-self: center;
		align-items: center;
		justify-content: center;
	}

	.row-card__body {
		padding-top: 0;
		border-top: 0;
	}
}

/* Tablet/phone (Bricks): stacked, centred, the rule moves from the text to the card. */
@media (max-width: 992px) {
	.row-card {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 991px) {
	.row-card {
		justify-items: center;
		border-top: 1px solid var(--muted);
	}

	.row-card__media {
		display: flex;
		justify-content: center;
		width: 100%;
		height: 24rem;
	}

	.row-card__media img {
		height: 100%;
		object-fit: contain;
	}

	.row-card--cover .row-card__media img {
		max-width: min(30rem, 100%);
		object-fit: contain;
	}

	.row-card__body {
		width: 100%;
		padding-left: 0;
		border-top: 0;
	}

	.row-card__title {
		max-width: 100%;
	}

}

/* Flipbooks (Noderīgi → Katalogi / Žurnāli) */

.flipbook-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 5rem;
}

.flipbook {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	text-align: center;
}

.flipbook__book {
	display: flex;
	justify-content: center;
	width: 100%;
}

.flipbook__book .df-popup-thumb {
	height: 21rem;
}

/* Centred as a block, but multi-line titles stay left-aligned (Bricks heading default). */
.flipbook__title {
	text-align: start;
	color: var(--base);
	font-size: 2.4rem;
	font-weight: 600;
	line-height: 1.2;
}

/* ACSS grid--l-3 / grid--m-2 / grid--s-1. The 2rem top margin below 991px comes from .section-layout__main. */
@media (max-width: 992px) {
	.flipbook-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 768px) {
	.flipbook-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 480px) {
	.flipbook-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

@media (max-width: 478px) {
	.flipbook__book .df-popup-thumb {
		height: auto;
	}
}

@media (max-width: 421px) {
	.flipbook__book .df-book-wrapper {
		width: 15rem !important;
	}
}

/* Single post content --------------------------------------------------- */

.single-entry {
	display: flex;
	flex-direction: column;
	gap: 5rem;
}

.single-entry .page-title {
	margin-bottom: 1rem;
}

/* Bricks "Single Post": the body is 70vw (90vw below 992px, 100vw on phones), capped at the column width. */
.single-entry .entry-content {
	width: 70vw;
	max-width: 100%;
}

@media (max-width: 991px) {
	.single-entry .entry-content {
		width: 90vw;
	}
}

@media (max-width: 767px) {
	.single-entry .entry-content {
		width: 100vw;
	}
}

/* Own formatting context, like the Bricks post-content element: child margins don't collapse through it. */
.entry-content {
	display: flow-root;
	color: var(--base);
	font-family: var(--font-body);
	font-size: 1.6rem;
}

/* Bricks base: :where(p) { margin-bottom: 1.2em } and :where(p:last-of-type) { margin-bottom: 0 }. */
.entry-content p {
	margin: 0 0 1.2em;
}

.entry-content p:last-of-type {
	margin-bottom: 0;
}

.entry-content ul,
.entry-content ol {
	margin: 1.6rem 0;
	padding-left: 4rem;
}

.entry-content figure {
	margin: 1.6rem 0;
}

.entry-content img {
	height: auto;
}

.entry-content .is-resized picture {
	display: block;
}

.entry-content iframe {
	width: 100%;
}

/* Mitto Events registration: Bricks shortcode element 2rem below the (often empty) body; the iframe stays inline. */
.entry-embed {
	margin-top: 2rem;
	font-size: var(--text-m);
}

.entry-embed .mitto-embed {
	display: inline;
}

.entry-content .wp-block-embed iframe {
	aspect-ratio: 16 / 9;
	height: auto;
}

.entry-content .wp-block-file {
	margin-top: 2rem;
}

/* Page body (Bricks "Post Content"): inherits the 18px body size; links stay text-coloured. */
.entry-content--page {
	color: var(--text-color);
	font-size: inherit;
}

.entry-content--page h1 {
	font-family: var(--font-body);
	font-size: 4.5rem;
	font-weight: 400;
}

.entry-content--page a {
	color: var(--base);
}

.entry-content--page figure {
	margin: 1em 0;
}

/* CTA (newsletter) ------------------------------------------------------- */

.cta {
	padding-block: 2rem var(--section-space-m);
}

.cta__inner {
	display: grid;
	grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
	padding-top: 3rem;
}

.cta__intro {
	display: flex;
	align-items: center;
	gap: 4rem;
}

/* 9rem wide but allowed to shrink next to the text on phones (Bricks image in a flex row). */
.cta__icon {
	width: 9rem;
	height: auto;
}

.cta__copy {
	max-width: 40rem;
}

.cta__title {
	color: var(--base);
	font-size: 3.2rem;
	font-weight: 700;
}

.cta__title span {
	color: var(--action);
}

.cta__text {
	color: var(--muted);
	font-family: var(--font-body);
	font-size: 1.6rem;
}

.cta__form {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.cta__field {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	margin-top: 3rem;
}

.cta__note {
	max-width: 33rem;
	color: var(--muted);
	font-family: var(--font-body);
	font-size: 1.4rem;
}

/* ACSS grid--l-1 stacks at 992px; the Bricks column alignment flips at 991px. */
@media (max-width: 992px) {
	.cta__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	/* .cta__field is the Bricks .subscribe_for_news_main_wrapepr, whose custom CSS switched at 992px. */
	.cta__field {
		justify-content: flex-start;
	}
}

@media (max-width: 991px) {
	.cta__form {
		align-items: flex-start;
	}
}



/* WS Form "Subscribe for news" — classes are set on the fields inside WS Form. */

.subscribe_for_news_main_wrapepr {
	display: flex;
	justify-content: flex-end;
}

.subscribe_for_news_wrapper,
.Subscribe_for_news_from_wrapper {
	max-width: 37rem !important;
}

.Subscribe_for_news_from_wrapper select {
	color: var(--base) !important;
	font-size: 1.6rem !important;
}

.subscribe_for_news_input_wrapper {
	top: 0 !important;
	max-width: 37rem !important;
	min-width: 37rem !important;
	height: 5rem;
	margin-bottom: 1rem;
}

.subscribe_for_news_input_field {
	height: 5rem !important;
	max-width: 37rem !important;
	padding-left: 2rem !important;
	padding-right: 5rem !important;
	border: 1px solid var(--base) !important;
	border-radius: 2em !important;
	box-shadow: none !important;
	outline: none;
	color: var(--base) !important;
	font-family: var(--font-body) !important;
	font-size: 1.6rem !important;
}

.subscribe_for_news_input_field::placeholder {
	color: var(--muted) !important;
}

.subscribe_for_news_button_wrapper {
	position: absolute !important;
	height: 5rem !important;
}

.subscribe_for_news_button_field {
	position: relative;
	top: 50%;
	right: 3.3rem;
	z-index: 4;
	width: 4rem !important;
	height: 4rem !important;
	border-color: var(--action) !important;
	border-radius: 50% !important;
	background-color: var(--action) !important;
	font-size: 0 !important;
	transform: translateY(-50%);
}

.subscribe_for_news_button_field::before {
	content: '';
	position: absolute;
	inset: 0;
	background: url('../img/send.svg') center / 2.2rem no-repeat;
}

.second_step_submit--button {
	border-radius: 3rem !important;
}

/* Custom CSS on the Bricks site used 992px here. */
@media (max-width: 992px) {
	.subscribe_for_news_main_wrapepr {
		justify-content: flex-start;
		margin-top: 3rem;
	}

	.subscribe_for_news_input_wrapper {
		min-width: 100% !important;
	}

	.subscribe_for_news_button_field {
		right: 4.3rem;
	}
}

/* Search form ------------------------------------------------------------- */

.search-form {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	width: 100%;
}

.search-form__field {
	position: relative;
	width: 100%;
	max-width: 48.6rem;
	height: 4.8rem;
}

.search-form__field input {
	width: 100%;
	height: 100%;
	padding: 0 4rem 0 1.2rem;
	border: 1px solid var(--muted);
	border-radius: 3rem;
	background: var(--white);
	color: var(--base);
	font-size: 1.8rem;
}

.search-form__field button {
	position: absolute;
	top: 50%;
	right: 2rem;
	display: inline-flex;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	transform: translateY(-50%);
}

.search-form__types {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 2rem;
	margin: 0;
	padding: 0;
	border: 0;
}

/* As in the Bricks form: the checkbox stretches to the label height plus its 5px bottom margin. */
.search-form__type {
	display: inline-flex;
	gap: 0.5rem;
	color: #9e9e9e;
	cursor: pointer;
}

.search-form__type input {
	margin: 0;
}

.search-form__type-label {
	margin-bottom: 5px;
}

.search-form__type input:checked {
	accent-color: var(--action);
}

/* Pagination ------------------------------------------------------------- */

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.8rem;
	margin-top: 4rem;
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 4rem;
	height: 4rem;
	padding-inline: 1.2rem;
	border: 1px solid var(--action);
	border-radius: var(--radius-pill);
	color: var(--action);
	font-size: 1.4rem;
	font-weight: 600;
}

.pagination .page-numbers.current {
	background: var(--action);
	color: var(--accent);
}
