/**
 * Base gallery styles.
 *
 * @package    ACT_Gallery
 * @subpackage ACT_Gallery/public/css
 */

.act-gallery {
	display: block;
	margin: 0 auto;
	box-sizing: border-box;
	width: auto;
	max-width: 100%;
	overflow: visible;
	position: relative;
	z-index: 1;
	isolation: isolate; /* Create new stacking context */
}

/* Ensure main image gallery container properly contains all elements */
.act-gallery-main-image {
	margin-top: 0;
	margin-bottom: 0; /* No extra margin needed since arrows are inside container */
	overflow: visible; /* Allow arrows to be visible */
}

/* Focus styles for gallery container */
.act-gallery:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.act-gallery-container {
	display: grid;
	gap: 15px;
	width: 100%;
	box-sizing: border-box;
}

.act-gallery-item {
	position: relative;
	overflow: hidden;
	display: block;
	box-sizing: border-box;
}

.act-gallery-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.act-gallery-item img {
	max-width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease, opacity 0.3s ease, filter 0.3s ease;
	object-fit: cover;
}

.act-gallery-item:hover img {
	opacity: 0.9;
}

/* Focus styles for keyboard navigation */
.act-gallery-link:focus,
.act-gallery-item:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.act-gallery-link:focus img {
	opacity: 0.8;
}

/* Hover effect: Zoom */
.act-gallery-item img {
	overflow: hidden;
}

/* Hover effect: Shine */
.act-gallery-item.shine::after {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
	transition: left 0.5s ease;
}

.act-gallery-item.shine:hover::after {
	left: 100%;
}

.act-gallery-item-title,
.act-gallery-item-caption {
	padding: 10px;
	text-align: center;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	transform: translateY(100%);
	transition: transform 0.3s ease;
}

.act-gallery-item-caption {
	bottom: 40px;
	font-size: 0.9em;
	opacity: 0.9;
}

.act-gallery-item:hover .act-gallery-item-title,
.act-gallery-item:hover .act-gallery-item-caption {
	transform: translateY(0);
}

/* Title position: top */
.act-gallery-item-title.top {
	top: 0;
	bottom: auto;
	transform: translateY(-100%);
}

.act-gallery-item:hover .act-gallery-item-title.top {
	transform: translateY(0);
}

/* Title position: overlay */
.act-gallery-item-title.overlay {
	bottom: 0;
	transform: translateY(0);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.act-gallery-item:hover .act-gallery-item-title.overlay {
	opacity: 1;
}

