/* ==========================================================================
   SmugMug Embed – Front-end gallery  v2.1.0
   ========================================================================== */

/* ── Grid columns ──────────────────────────────────────────────────────────── */
.sme-gallery {
	display: grid;
	gap: 12px;
	margin: 0 0 1.5rem;
}

.sme-cols-1 { grid-template-columns: repeat(1, 1fr); }
.sme-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sme-cols-3 { grid-template-columns: repeat(3, 1fr); }
.sme-cols-4 { grid-template-columns: repeat(4, 1fr); }
.sme-cols-5 { grid-template-columns: repeat(5, 1fr); }
.sme-cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
	.sme-cols-4,
	.sme-cols-5,
	.sme-cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
	.sme-gallery { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
}

/* ── Gallery items ─────────────────────────────────────────────────────────── */
.sme-item {
	margin: 0;
	overflow: hidden;
	border-radius: 4px;
	background: transparent;
	display: block;
}

.sme-item a {
	display: block;
}

/* ── Thumbnails — base ─────────────────────────────────────────────────────── */
.sme-thumb {
	display: block;
	width: 100%;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Aspect ratios — explicit selectors, no CSS variable inheritance ─────────
   data-ratio is set by PHP directly on the .sme-gallery wrapper.
   Each rule targets .sme-gallery[data-ratio="X"] .sme-thumb so there is
   no ambiguity and no dependency on custom property inheritance.
   ──────────────────────────────────────────────────────────────────────── */

/* Square 1:1 (default) */
.sme-gallery[data-ratio="1-1"] .sme-thumb {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	height: auto;
}

/* Landscape 4:3 */
.sme-gallery[data-ratio="4-3"] .sme-thumb {
	aspect-ratio: 4 / 3;
	object-fit: cover;
	height: auto;
}

/* Widescreen 16:9 */
.sme-gallery[data-ratio="16-9"] .sme-thumb {
	aspect-ratio: 16 / 9;
	object-fit: cover;
	height: auto;
}

/* Portrait 3:4 */
.sme-gallery[data-ratio="3-4"] .sme-thumb {
	aspect-ratio: 3 / 4;
	object-fit: cover;
	height: auto;
}

/* Natural — no crop, image sets its own height */
.sme-gallery[data-ratio="auto"] .sme-thumb {
	aspect-ratio: auto;
	object-fit: contain;
	height: auto;
	width: 100%;
	background: #f0f0f0;
}

/* Fallback for galleries without data-ratio (old shortcodes) */
.sme-gallery:not([data-ratio]) .sme-thumb {
	aspect-ratio: 1 / 1;
	object-fit: cover;
	height: auto;
}

/* ── Hover effect ──────────────────────────────────────────────────────────── */
.sme-lightbox-trigger:hover .sme-thumb,
.sme-lightbox-trigger:focus .sme-thumb {
	transform: scale(1.04);
	opacity: 0.88;
}

/* ── Captions ──────────────────────────────────────────────────────────────── */
.sme-caption {
	padding: 6px 8px;
	font-size: 0.82em;
	line-height: 1.4;
	color: #555;
	background: rgba(255,255,255,0.92);
}

/* ── Empty / error states ──────────────────────────────────────────────────── */
.sme-gallery-empty,
.sme-error { color: #888; font-style: italic; padding: 12px 0; }
.sme-error  { color: #c00; }

/* ==========================================================================
   Lightbox
   ========================================================================== */
.sme-lb-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0,0,0,0.92);
	align-items: center;
	justify-content: center;
}

.sme-lb-overlay.sme-lb-active { display: flex; }

.sme-lb-inner {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: calc(100vw - 120px);
	max-height: calc(100vh - 80px);
}

/* Full-size image inside lightbox — NEVER crop, always contain */
.sme-lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 120px);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 3px;
	transition: opacity 0.2s ease;
}

.sme-lb-img.sme-lb-loading { opacity: 0.2; }

.sme-lb-size-info {
	position: absolute;
	bottom: -24px;
	right: 0;
	font-size: 11px;
	color: rgba(255,255,255,0.35);
	letter-spacing: .03em;
}

.sme-lb-caption {
	color: #ddd;
	margin: 10px 0 0;
	font-size: 0.9em;
	text-align: center;
	max-width: 680px;
	line-height: 1.5;
}

