/* Drive Video Gallery — front end.
 * Inherits the theme's font and text colour so it fits any theme.
 * Everything is scoped under .gdvg / .gdvg-lb to avoid clashes. */

.gdvg {
	--gdvg-accent: #d62f3a;
	--gdvg-gap: clamp(14px, 2vw, 24px);
	--gdvg-radius: 14px;
	--gdvg-ease: cubic-bezier(.22, 1, .36, 1);
	position: relative;
	margin: 0 0 1.5em;
	font: inherit;
	color: inherit;
}

/* Theme-proof button reset (themes often style every <button>). */
.gdvg button,
.gdvg-lb button {
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	margin: 0;
	padding: 0;
	min-height: 0;
	width: auto;
	font: inherit;
	color: inherit;
	line-height: inherit;
	letter-spacing: normal;
	text-transform: none;
	text-align: inherit;
	cursor: pointer;
}
.gdvg button:focus-visible,
.gdvg-lb button:focus-visible {
	outline: 3px solid var(--gdvg-accent);
	outline-offset: 3px;
}

/* ---------- Header: counter + slider arrows ---------- */
.gdvg-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: calc(var(--gdvg-gap) * .9);
}
.gdvg-count {
	display: flex;
	align-items: baseline;
	gap: .5em;
	margin: 0;
}
.gdvg-count-num {
	font-size: clamp(2.2rem, 4vw, 3.25rem);
	font-weight: 700;
	line-height: 1;
	color: var(--gdvg-accent);
	font-variant-numeric: tabular-nums;
}
.gdvg-count-label {
	font-size: 1rem;
	opacity: .75;
}

.gdvg-arrows { display: flex; gap: 8px; margin-left: auto; }
.gdvg .gdvg-arrow {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1.5px solid currentColor;
	opacity: .8;
	transition: background-color .25s, color .25s, border-color .25s, opacity .25s;
}
.gdvg .gdvg-arrow:hover:not(:disabled) {
	background: var(--gdvg-accent);
	border-color: var(--gdvg-accent);
	color: #fff;
	opacity: 1;
}
.gdvg .gdvg-arrow:disabled { opacity: .25; cursor: default; }

