/* Custom Gutenberg blocks */

/* ——— Button ——— */
.wp-block-basz-button,
.basz-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 8px 24px;
	border-radius: var(--basz-radius);
	font-family: var(--basz-font-body);
	font-size: 16px;
	font-weight: 700;
	line-height: var(--basz-body-lh);
	text-decoration: none !important;
	border: 2px solid transparent;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.basz-btn--primary {
	background: var(--basz-color-orange);
	color: var(--basz-color-white) !important;
	border-color: var(--basz-color-orange);
}
.basz-btn--primary:hover {
	background: var(--basz-color-darker-orange);
	border-color: var(--basz-color-darker-orange);
	color: var(--basz-color-white) !important;
}

.basz-btn--secondary {
	background: var(--basz-color-medium-dark-blue);
	color: var(--basz-color-white) !important;
	border-color: var(--basz-color-medium-dark-blue);
}
.basz-btn--secondary:hover {
	background: var(--basz-color-dark-blue);
	border-color: var(--basz-color-dark-blue);
	color: var(--basz-color-white) !important;
}

.basz-btn--secondary-light {
	background: var(--basz-color-white);
	color: var(--basz-color-medium-dark-blue) !important;
	border-color: var(--basz-color-medium-dark-blue);
}
.basz-btn--secondary-light:hover {
	color: var(--basz-color-orange) !important;
	border-color: var(--basz-color-orange);
}

.basz-btn--tertiary {
	background: var(--basz-color-dark-blue);
	color: var(--basz-color-white) !important;
	border-color: var(--basz-color-dark-blue);
}
.basz-btn--tertiary:hover {
	opacity: 0.9;
	color: var(--basz-color-white) !important;
}

.basz-btn--align-center,
.wp-block-basz-button.basz-btn--align-center {
	display: flex;
	width: fit-content;
	margin-left: auto;
	margin-right: auto;
}

/* ——— Members-only access (Видеа, Статии, Документи) ——— */
.basz-access-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	background: var(--basz-color-light-grey);
	color: var(--basz-color-medium-dark-blue);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
}

.basz-access-notice {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	margin: 32px 0;
	padding: 24px;
	border-radius: var(--basz-radius);
	background: var(--basz-color-warm-white);
	color: var(--basz-color-medium-dark-blue);
}

.basz-access-notice p {
	margin: 0;
}

/* ——— Grid load more (news, videos, documents) ——— */
.basz-grid__footer {
	display: flex;
	justify-content: center;
	margin-top: 24px;
}

.basz-load-more[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

.basz-btn-wrap--center {
	display: flex;
	justify-content: center;
	width: 100%;
}

/* ——— Accordion ———
   Core only offers show/hide and left/right for a hardcoded "+".
   The same faq.svg is the closed chevron; open rotates it 180deg. */
.wp-block-accordion,
.wp-block-accordion.has-custom-css {
	display: flex;
	flex-direction: column;
	gap: 12px;
	width: 100%;
	background: transparent;
}

.wp-block-accordion-item {
	background: #ADBDD633;
	border-radius: 8px;
}

.wp-block-accordion-heading {
	margin: 0;
}

.wp-block-accordion-heading__toggle {
	gap: 16px;
	padding: 16px 20px;
}

.wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
	text-decoration: none;
}

.wp-block-accordion-heading__toggle-icon {
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	font-size: 0;
	line-height: 0;
	overflow: hidden;
	background-color: currentColor;
	-webkit-mask: url("../images/faq.svg") center / contain no-repeat;
	mask: url("../images/faq.svg") center / contain no-repeat;
}

.wp-block-accordion .wp-block-accordion-item.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
	transform: rotate(180deg);
}

.wp-block-accordion-panel {
	padding: 0 20px 16px;
}

.wp-block-accordion-panel > :last-child {
	margin-bottom: 0;
}


/* ——— Section ——— */
.wp-block-basz-section,
.basz-section {
	width: 100%;
	position: relative;
}

.basz-section__inner {
	max-width: var(--basz-content-width);
	margin: 0 auto;
	padding: 40px 24px;
	width: 100%;
}

@media (min-width: 1248px) {
	.basz-section__inner {
		padding-left: 0;
		padding-right: 0;
	}
}

.basz-section--full .basz-section__inner {
	max-width: none;
	padding-left: 0;
	padding-right: 0;
}