/* ── Lightbox navigation ───────────────────────────────────────────────────── */
.sme-lb-close,
.sme-lb-prev,
.sme-lb-next {
	position: fixed;
	background: rgba(255,255,255,0.12);
	border: none;
	color: #fff;
	cursor: pointer;
	border-radius: 50%;
	line-height: 1;
	transition: background 0.15s, transform 0.1s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sme-lb-close:hover,
.sme-lb-prev:hover,
.sme-lb-next:hover { background: rgba(255,255,255,0.28); }

.sme-lb-close {
	top: 16px; right: 16px;
	width: 44px; height: 44px; font-size: 24px;
}

.sme-lb-prev,
.sme-lb-next {
	top: 50%; transform: translateY(-50%);
	width: 52px; height: 52px; font-size: 34px;
}
.sme-lb-prev:hover { transform: translateY(-50%) scale(1.1); }
.sme-lb-next:hover { transform: translateY(-50%) scale(1.1); }

.sme-lb-prev { left: 16px; }
.sme-lb-next { right: 16px; }

.sme-lb-counter {
	position: fixed;
	top: 18px; left: 50%; transform: translateX(-50%);
	font-size: 12px; color: rgba(255,255,255,0.45);
	letter-spacing: .05em; pointer-events: none;
}

@media (max-width: 600px) {
	.sme-lb-inner { max-width: calc(100vw - 80px); }
	.sme-lb-prev  { left: 4px;  width: 38px; height: 38px; }
	.sme-lb-next  { right: 4px; width: 38px; height: 38px; }
}

/* ==========================================================================
   Directory listing — folder/album cards
   Styled to match an Avada-theme portfolio grid: rounded corners, subtle
   image zoom on hover, and a dark overlay revealing the title + a
   "View Folder" / "View Album" call-to-action.
   ========================================================================== */

.sme-directory .sme-item {
	position: relative;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Media wrapper — defines the card's box shape via aspect-ratio (driven
   by the same data-ratio attribute the image grid uses), clips the
   zoomed image to the rounded corners, and anchors the overlay. */
.sme-card-media {
	position: relative;
	overflow: hidden;
	border-radius: 6px;
	width: 100%;
	aspect-ratio: 1 / 1; /* fallback if data-ratio is somehow absent */
}

.sme-directory[data-ratio="1-1"]  .sme-card-media { aspect-ratio: 1 / 1; }
.sme-directory[data-ratio="4-3"]  .sme-card-media { aspect-ratio: 4 / 3; }
.sme-directory[data-ratio="16-9"] .sme-card-media { aspect-ratio: 16 / 9; }
.sme-directory[data-ratio="3-4"]  .sme-card-media { aspect-ratio: 3 / 4; }
.sme-directory[data-ratio="auto"] .sme-card-media { aspect-ratio: auto; }

.sme-card-media .sme-thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* "Natural" ratio: let the image set its own height, no cropping */
.sme-directory[data-ratio="auto"] .sme-card-media .sme-thumb {
	object-fit: contain;
	height: auto;
}

/* Placeholder block (no feature image found) sits inside the same
   media wrapper so the overlay positions identically either way. */
.sme-card-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: #2d3136;
	font-size: 2.5em;
	color: #aaa;
}


/* ── Hover overlay: dark wash + title + CTA, fades in on hover ── */
.sme-card-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 16px;
	gap: 8px;

	background: linear-gradient(
		to top,
		rgba(0,0,0,0.78) 0%,
		rgba(0,0,0,0.45) 55%,
		rgba(0,0,0,0.05) 100%
	);

	opacity: 0;
	transition: opacity 0.35s ease;
}

.sme-card-title {
	color: #fff;
	font-size: 1.05em;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.01em;
	text-shadow: 0 1px 3px rgba(0,0,0,0.5);

	/* Slight upward slide-in on hover, matching the Avada rollover feel */
	transform: translateY(8px);
	transition: transform 0.35s ease;
}

.sme-card-cta {
	display: inline-block;
	color: rgba(255,255,255,0.5);
	font-size: 0.78em;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 6px 16px;
	border: 1.5px solid rgba(255,255,255,0.5);
	border-radius: 2px;

	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.35s ease 0.05s, transform 0.35s ease 0.05s,
	            background 0.2s ease, color 0.2s ease;
}

/* ── Hover state: zoom image, reveal overlay + CTA, lift title ── */
.sme-item:hover .sme-thumb,
.sme-card-clickable:hover .sme-thumb,
.sme-card-clickable:focus-visible .sme-thumb {
	transform: scale(1.08);
}

.sme-item:hover .sme-card-overlay,
.sme-card-clickable:focus-visible .sme-card-overlay {
	opacity: 1;
}

.sme-item:hover .sme-card-title,
.sme-card-clickable:focus-visible .sme-card-title {
	transform: translateY(0);
}

.sme-item:hover .sme-card-cta,
.sme-card-clickable:focus-visible .sme-card-cta {
	opacity: 1;
	transform: translateY(0);
}

.sme-item:hover .sme-card-cta:hover {
	border: 1.5px solid #ff0000;
    color: #fff;
}

/* Clickable cards (browsable mode) get a pointer + keyboard focus ring */
.sme-card-clickable {
	cursor: pointer;
}
.sme-card-clickable:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 3px;
}

/* ==========================================================================
   Browsable mode — breadcrumb + loading state
   (Clickable card hover/zoom/focus styling lives in the directory-listing
   section above — .sme-card-clickable rules there already cover this.)
   ========================================================================== */

/* Breadcrumb */
.sme-breadcrumb {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0 0 14px;
	font-size: 12px;
	line-height: 1.6;
}

.sme-breadcrumb-link {
	color: #999;
	text-decoration: none;
}
.sme-breadcrumb-link:hover {
	text-decoration: none;
    border-bottom: solid 1.5px #B30000;
}

a:hover {
		color: #999 !important;
}

.sme-breadcrumb-current {
	color: #999;
}

.sme-breadcrumb-sep {
	color: rgba(255,255,255,0.5);
	margin: 0 2px;
}

/* Grid loading state during AJAX drill-down */
.sme-browsable-grid {
	transition: opacity 0.15s ease;
	min-height: 80px;
}
.sme-browsable-grid[aria-busy="true"] {
	pointer-events: none;
}