/* ---------- Grid ---------- */
.gdvg--grid .gdvg-track {
	display: grid;
	grid-template-columns: repeat(var(--gdvg-cols), minmax(0, 1fr));
	gap: var(--gdvg-gap);
}
@media (max-width: 1024px) {
	.gdvg--grid .gdvg-track { grid-template-columns: repeat(var(--gdvg-cols-t), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.gdvg--grid .gdvg-track { grid-template-columns: repeat(var(--gdvg-cols-m), minmax(0, 1fr)); }
}

/* ---------- Slider ---------- */
.gdvg--slider .gdvg-track {
	--gdvg-c: var(--gdvg-cols);
	display: flex;
	gap: var(--gdvg-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	padding-bottom: 4px;
}
.gdvg--slider .gdvg-track::-webkit-scrollbar { display: none; }
.gdvg--slider .gdvg-item {
	flex: 0 0 calc((100% - var(--gdvg-gap) * (var(--gdvg-c) - 1)) / var(--gdvg-c));
	scroll-snap-align: start;
}
@media (max-width: 1024px) { .gdvg--slider .gdvg-track { --gdvg-c: var(--gdvg-cols-t); } }
@media (max-width: 600px) {
	.gdvg--slider .gdvg-track { --gdvg-c: 1; }
	.gdvg--slider .gdvg-item { flex-basis: 86%; }
}

/* ---------- Card ---------- */
.gdvg .gdvg-item {
	display: block;
	width: 100%;
	min-width: 0;
}
.gdvg .gdvg-item[hidden] { display: none !important; }

.gdvg-card { display: block; }

.gdvg-thumb {
	position: relative;
	display: block;
	aspect-ratio: 16 / 9;
	border-radius: var(--gdvg-radius);
	overflow: hidden;
	background: #e9edf1;
	background: color-mix(in srgb, var(--gdvg-accent) 12%, #e9edf1);
	isolation: isolate;
}
.gdvg-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	margin: 0;
	border-radius: 0;
	transition: transform .7s var(--gdvg-ease);
}
.gdvg-thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(10, 20, 30, .35), rgba(10, 20, 30, 0) 55%);
	opacity: .8;
	transition: opacity .4s;
}

/* The play control is the one bold element: a solid accent disc with a soft ring. */
.gdvg-play {
	position: absolute;
	z-index: 1;
	left: 50%;
	top: 50%;
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border-radius: 50%;
	background: var(--gdvg-accent);
	color: #fff;
	box-shadow: 0 0 0 8px rgba(255, 255, 255, .25);
	box-shadow: 0 0 0 8px color-mix(in srgb, var(--gdvg-accent) 28%, transparent);
	transition: transform .45s var(--gdvg-ease), box-shadow .45s var(--gdvg-ease);
}
.gdvg-play svg { width: 26px; height: 26px; margin-left: 3px; }

.gdvg-item:hover .gdvg-thumb img,
.gdvg-item:focus-visible .gdvg-thumb img { transform: scale(1.05); }
.gdvg-item:hover .gdvg-play,
.gdvg-item:focus-visible .gdvg-play {
	transform: scale(1.1);
	box-shadow: 0 0 0 14px color-mix(in srgb, var(--gdvg-accent) 22%, transparent);
}
.gdvg-item:hover .gdvg-thumb::after { opacity: 1; }

.gdvg-title {
	display: block;
	margin-top: .7em;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

/* ---------- Entrance animations (only once JS is running, so nothing hides without JS or in editors) ---------- */
.gdvg-js[data-anim="fade-up"] .gdvg-item { opacity: 0; transform: translateY(28px); }
.gdvg-js[data-anim="zoom"] .gdvg-item    { opacity: 0; transform: scale(.92); }
.gdvg-js[data-anim="fade"] .gdvg-item    { opacity: 0; }
.gdvg-js .gdvg-item {
	transition: opacity .7s var(--gdvg-ease), transform .7s var(--gdvg-ease);
	transition-delay: var(--gdvg-delay, 0ms);
}
.gdvg-js .gdvg-item.gdvg-in { opacity: 1; transform: none; }

/* ---------- Pagination ---------- */
.gdvg-pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: calc(var(--gdvg-gap) * 1.3);
}
.gdvg-pager[hidden] { display: none; }
.gdvg .gdvg-page {
	min-width: 42px;
	height: 42px;
	padding: 0 12px;
	border-radius: 21px;
	text-align: center;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	transition: background-color .25s, color .25s;
}
.gdvg .gdvg-page:hover:not(:disabled):not([aria-current]) { background: color-mix(in srgb, var(--gdvg-accent) 12%, transparent); }
.gdvg .gdvg-page[aria-current="page"] { background: var(--gdvg-accent); color: #fff; }
.gdvg .gdvg-page:disabled { opacity: .3; cursor: default; }
.gdvg .gdvg-page svg { vertical-align: middle; }

.gdvg-notice {
	padding: 12px 16px;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #1d2327;
	font-size: 14px;
}

/* =========================================================
   Lightbox
   ========================================================= */
.gdvg-lb {
	--gdvg-accent: #d62f3a;
	--gdvg-ease: cubic-bezier(.22, 1, .36, 1);
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
	color: #f2f5f8;
	font-family: inherit;
	opacity: 0;
	visibility: hidden;
	transition: opacity .35s var(--gdvg-ease), visibility 0s linear .35s;
}
.gdvg-lb.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity .35s var(--gdvg-ease), visibility 0s;
}
.gdvg-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(9, 18, 28, .92);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.gdvg-lb-inner {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: min(1180px, 100%);
	max-height: 100%;
	padding: 16px clamp(12px, 3vw, 28px);
	transform: translateY(16px) scale(.98);
	transition: transform .45s var(--gdvg-ease);
}
.gdvg-lb.is-open .gdvg-lb-inner { transform: none; }

.gdvg-lb-top {
	display: flex;
	align-items: center;
	gap: 16px;
}
.gdvg-lb-counter {
	display: inline-flex;
	align-items: baseline;
	gap: 4px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.gdvg-lb-cur {
	display: inline-block;
	font-size: 1.6rem;
	font-weight: 700;
	color: #fff;
	line-height: 1;
}
.gdvg-lb-total { opacity: .6; }
.gdvg-lb-title {
	flex: 1;
	min-width: 0;
	font-size: 1rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.gdvg-lb .gdvg-lb-close,
.gdvg-lb .gdvg-lb-nav {
	display: grid;
	place-items: center;
	flex: none;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	transition: background-color .25s, transform .25s var(--gdvg-ease);
}
.gdvg-lb .gdvg-lb-close:hover,
.gdvg-lb .gdvg-lb-nav:hover { background: var(--gdvg-accent); }
.gdvg-lb .gdvg-lb-nav:active { transform: scale(.94); }

.gdvg-lb-stage {
	display: flex;
	align-items: center;
	gap: 14px;
}
.gdvg-lb-frame {
	position: relative;
	flex: 1;
	min-width: 0;
	aspect-ratio: 16 / 9;
	max-height: calc(100vh - 220px);
	max-height: calc(100dvh - 220px);
	margin: 0 auto;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.gdvg-lb-frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	opacity: 0;
	transition: opacity .4s;
}
.gdvg-lb-frame.is-loaded iframe { opacity: 1; }
.gdvg-lb-spinner {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 42px;
	height: 42px;
	margin: -21px 0 0 -21px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: var(--gdvg-accent);
	animation: gdvg-spin .8s linear infinite;
}
.gdvg-lb-frame.is-loaded .gdvg-lb-spinner { display: none; }
@keyframes gdvg-spin { to { transform: rotate(360deg); } }

.gdvg-lb-thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: thin;
	padding: 4px 2px;
	justify-content: safe center;
}
.gdvg-lb .gdvg-lb-thumb {
	flex: 0 0 auto;
	width: 104px;
	aspect-ratio: 16 / 9;
	border-radius: 8px;
	overflow: hidden;
	opacity: .45;
	outline: 2px solid transparent;
	outline-offset: 2px;
	transition: opacity .25s, outline-color .25s;
}
.gdvg-lb .gdvg-lb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; max-width: none; }
.gdvg-lb .gdvg-lb-thumb:hover { opacity: .8; }
.gdvg-lb .gdvg-lb-thumb[aria-current="true"] { opacity: 1; outline-color: var(--gdvg-accent); }

@media (max-width: 700px) {
	.gdvg-lb-stage { position: relative; }
	.gdvg-lb .gdvg-lb-nav {
		position: absolute;
		z-index: 2;
		top: auto;
		bottom: -62px;
	}
	.gdvg-lb .gdvg-lb-prev { left: 0; }
	.gdvg-lb .gdvg-lb-next { right: 0; }
	.gdvg-lb-inner { gap: 12px; }
	.gdvg-lb-thumbs { margin: 0 56px; }
	.gdvg-lb .gdvg-lb-thumb { width: 76px; }
	.gdvg-lb-frame { max-height: calc(100dvh - 200px); }
}

html.gdvg-lock,
html.gdvg-lock body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
	.gdvg *, .gdvg-lb, .gdvg-lb * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
	.gdvg-js .gdvg-item { opacity: 1 !important; transform: none !important; }
	.gdvg--slider .gdvg-track { scroll-behavior: auto; }
}
