/* =Tiled Gallery Default Styles
-------------------------------------------------------------- */

.tiled-gallery {
	clear: both;
	margin: 0;
	overflow: hidden;
}
.tiled-gallery img {
	margin: 2px !important; /* Ensure that this value isn't overridden by themes that give content images blanket margins */
}
.tiled-gallery .gallery-group {
	float: left;
	position: relative;
}
.tiled-gallery .tiled-gallery-item {
	float: left;
	margin: 0;
	position: relative;
	width: inherit; /* prevents ie8 bug with inline width styles */
}
.tiled-gallery .gallery-row {
	 overflow: hidden;
	 margin-bottom: 2px;
}
.tiled-gallery .tiled-gallery-item a { /* Needs to reset some properties for theme compatibility */
	display: block;
	float: none !important;
	line-height: 0;
	background: transparent;
	border: none;
	color: none;
	margin: 0;
	padding: 0;
	text-decoration: none;
	width: auto;
}
.tiled-gallery .tiled-gallery-item img,
.tiled-gallery .tiled-gallery-item img:hover {
	width: 100%;
	height: auto;
 /* Needs to reset some properties for theme compatibility */
	background: none;
	border: none;
	box-shadow: none;
	max-width: 100%;
	padding: 0;
	vertical-align: middle;
	float: none !important; /* Prevent theme-wide image floats from breaking gallery tiles */
	display: block;
}
.tiled-gallery-caption { /* Captions */
	background: #eee;
	background: rgba( 255,255,255,0.8 );
	color: #333;
	font-size: 13px;
	font-weight: 400;
	overflow: hidden;
	padding: 10px 0;
	position: absolute;
		bottom: 0;
	text-indent: 10px;
	text-overflow: ellipsis;
	width: 100%;
	white-space: nowrap;
}
.tiled-gallery .tiled-gallery-item-small .tiled-gallery-caption { /* Smaller captions */
	font-size: 11px;
}


/* =Greyscale
-------------------------------------------------------------- */

.tiled-gallery .tiled-gallery-item img.grayscale {
	position: absolute;
		left: 0;
		top: 0;
}
.tiled-gallery .tiled-gallery-item img.grayscale:hover {
	opacity: 0;
}


/* =Circles Layout
-------------------------------------------------------------- */

.tiled-gallery.type-circle .tiled-gallery-item img {
	border-radius: 50% !important; /* Ensure that circles are displayed in themes that add border-radius to all images as a default */
}
.tiled-gallery.type-circle .tiled-gallery-caption {
	display: none;
	opacity: 0;
}
/* Theme isolation and responsive sizing (beta6).
 * Preserve the intrinsic PHP-generated row width so the resize script can
 * calculate a real scale ratio before adapting the mosaic to the content column.
 */
div.tiled-gallery,
.entry-content div.tiled-gallery,
.entry-summary div.tiled-gallery {
	width: auto;
	max-width: 100%;
	box-sizing: border-box;
	clear: both;
	overflow: hidden;
}

div.tiled-gallery .gallery-row {
	position: relative;
	float: none !important;
	max-width: none;
	box-sizing: border-box;
	margin-left: 0;
	margin-right: 0;
}

div.tiled-gallery .gallery-group {
	float: left !important;
	position: relative;
	max-width: none;
	box-sizing: border-box;
}

div.tiled-gallery .tiled-gallery-item {
	float: left !important;
	position: relative;
	max-width: none;
	box-sizing: border-box;
	margin: 0;
}

div.tiled-gallery .tiled-gallery-item > a {
	display: block !important;
	float: none !important;
	max-width: none;
	box-sizing: border-box;
}

div.tiled-gallery .tiled-gallery-item img,
div.tiled-gallery .tiled-gallery-item img:hover {
	float: none !important;
	display: block !important;
	width: 100%;
	height: auto;
	max-width: none !important;
	box-sizing: border-box;
}

/* Caption display modes configured in the plugin settings. */
.tiled-gallery.stgc-caption-always .tiled-gallery-caption { display: block !important; }
.tiled-gallery.stgc-caption-hide .tiled-gallery-caption { display: none !important; }


/*
 * beta9: enforce the selected caption mode in feed/archive galleries.
 * Some themes set caption display globally with !important; use scoped,
 * sufficiently specific rules so the plugin's feed setting takes precedence.
 * The hover mode is CSS-driven and remains available on single articles.
 */
