/* =====================================================================
   Kadence – Hero Section Slide Gallery  (khsg)
   ===================================================================== */

/* ── Frontend: outer container ──────────────────────────────────────── */

.khsg {
	position: relative;
	width: 100vw;
	max-width: 100vw;
	height: var( --khsg-height, 1000px );
	overflow: hidden;
	background: #111;
	outline: none; /* remove focus ring from container – arrows handle focus */
}

/* Full-width stretch when inside a constrained content column */
.entry-content .khsg,
.wp-block-post-content .khsg {
	margin-left: calc( 50% - 50vw );
	margin-right: calc( 50% - 50vw );
}

/* ── Slide track ────────────────────────────────────────────────────── */

.khsg__track {
	position: relative;
	width: 100%;
	height: 100%;
}

.khsg__slides {
	position: relative;
	width: 100%;
	height: 100%;
}

/* ── Individual slide ───────────────────────────────────────────────── */

.khsg-slide {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	opacity: 0;
	transition: opacity 0.75s ease;
	pointer-events: none;
	will-change: opacity;
}

.khsg-slide--active {
	opacity: 1;
	pointer-events: auto;
	z-index: 1;
}

/* ── Dark overlay ───────────────────────────────────────────────────── */

.khsg-slide__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.38 );
	z-index: 1;
}

/* ── Slide content (heading / subtitle / button) ────────────────────── */

.khsg-slide__content {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 3rem 2rem;
}

.khsg-slide__heading {
	color: #fff;
	font-size: clamp( 2rem, 5vw, 3.75rem );
	font-weight: 700;
	line-height: 1.15;
	margin: 0 0 1.1rem;
	max-width: 860px;
	text-shadow: 0 2px 10px rgba( 0, 0, 0, 0.45 );
}

.khsg-slide__sub {
	color: rgba( 255, 255, 255, 0.92 );
	font-size: clamp( 1rem, 2vw, 1.4rem );
	line-height: 1.65;
	margin: 0 0 2.2rem;
	max-width: 680px;
	text-shadow: 0 1px 5px rgba( 0, 0, 0, 0.4 );
}

/* Theme button – extends WordPress .wp-element-button defaults */
.khsg-slide__btn {
	display: inline-block;
	padding: 0.85rem 2.4rem;
	background: var( --global-palette1, #3182ce );
	color: #fff !important;
	font-size: 1rem;
	font-weight: 600;
	text-decoration: none;
	border-radius: var( --global-radius, 4px );
	border: 2px solid transparent;
	cursor: pointer;
	letter-spacing: 0.03em;
	transition: background 0.2s ease, transform 0.18s ease, border-color 0.2s ease;
}

.khsg-slide__btn:hover,
.khsg-slide__btn:focus-visible {
	background: var( --global-palette2, #2c5282 );
	color: #fff !important;
	transform: translateY( -2px );
	outline: none;
}

.khsg-slide__btn:focus-visible {
	border-color: rgba( 255, 255, 255, 0.8 );
}

/* ── Navigation arrows ──────────────────────────────────────────────── */

.khsg__arrow {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	height: 54px;
	padding: 0;
	background: rgba( 0, 0, 0, 0.42 );
	border: 2px solid rgba( 255, 255, 255, 0.28 );
	border-radius: 50%;
	cursor: pointer;
	color: #fff;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
	appearance: none;
	-webkit-appearance: none;
}

.khsg__arrow:hover {
	background: rgba( 0, 0, 0, 0.72 );
	border-color: rgba( 255, 255, 255, 0.72 );
}

.khsg__arrow:focus-visible {
	outline: 3px solid rgba( 255, 255, 255, 0.9 );
	outline-offset: 2px;
}

.khsg__arrow--prev {
	left: 24px;
	transform: translateY( -50% );
}

.khsg__arrow--next {
	right: 24px;
	transform: translateY( -50% );
}

.khsg__arrow svg {
	width: 30px;
	height: 30px;
	fill: currentColor;
	display: block;
	flex-shrink: 0;
}

/* ── Reduced-motion ─────────────────────────────────────────────────── */

@media ( prefers-reduced-motion: reduce ) {
	.khsg-slide {
		transition: none;
	}
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media ( max-width: 768px ) {
	.khsg__arrow {
		width: 42px;
		height: 42px;
	}

	.khsg__arrow--prev {
		left: 12px;
	}

	.khsg__arrow--next {
		right: 12px;
	}

	.khsg__arrow svg {
		width: 22px;
		height: 22px;
	}

	.khsg-slide__content {
		padding: 2rem 1.25rem;
	}
}

@media ( max-width: 480px ) {
	.khsg__arrow {
		width: 36px;
		height: 36px;
	}

	.khsg__arrow svg {
		width: 18px;
		height: 18px;
	}
}

/* =====================================================================
   Editor styles (block editor only)
   ===================================================================== */

.khsg-editor {
	border: 1px solid #ddd;
	border-radius: 6px;
	background: #f8f8f8;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.khsg-editor__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.7rem 1rem;
	background: #fff;
	border-bottom: 1px solid #e0e0e0;
	font-weight: 600;
	font-size: 0.88rem;
	color: #1e1e1e;
}

.khsg-editor__meta {
	font-size: 0.75rem;
	font-weight: 400;
	color: #888;
}

/* Responsive grid: 3 cols for ≥3 slides, each min 220px */
.khsg-editor__slides {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 220px, 1fr ) );
	gap: 1px;
	background: #e0e0e0;
}

.khsg-editor__slide {
	background: #fff;
	padding: 1rem;
}

.khsg-editor__slide-header {
	margin-bottom: 0.75rem;
}

.khsg-editor__slide-num {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #555;
	background: #f0f0f0;
	padding: 2px 10px;
	border-radius: 20px;
}

.khsg-editor__label {
	font-size: 0.72rem;
	font-weight: 600;
	color: #555;
	margin: 0 0 0.4rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Background image area */
.khsg-editor__slide-bg {
	margin-bottom: 1rem;
}

.khsg-editor__bg-wrap {
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
}

.khsg-editor__bg-thumb {
	display: block;
	width: 100%;
	height: 100px;
	object-fit: cover;
}

.khsg-editor__bg-actions {
	display: flex;
	gap: 6px;
	padding: 6px;
	background: rgba( 0, 0, 0, 0.04 );
}

.khsg-editor__add-bg {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100% !important;
	height: 80px;
	border: 2px dashed #ccc !important;
	border-radius: 4px;
	background: #fafafa !important;
	color: #888 !important;
	font-size: 0.82rem !important;
	cursor: pointer;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.khsg-editor__add-bg:hover {
	background: #f0f0f0 !important;
	border-color: #aaa !important;
}

/* Text field spacing inside each slide */
.khsg-editor__slide-fields .components-base-control {
	margin-bottom: 0.65rem;
}

.khsg-editor__slide-fields .components-base-control:last-child {
	margin-bottom: 0;
}