.basz-section.has-bg-image {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Background image fitted to the width and anchored to the bottom over warm
   white (Additional CSS class "basz-section--bg-bottom"), so artwork whose top
   edge is warm white blends in however tall the section grows. !important
   beats the inline cover/center the section block saves. */
.basz-section--bg-bottom.has-bg-image {
	background-color: var(--basz-color-warm-white);
	background-size: 100% auto !important;
	background-position: center bottom !important;
}

/* Gold curves at the top-left and bottom-right edges (Additional CSS class
   "basz-section--curves"), e.g. the conference registration form. */
.basz-section--curves {
	overflow: hidden;
}

.basz-section--curves::before,
.basz-section--curves::after {
	content: "";
	position: absolute;
	background-repeat: no-repeat;
	background-size: contain;
	pointer-events: none;
}

.basz-section--curves::before {
	left: 0;
	top: 9px;
	width: 243px;
	height: 341px;
	background-image: url("../images/curve-left.png");
	background-position: left top;
}

.basz-section--curves::after {
	right: 0;
	bottom: 34px;
	width: 315px;
	height: 414px;
	background-image: url("../images/curve-right.png");
	background-position: right top;
}

.basz-section--curves .basz-section__inner {
	position: relative;
	z-index: 1;
}

@media (max-width: 767px) {
	.basz-section--curves::before,
	.basz-section--curves::after {
		width: 40%;
		opacity: 0.6;
	}
}

/* ——— Columns ——— */
.wp-block-basz-columns,
.basz-columns {
	display: grid;
	gap: 32px;
	width: 100%;
}

.basz-columns--2 {
	grid-template-columns: 1fr;
}

.basz-columns--3 {
	grid-template-columns: 1fr;
}

@media (min-width: 768px) {
	.basz-columns--2 {
		grid-template-columns: 1fr 1fr;
	}
	.basz-columns--3 {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

.basz-columns__col > *:last-child {
	margin-bottom: 0;
}

/* ——— Slider ——— */
.basz-slider {
	position: relative;
	width: 100%;
	margin-bottom: 40px; /* theme Large spacing */
}

/* Only pull up when the arrows are shown; a --fits slider hides them. */
@media (min-width: 1024px) {
	.basz-slider:not(.basz-slider--fits) {
		margin-top: -38px;
	}
}

.basz-slider__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 24px;
}

.basz-slider__title {
	margin: 0;
	flex: 1;
}

/* margin-left keeps the arrows right-aligned even with no title present. */
.basz-slider__nav {
	display: flex;
	gap: 16px;
	margin-left: auto;
}

/*
 * arrow.svg is inlined in the button. It is a filled disc with the arrow
 * knocked out as a transparent hole, so `color` paints the disc and the
 * arrow shows the section background through it. The file itself points
 * right; the previous button is the same graphic rotated 180deg.
 */
.basz-slider__nav-btn {
	width: 38px;
	height: 38px;
	border: none;
	padding: 0;
	background: none;
	color: var(--basz-color-dark-blue);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease, opacity 0.2s ease;
}

.basz-slider__nav-btn svg {
	width: 100%;
	height: 100%;
	display: block;
	pointer-events: none;
}

.basz-slider__nav-btn--prev svg {
	transform: rotate(180deg);
}

.basz-section--dark .basz-slider__nav-btn {
	color: var(--basz-color-white);
}

.basz-slider__nav-btn:hover {
	color: var(--basz-color-orange);
}

.basz-slider__nav-btn:disabled,
.basz-slider__nav-btn.swiper-button-disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Swiper hides the controls entirely when every slide already fits. */
.basz-slider__nav-btn.swiper-button-lock {
	display: none;
}

.basz-slider__track-wrap {
	overflow: hidden;
	width: 100%;
}

/* Swiper owns the track transform and sets slide widths inline. */
.basz-slider__track {
	display: flex;
}

/*
 * Swiper core sets slides to height:100%; `auto` lets arbitrary block content
 * drive the height instead, and flex stretch then levels the row out.
 */
.basz-slider__slide {
	min-width: 0;
	height: auto;
}

/*
 * Editor-only preview: Swiper does not run inside Gutenberg, so the slides are
 * laid out as a plain flex row using the per-view count set on the wrapper.
 */
.basz-slider--static .basz-slider__track {
	gap: 16px;
	align-items: stretch;
}

/* In the editor the track's children are block wrappers, not .swiper-slide. */
.basz-slider--static .basz-slider__track > * {
	flex: 0 0 calc(
		(100% - (var(--basz-slider-per-view, 5) - 1) * 16px) / var(--basz-slider-per-view, 5)
	);
	min-width: 0;
	display: flex;
}

/* Keep the block appender from being squeezed into a slide-sized column. */
.basz-slider--static .basz-slider__track > .block-list-appender {
	flex: 0 0 auto;
}

/*
 * Logo framing for legacy sliders only, which render the <img> as a direct
 * child. Inner-block content is wrapped (.wp-block-image etc.) and is left
 * alone so cards and media keep their own sizing.
 */
.basz-slider__slide > img {
	width: 100%;
	height: 136px;
	object-fit: contain;
	background: var(--basz-color-warm-white);
	border-radius: var(--basz-radius);
	padding: 12px;
}

.basz-slider__dots {
	display: flex;
	justify-content: center;
	gap: 16px;
	margin-top: 24px;
}

/* Swiper renders the bullets as spans, hence the explicit display. */
.basz-slider__dot {
	display: block;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: none;
	padding: 0;
	background: var(--basz-color-light-grey);
	cursor: pointer;
}

.basz-slider__dot.is-active {
	background: var(--basz-color-orange);
}

.basz-slider__dots.swiper-pagination-lock {
	display: none;
}

.basz-slider__slide .basz-news-card {
	height: 100%;
}

/*
 * One slide per view: the card gets room for a 50/50 split — image on the
 * left, title / description / button on the right. Narrow screens keep the
 * stacked layout, where a half-width image would be too small to read.
 */
@media (min-width: 768px) {
	.basz-slider[data-per-view="1"] .basz-news-card {
		flex-direction: row;
		min-height: 320px;
	}

	.basz-slider[data-per-view="1"] .basz-news-card__media {
		flex: 0 0 50%;
		max-width: min(50%, 593px);
	}

	.basz-slider[data-per-view="1"] .basz-news-card__body {
		flex: 0 0 50%;
		max-width: 50%;
		padding: 32px;
	}
}

.basz-slider__footer {
	display: flex;
	justify-content: center;
	margin-top: 24px;
}

.basz-news-slider__empty,
.basz-category-slider .basz-news-slider__empty {
	margin: 0;
	padding: 16px 0;
	opacity: 0.7;
}

/* ——— Group style "Curves" (Styles → Curves): two gold curves clipped at the
   top-right corner of a card. ——— */
.wp-block-group.is-style-basz-curves {
	position: relative;
	overflow: hidden;
}

.wp-block-group.is-style-basz-curves::before {
	content: "";
	position: absolute;
	top: 16px;
	right: 0;
	width: 104px;
	height: 219px;
	background:
		url("../images/curve-card.png") right top / 104px 177px no-repeat,
		url("../images/curve-card.png") right 42px / 104px 177px no-repeat;
	pointer-events: none;
}

.wp-block-group.is-style-basz-curves > * {
	position: relative;
}

/* Narrow cards: the curves would run through the text. */
@media (max-width: 600px) {
	.wp-block-group.is-style-basz-curves::before {
		opacity: 0.35;
	}
}

/* ——— Group style "Glass" (Styles → Glass): Figma's glass effect on dark
   backgrounds — a 1px edge that catches light at the top-left and
   bottom-right corners, plus soft inner shading. The edge is a gradient
   masked down to the padding ring, so it follows the group's border radius. ——— */
.wp-block-group.is-style-basz-glass {
	position: relative;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	box-shadow:
		inset 0 1px 1px rgba(255, 255, 255, 0.06),
		inset 0 -12px 24px rgba(0, 0, 0, 0.12),
		0 4px 16px rgba(0, 0, 0, 0.12);
}

.wp-block-group.is-style-basz-glass::before {
	content: "";
	position: absolute;
	inset: 0;
	padding: 1px;
	border-radius: inherit;
	background: linear-gradient(
		135deg,
		rgba(255, 255, 255, 0.4) 0%,
		rgba(255, 255, 255, 0.08) 30%,
		rgba(255, 255, 255, 0.05) 70%,
		rgba(255, 255, 255, 0.3) 100%
	);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
}

/* ——— Group style "Flow" (Styles → Flow): cards joined by lines, e.g. the
   Структура chart. Separators inside become the lines; under 768px the row
   stacks and the lines turn vertical. ——— */
.wp-block-group.is-style-basz-flow {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	flex-wrap: nowrap;
	gap: 0;
}

.wp-block-group.is-style-basz-flow > * {
	margin: 0;
}

.wp-block-group.is-style-basz-flow > .wp-block-separator {
	flex: 0 0 24px;
	align-self: center;
	width: 0;
	min-width: 0;
	height: 24px;
	border: 0;
	border-left: 2px solid currentColor;
}

/* Pills (the "Избира" labels) keep their own width. */
.wp-block-group.is-style-basz-flow > :not(.wp-block-separator):not(.has-white-background-color) {
	align-self: center;
}

@media (min-width: 768px) {
	.wp-block-group.is-style-basz-flow {
		flex-direction: row;
		align-items: center;
	}

	.wp-block-group.is-style-basz-flow > * {
		flex: 0 1 auto;
	}

	.wp-block-group.is-style-basz-flow > .wp-block-separator {
		flex: 1 1 24px;
		width: auto;
		height: 0;
		border-left: 0;
		border-top: 2px solid currentColor;
	}
}