div.tiled-gallery.stgc-caption-always div.tiled-gallery-caption {
	display: block !important;
	visibility: visible !important;
}
div.tiled-gallery.stgc-caption-hide div.tiled-gallery-caption {
	display: none !important;
	visibility: hidden !important;
}
div.tiled-gallery.stgc-caption-hover div.tiled-gallery-caption {
	display: none !important;
	visibility: hidden !important;
}
div.tiled-gallery.stgc-caption-hover div.tiled-gallery-item:hover div.tiled-gallery-caption,
div.tiled-gallery.stgc-caption-hover div.tiled-gallery-item:focus-within div.tiled-gallery-caption {
	display: block !important;
	visibility: visible !important;
}


/* beta10: keyboard focus and motion sensitivity. */
div.tiled-gallery .tiled-gallery-item > a:focus-visible {
	outline: 3px solid #2271b1;
	outline-offset: -3px;
	position: relative;
	z-index: 2;
}
@media (prefers-reduced-motion: reduce) {
	div.tiled-gallery .tiled-gallery-caption {
		transition: none !important;
		animation: none !important;
	}
}


/* beta13: optional restrained thumbnail hover effects. Disabled by default. */
div.tiled-gallery.stgc-hover-zoom .tiled-gallery-item > a,
div.tiled-gallery.stgc-hover-lift .tiled-gallery-item > a {
	overflow: hidden;
}
div.tiled-gallery.stgc-hover-zoom .tiled-gallery-item img,
div.tiled-gallery.stgc-hover-lift .tiled-gallery-item img {
	transition: transform 220ms ease, box-shadow 220ms ease;
	transform-origin: center center;
}
div.tiled-gallery.stgc-hover-zoom .tiled-gallery-item:hover img,
div.tiled-gallery.stgc-hover-zoom .tiled-gallery-item:focus-within img {
	transform: scale(1.045);
}
div.tiled-gallery.stgc-hover-lift .tiled-gallery-item:hover img,
div.tiled-gallery.stgc-hover-lift .tiled-gallery-item:focus-within img {
	transform: translateY(-3px);
	box-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}
@media (prefers-reduced-motion: reduce) {
	div.tiled-gallery.stgc-hover-zoom .tiled-gallery-item img,
	div.tiled-gallery.stgc-hover-lift .tiled-gallery-item img {
		transition: none !important;
		transform: none !important;
		box-shadow: none !important;
	}
}


/* beta14: optional portfolio presentation. It styles existing tile geometry
 * only; no dimensions are imposed, so the original Tiled layout stays intact.
 */
div.tiled-gallery.stgc-preset-portfolio {
	padding: 6px;
	background: #f7f7f7;
	box-sizing: border-box;
}
div.tiled-gallery.stgc-preset-portfolio .gallery-row {
	margin-bottom: 6px;
}
div.tiled-gallery.stgc-preset-portfolio .tiled-gallery-item img {
	border-radius: 3px;
}
div.tiled-gallery.stgc-preset-portfolio .tiled-gallery-caption {
	background: rgba( 20, 20, 20, 0.72 );
	color: #fff;
	font-size: 12px;
	padding: 8px 10px;
	text-indent: 0;
	box-sizing: border-box;
}


/* beta15: make hover-only captions discoverable on touch-first devices.
 * Touch screens have no reliable hover state; keep the caption visible so
 * users can identify a tile before opening it. Desktop hover behavior remains.
 */
@media (hover: none) {
	div.tiled-gallery.stgc-caption-hover div.tiled-gallery-caption {
		display: block !important;
		visibility: visible !important;
	}
}

/* beta15: stronger keyboard focus when users request increased contrast. */
@media (prefers-contrast: more) {
	div.tiled-gallery .tiled-gallery-item > a:focus-visible {
		outline: 4px solid currentColor;
		outline-offset: -4px;
	}
}

/* beta15: prevent the optional Portfolio frame from causing horizontal
 * overflow in narrow content columns. */
div.tiled-gallery.stgc-preset-portfolio {
	max-width: 100%;
}

/* beta17: Facebook-style remaining-photo counter on the final visible feed tile. */
/* beta18: deep-link resolution is handled in the carousel script. */
.tiled-gallery .tiled-gallery-item { position: relative; }
.tiled-gallery .stgc-more-photos-overlay {
	position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
	background: rgba(0, 0, 0, 0.58); color: #fff; font-size: clamp(20px, 3.5vw, 34px);
	font-weight: 600; line-height: 1; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.tiled-gallery .stgc-more-photos-overlay > span { display: block; }
