/**
 * Video Tour Gallery styles
 */

/* ---------------------------------------------------------------
 * Button reset for our interactive controls.
 * Uses button.cew-vtg__* selectors (element + class) to outweigh
 * generic theme/Elementor `button { ... }` declarations.
 * Covers all states (hover/focus/active/visited/disabled) because
 * many themes target :hover / :focus separately.
 * --------------------------------------------------------------- */
button.cew-vtg__nav,
button.cew-vtg__nav:hover,
button.cew-vtg__nav:focus,
button.cew-vtg__nav:focus-visible,
button.cew-vtg__nav:active,
button.cew-vtg__thumb,
button.cew-vtg__thumb:hover,
button.cew-vtg__thumb:focus,
button.cew-vtg__thumb:focus-visible,
button.cew-vtg__thumb:active,
button.cew-vtg__thumb-pager-dot,
button.cew-vtg__thumb-pager-dot:hover,
button.cew-vtg__thumb-pager-dot:focus,
button.cew-vtg__thumb-pager-dot:focus-visible,
button.cew-vtg__thumb-pager-dot:active {
	background: transparent;
	background-color: transparent;
	background-image: none;
	border: 0;
	box-shadow: none;
	text-shadow: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.cew-vtg {
	background-color: #1a1a1a;
	color: #fff;
	padding: 40px 20px;
	box-sizing: border-box;
}

.cew-vtg *,
.cew-vtg *::before,
.cew-vtg *::after {
	box-sizing: border-box;
}

.cew-vtg__heading {
	text-align: center;
	margin: 0 0 24px;
	color: #fff;
	max-width: 100%;
	text-wrap: auto;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

/* ---------- Main video row ----------
 *
 * CSS Grid layout. The video player and the two arrow buttons sit on
 * row 1, the caption spans the middle column on row 2. Because the
 * arrows live on row 1 only (not row 2), align-items:center on the
 * arrows centers them against the player height, NOT against the
 * full player+caption height. This is the desired behavior on
 * desktop. On mobile the layout flips so arrows align with the
 * caption row instead (see the @media block below).
 */

.cew-vtg__main {
	display: grid;
	grid-template-columns: auto 1fr auto;
	grid-template-areas:
		"prev player next"
		".    caption    .";
	column-gap: 16px;
	row-gap: 0;
	max-width: 1100px;
	margin: 0 auto;
	align-items: center;
}

.cew-vtg__main > .cew-vtg__nav--prev {
	grid-area: prev;
}

.cew-vtg__main > .cew-vtg__player {
	grid-area: player;
}

.cew-vtg__main > .cew-vtg__nav--next {
	grid-area: next;
}

.cew-vtg__main > .cew-vtg__caption {
	grid-area: caption;
}

.cew-vtg__nav {
	color: #c9a961;
	cursor: pointer;
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.cew-vtg__nav:hover {
	opacity: 0.75;
	transform: scale( 1.05 );
}

.cew-vtg__nav:focus-visible {
	outline: 2px solid #c9a961;
	outline-offset: 4px;
}

.cew-vtg__player {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #2a2a2a;
	overflow: hidden;
}

.cew-vtg__player iframe,
.cew-vtg__iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

.cew-vtg__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #888;
	font-size: 14px;
	text-align: center;
	padding: 16px;
}

.cew-vtg__caption {
	text-align: center;
	margin-top: 14px;
	padding: 0 8px;
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.cew-vtg__caption > * {
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.cew-vtg__subtitle {
	color: #c9a961;
	margin-bottom: 6px;
	/* Wrapping safety - ensure long titles wrap inside their container. */
	max-width: 100%;
	min-width: 0;
	text-wrap: auto;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

.cew-vtg__title {
	color: #fff;
	max-width: 100%;
	min-width: 0;
	text-wrap: auto;
	overflow-wrap: break-word;
	word-wrap: break-word;
}

/* ---------- Thumbnails ---------- */

.cew-vtg__thumbs {
	max-width: 1100px;
	margin: 28px auto 0;
	/* Indent so thumbnails align with the main video, not the arrows. */
	padding: 0 56px;
}

.cew-vtg__thumbs-grid {
	display: grid;
	/* minmax(0, 1fr) forces equal column widths regardless of content
	   length. Plain "1fr" is equivalent to "minmax(auto, 1fr)" which
	   allows columns with longer titles to grow wider than their siblings. */
	grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	gap: 16px;
}

.cew-vtg__thumb {
	padding: 0;
	margin: 0;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 10px;
	/* Prevent grid item from overflowing its column track when content
	   is wider than the column. Pairs with minmax(0,1fr) on the grid. */
	min-width: 0;
	width: 100%;
	max-width: 100%;
}

.cew-vtg__thumb-caption,
.cew-vtg__thumb-caption > * {
	/* Force wrap inside the thumbnail column. min-width:0 + max-width:100%
	   defeats both the flex-item-min-content default and any inline-style
	   width that themes may inject. */
	min-width: 0;
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
	word-break: normal;
}

.cew-vtg__thumb:focus-visible {
	outline: 2px solid #c9a961;
	outline-offset: 4px;
}

.cew-vtg__thumb-image {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #2a2a2a;
	overflow: hidden;
	transition: opacity 0.15s ease;
}

.cew-vtg__thumb-image--empty {
	background: repeating-linear-gradient( 45deg, #2a2a2a, #2a2a2a 10px, #303030 10px, #303030 20px );
}

.cew-vtg__thumb-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cew-vtg__thumb-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.55 );
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, transform 0.15s ease;
}

.cew-vtg__thumb-play::before {
	content: "";
	display: block;
	width: 0;
	height: 0;
	margin-left: 4px;
	border-style: solid;
	border-width: 8px 0 8px 12px;
	border-color: transparent transparent transparent #fff;
}

.cew-vtg__thumb:hover .cew-vtg__thumb-image {
	opacity: 0.9;
}

.cew-vtg__thumb:hover .cew-vtg__thumb-play {
	background: rgba( 201, 169, 97, 0.9 );
	transform: translate( -50%, -50% ) scale( 1.05 );
}

.cew-vtg__thumb-caption {
	padding: 0 2px;
	background: transparent;
	background-color: transparent;
}

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

.cew-vtg__thumb-pager {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

button.cew-vtg__thumb-pager-dot {
	width: 10px;
	height: 10px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid #c9a961;
	background: transparent;
	cursor: pointer;
	transition: background 0.15s ease;
}

button.cew-vtg__thumb-pager-dot:hover {
	background: rgba( 201, 169, 97, 0.4 );
}

button.cew-vtg__thumb-pager-dot.is-active {
	background: #c9a961;
}

button.cew-vtg__thumb-pager-dot:focus-visible {
	outline: 2px solid #c9a961;
	outline-offset: 2px;
}

/* ---------- Empty state in editor ---------- */

.cew-vtg--empty {
	text-align: center;
	color: #aaa;
	padding: 40px 20px;
	border: 1px dashed #444;
}

/* ---------- Responsive ---------- */

@media ( max-width: 767px ) {
	/* Mobile arrow placement: arrows move to the caption row.
	   Player spans the full width of row 1; arrows + caption share row 2. */
	.cew-vtg__main {
		grid-template-columns: auto 1fr auto;
		grid-template-areas:
			".    player  ."
			"prev caption next";
		column-gap: 8px;
	}

	/* Player needs to span all three columns of row 1. */
	.cew-vtg__main > .cew-vtg__player {
		grid-column: 1 / -1;
	}

	.cew-vtg__nav {
		padding: 4px;
	}

	.cew-vtg__nav svg {
		width: 12px;
		height: 22px;
	}

	/* Thumbnails: 2 columns on tablet/mobile (under 768px). */
	.cew-vtg__thumbs {
		padding: 0 24px;
	}

	.cew-vtg__thumbs-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
		gap: 10px;
	}
}

@media ( max-width: 480px ) {
	.cew-vtg__thumbs {
		padding: 0 12px;
	}
}
