/*
 * KA Instagram 1.0.1
 * Width and alignment follow KA Venue Maps 1.0.0 (.ka-venue-map): width 100%, max-width 450px,
 * left-aligned (no auto margins), border-box sizing, 2px currentColor border with 8px radius
 * on the placeholder. Every rule is scoped to .ka-instagram / .ka-instagram-notice.
 */

.ka-instagram {
	box-sizing: border-box;
	display: block;
	position: relative;
	width: 100%;
	max-width: 450px;
	margin-left: 0;
	margin-right: 0;
	padding: 0;
}

.ka-instagram *,
.ka-instagram *::before,
.ka-instagram *::after {
	box-sizing: border-box;
}

.ka-instagram .kai-viewport {
	position: relative;
	width: 100%;
	overflow: hidden; /* clips only the slide moving in or out */
}

.ka-instagram .kai-slide {
	position: relative;
	width: 100%;
}

.ka-instagram .kai-slide[hidden] {
	display: none !important;
}

.ka-instagram .kai-viewport.kai-animating .kai-slide.kai-moving {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	will-change: transform;
}

/* ---------- placeholder (loading, consent, failure) ---------- */

.ka-instagram .kai-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	aspect-ratio: 1 / 1;
	min-height: 260px;
	padding: 20px;
	border: 2px solid var(--ka-instagram-border-color, currentColor);
	border-radius: 8px;
	text-align: center;
	font-size: 14px;
	line-height: 1.45;
}

@supports not (aspect-ratio: 1 / 1) {
	.ka-instagram .kai-placeholder {
		min-height: 360px;
	}
}

.ka-instagram .kai-slide.is-loaded .kai-placeholder {
	display: none;
}

.ka-instagram .kai-icon {
	display: block;
	width: 32px;
	height: 32px;
	flex: none;
}

.ka-instagram .kai-placeholder[data-state="loading"] .kai-icon {
	animation: kai-pulse 1.4s ease-in-out infinite;
}

@keyframes kai-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.35; }
}

.ka-instagram .kai-status {
	margin: 0;
	padding: 0;
	font-weight: 700;
	font-size: 15px;
}

.ka-instagram .kai-detail {
	margin: 0;
	padding: 0;
	max-width: 34em;
	font-size: 13px;
}

.ka-instagram .kai-detail[hidden],
.ka-instagram .kai-action[hidden] {
	display: none !important;
}

.ka-instagram .kai-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px 16px;
	margin-top: 4px;
}

.ka-instagram .kai-action {
	min-height: 40px;
	margin: 0;
	padding: 8px 16px;
	border: 2px solid currentColor;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
}

.ka-instagram .kai-link {
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- the official embed ---------- */

.ka-instagram .kai-embed:empty {
	display: none;
}

/* Instagram's embed.js sets min-width:326px and margins inline; keep it inside the column instead. */
.ka-instagram .kai-embed blockquote.instagram-media,
.ka-instagram .kai-embed iframe.instagram-media {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	margin: 0 !important;
}

.ka-instagram .kai-embed iframe {
	max-width: 100% !important;
	min-width: 0 !important;
	margin: 0 !important;
}

/*
 * While loading, the official blockquote/frame stays visible and in the flow below the
 * placeholder: Instagram's embed only reports its height once its frame is rendered, and
 * embed.js reads the blockquote's size, so neither may be hidden or collapsed during loading.
 */
.ka-instagram .kai-slide:not(.is-loaded) .kai-embed {
	margin-top: 8px;
}

/* ---------- navigation ---------- */

.ka-instagram .kai-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	margin-top: 12px;
}

.ka-instagram .kai-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 2px solid currentColor;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	line-height: 0;
}

.ka-instagram .kai-btn svg {
	display: block;
}

.ka-instagram .kai-btn:hover,
.ka-instagram .kai-action:hover {
	opacity: 0.75;
}

.ka-instagram .kai-btn:focus-visible,
.ka-instagram .kai-action:focus-visible,
.ka-instagram .kai-link:focus-visible {
	outline: 3px solid #f43b65;
	outline-offset: 2px;
}

.ka-instagram .kai-counter {
	flex: 1 1 auto;
	text-align: center;
	font-weight: 700;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.ka-instagram .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.ka-instagram .kai-placeholder[data-state="loading"] .kai-icon {
		animation: none;
	}
}

/*
 * Optional heading hook: give the WPBakery heading/text element above KA Instagram the extra class
 * "ka-instagram-heading" and it is hidden whenever its column shows no Instagram posts (hidden by the
 * visibility rules, Always Hide, nothing enabled, ...). Browsers without :has() simply keep the heading.
 */
.wpb_column:not(:has(.ka-instagram)) .ka-instagram-heading,
.vc_column_container:not(:has(.ka-instagram)) .ka-instagram-heading {
	display: none !important;
}

/* Shown only to people who can edit the concert. */
.ka-instagram-notice {
	box-sizing: border-box;
	max-width: 450px;
	margin: 0 0 20px;
	padding: 10px 12px;
	border: 2px dashed #d63638;
	border-radius: 8px;
	background: #fff;
	color: #1d2327;
	font-size: 13px;
	line-height: 1.5;
}
