/* ============================================================
   NEIL QUIGAO EVENT GALLERY — front-end styles
   ------------------------------------------------------------
   Neutral default theme, restylable entirely from Settings >
   Event Gallery > Custom CSS (loaded right after this file, so
   it overrides without needing !important — the couple of
   !important flags below exist only to defend against host-theme
   resets on native form elements, e.g. a global "input{width:100%}"
   rule most page builders ship with).

   SECTIONS
   1. Variables & reset
   2. Toolbar (heading, date filter, sort)
   3. Event grid / cards
   4. Single-event view (in-page, no modal/overlay)
   5. Photo grid
   6. Lightbox
   7. Transitions (list <-> view, lightbox slide)
   8. Responsive
   ============================================================ */

/* ---------- 1. VARIABLES & RESET ----------
   #nqeg-recent-gallery (the [nqeg_recent_gallery] homepage widget) shares
   the same variables/reset/card styles as #nqeg-gallery so it always
   matches whatever look is set below or in Settings > Custom CSS,
   without needing its own duplicate ruleset. */
#nqeg-gallery, #nqeg-recent-gallery {
	--nqeg-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--nqeg-heading-font: var(--nqeg-font);

	--nqeg-bg: transparent;
	--nqeg-surface: #ffffff;
	--nqeg-surface-hover: #f7f8fa;
	--nqeg-border: #e6e8eb;
	--nqeg-text: #16181d;
	--nqeg-muted: #6b7280;
	--nqeg-accent: #2563eb;
	--nqeg-accent-contrast: #ffffff;

	--nqeg-radius: 12px;
	--nqeg-radius-sm: 8px;
	--nqeg-gap: 20px;
	--nqeg-max-width: 1360px;
	--nqeg-shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 18px rgba(16,24,40,.06);
	--nqeg-shadow-hover: 0 4px 10px rgba(16,24,40,.06), 0 14px 28px rgba(16,24,40,.10);
	--nqeg-transition: .2s ease;

	background: var(--nqeg-bg);
	color: var(--nqeg-text);
	font-family: var(--nqeg-font);
	max-width: var(--nqeg-max-width);
	margin-inline: auto;
	padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 28px);
}
#nqeg-gallery, #nqeg-gallery *, #nqeg-gallery *::before, #nqeg-gallery *::after,
#nqeg-recent-gallery, #nqeg-recent-gallery *, #nqeg-recent-gallery *::before, #nqeg-recent-gallery *::after,
.nqeg-lightbox, .nqeg-lightbox *, .nqeg-lightbox *::before, .nqeg-lightbox *::after {
	box-sizing: border-box;
}
#nqeg-gallery ul { list-style: none; margin: 0; padding: 0; }
#nqeg-gallery img { max-width: 100%; display: block; }
#nqeg-gallery button { font-family: inherit; }

/* ---------- 2. TOOLBAR ---------- */
.nqeg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 22px;
}
.nqeg-toolbar-left { min-width: 0; }
.nqeg-eyebrow {
	display: block;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--nqeg-accent);
	margin-bottom: 4px;
}
.nqeg-heading {
	font-family: var(--nqeg-heading-font);
	font-size: clamp(20px, 2.4vw, 28px);
	font-weight: 700;
	margin: 0;
	color: var(--nqeg-text);
	line-height: 1.2;
}

/* Right-hand controls: fixed, compact widths so they sit neatly
   beside each other instead of stretching or stacking. */
.nqeg-toolbar-right {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.nqeg-datefilter-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
}
.nqeg-date-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	background: var(--nqeg-surface);
	border: 1px solid var(--nqeg-border);
	color: var(--nqeg-text);
	border-radius: var(--nqeg-radius-sm);
	padding: 11px 18px;
	height: 40px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: border-color var(--nqeg-transition), background var(--nqeg-transition);
}
.nqeg-date-trigger:hover {
	border-color: var(--nqeg-accent);
	background: var(--nqeg-surface-hover);
}
.nqeg-datefilter-icon {
	width: 18px;
	height: 18px;
	fill: var(--nqeg-accent);
	flex-shrink: 0;
}
.nqeg-date-label {
	white-space: nowrap;
}
/* The real <input type="date"> stays in the DOM (so the browser's native
   picker still works) but is visually hidden — the icon button above is
   what people actually see and click. */
.nqeg-date-hidden-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	pointer-events: none;
	border: 0;
	padding: 0;
}
.nqeg-date-clear {
	position: relative;
	margin-left: 4px;
	width: 22px;
	height: 22px;
	border: none;
	background: transparent;
	color: var(--nqeg-muted);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
	border-radius: 50%;
	display: none;
	flex-shrink: 0;
}
.nqeg-datefilter-wrap.has-value .nqeg-date-clear { display: block; }
.nqeg-date-clear:hover { background: var(--nqeg-surface-hover); color: var(--nqeg-text); }

#nqeg-sort {
	width: 132px !important;
	height: 40px;
	background: var(--nqeg-surface);
	border: 1px solid var(--nqeg-border);
	color: var(--nqeg-text);
	border-radius: var(--nqeg-radius-sm);
	padding: 10px 14px !important;
	font-size: 13px;
	font-weight: 500;
	outline: none;
	cursor: pointer;
	flex: 0 0 auto;
	transition: border-color var(--nqeg-transition);
}
#nqeg-sort:focus { border-color: var(--nqeg-accent); }

/* ---------- 3. EVENT GRID / CARDS ---------- */
.nqeg-grid {
	display: grid;
	grid-template-columns: repeat(var(--nqeg-columns, 4), minmax(0, 1fr));
	gap: var(--nqeg-gap);
}

.nqeg-card {
	background: var(--nqeg-surface);
	border: 1px solid var(--nqeg-border);
	border-radius: var(--nqeg-radius);
	overflow: hidden;
	cursor: pointer;
	box-shadow: var(--nqeg-shadow);
	transition: transform var(--nqeg-transition), box-shadow var(--nqeg-transition), border-color var(--nqeg-transition);
}
.nqeg-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--nqeg-shadow-hover);
	border-color: color-mix(in srgb, var(--nqeg-accent) 30%, var(--nqeg-border));
}

.nqeg-card-media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--nqeg-surface-hover);
	overflow: hidden;
}
/* Note: no hover zoom on the image by design — the card lift + overlay
   is the only hover feedback, kept deliberately calm. */
.nqeg-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.nqeg-count-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(20,20,24,.65);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	line-height: 1;
	padding: 7px 12px;
	border-radius: 999px;
	pointer-events: none;
	user-select: none;
	z-index: 1;
}

.nqeg-card-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(20,20,24,0);
	opacity: 0;
	pointer-events: none;
	user-select: none;
	transition: opacity var(--nqeg-transition), background var(--nqeg-transition);
}
.nqeg-card:hover .nqeg-card-overlay { opacity: 1; background: rgba(20,20,24,.35); }
.nqeg-view-btn {
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	color: var(--nqeg-accent-contrast);
	background: var(--nqeg-accent);
	padding: 12px 22px;
	border-radius: 999px;
}

.nqeg-card-body { padding: 16px 18px 18px !important; }
.nqeg-card-title {
	font-size: 14px;
	font-weight: 700;
	margin: 0 0 5px !important;
	color: var(--nqeg-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.nqeg-card-date { font-size: 12px; color: var(--nqeg-muted); font-weight: 500; }

.nqeg-empty {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--nqeg-muted);
	padding: 48px 0;
	font-size: 14px;
}

.nqeg-showmore-wrap {
	display: flex;
	justify-content: center;
	margin-top: 26px;
}
.nqeg-show-more {
	background: transparent;
	border: 1px solid var(--nqeg-border);
	color: var(--nqeg-text);
	font-size: 13px;
	font-weight: 600;
	padding: 11px 28px;
	border-radius: var(--nqeg-radius-sm);
	cursor: pointer;
	transition: background var(--nqeg-transition), border-color var(--nqeg-transition);
}
.nqeg-show-more:hover {
	background: var(--nqeg-surface-hover);
	border-color: var(--nqeg-accent);
}

/* ---------- 3b. RECENT-EVENTS WIDGET (homepage) ----------
   .nqeg-card is reused as-is (see section 3), just rendered as an <a>
   instead of a <div> since each card links straight to the gallery page. */
.nqeg-recent-card {
	display: block;
	text-decoration: none;
	color: inherit;
}
.nqeg-recent-footer {
	display: flex;
	justify-content: center;
	margin-top: 28px;
}
.nqeg-goto-gallery {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: var(--nqeg-accent);
	color: var(--nqeg-accent-contrast);
	border: none;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	padding: 13px 26px;
	border-radius: var(--nqeg-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: filter var(--nqeg-transition), transform .15s;
}
.nqeg-goto-gallery:hover { filter: brightness(1.08); }
.nqeg-goto-gallery:active { transform: scale(.97); }

/* ---------- 4. SINGLE-EVENT VIEW ----------
   No fixed overlay, no backdrop-filter — a normal block swapped
   in-place, cross-faded via .nqeg-fade-* helpers (see section 7). */
.nqeg-view[hidden] { display: none; }

.nqeg-view-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding-bottom: 14px;
	margin-bottom: 18px;
	border-bottom: 1px solid var(--nqeg-border);
}
.nqeg-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: transparent;
	border: 1px solid var(--nqeg-border);
	color: var(--nqeg-text);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	padding: 10px 16px;
	border-radius: var(--nqeg-radius-sm);
	cursor: pointer;
	transition: background var(--nqeg-transition), border-color var(--nqeg-transition);
	order: 1;
}
.nqeg-back-btn svg { width: 15px; height: 15px; fill: currentColor; }
.nqeg-back-btn:hover { background: var(--nqeg-surface-hover); border-color: var(--nqeg-muted); }

.nqeg-view-heading {
	order: 2;
	flex: 1;
	min-width: 200px;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 10px;
	padding: 2px 4px;
}
.nqeg-view-title { font-size: clamp(17px, 2vw, 20px); font-weight: 700; margin: 0; color: var(--nqeg-text); }
.nqeg-view-date {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--nqeg-muted);
}

.nqeg-download-all {
	order: 3;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: var(--nqeg-accent);
	color: var(--nqeg-accent-contrast);
	border: none;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	padding: 12px 20px;
	border-radius: var(--nqeg-radius-sm);
	cursor: pointer;
	transition: filter var(--nqeg-transition), transform .15s;
}
.nqeg-download-all svg { width: 15px; height: 15px; fill: currentColor; }
.nqeg-download-all:hover { filter: brightness(1.08); }
.nqeg-download-all:active { transform: scale(.97); }
.nqeg-download-all.nqeg-busy { pointer-events: none; opacity: .7; }
.nqeg-download-all.nqeg-busy .nqeg-dl-label::after { content: "…"; }

.nqeg-view-full-album {
	order: 4;
	display: inline-flex;
	align-items: center;
	gap: 9px;
	background: transparent;
	border: 1px solid var(--nqeg-border);
	color: var(--nqeg-text);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	padding: 12px 20px;
	border-radius: var(--nqeg-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: background var(--nqeg-transition), border-color var(--nqeg-transition);
}
.nqeg-view-full-album svg { width: 15px; height: 15px; fill: currentColor; }
.nqeg-view-full-album:hover { background: var(--nqeg-surface-hover); border-color: var(--nqeg-muted); }

.nqeg-loader {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 10px;
	color: var(--nqeg-muted);
	font-size: 13px;
	padding: 60px 0;
}
.nqeg-loader.nqeg-show { display: flex; }
.nqeg-loader-ring {
	width: 18px; height: 18px;
	border-radius: 50%;
	border: 2px solid var(--nqeg-border);
	border-top-color: var(--nqeg-accent);
	animation: nqeg-spin .7s linear infinite;
}
@keyframes nqeg-spin { to { transform: rotate(360deg); } }

/* ---------- 5. PHOTO GRID ---------- */
.nqeg-photo-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 12px;
}

.nqeg-photo {
	position: relative;
	aspect-ratio: 1;
	border-radius: var(--nqeg-radius-sm);
	overflow: hidden;
	cursor: pointer;
	background: var(--nqeg-surface-hover);
	opacity: 0;
	transform: translateY(8px);
	animation: nqeg-tile-in .38s cubic-bezier(.22,.8,.4,1) forwards;
}
/* Capped stagger: only the first screenful gets a delay so large
   galleries don't queue up long, janky sequential animations. */
.nqeg-photo:nth-child(1)  { animation-delay: .00s; }
.nqeg-photo:nth-child(2)  { animation-delay: .03s; }
.nqeg-photo:nth-child(3)  { animation-delay: .06s; }
.nqeg-photo:nth-child(4)  { animation-delay: .09s; }
.nqeg-photo:nth-child(5)  { animation-delay: .12s; }
.nqeg-photo:nth-child(6)  { animation-delay: .15s; }
.nqeg-photo:nth-child(n+7) { animation-delay: .18s; }
@keyframes nqeg-tile-in { to { opacity: 1; transform: translateY(0); } }

/* No hover zoom here either — image stays static, only the
   download affordance responds. */
.nqeg-photo img { width: 100%; height: 100%; object-fit: cover; }

.nqeg-photo-download {
	position: absolute;
	bottom: 8px;
	right: 8px;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: rgba(20,20,24,.6);
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity var(--nqeg-transition), background var(--nqeg-transition);
}
.nqeg-photo:hover .nqeg-photo-download { opacity: 1; }
.nqeg-photo-download:hover { background: var(--nqeg-accent); }
.nqeg-photo-download svg { width: 14px; height: 14px; fill: #fff; }

/* ---------- 6. LIGHTBOX ---------- */
.nqeg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility .2s ease;
	touch-action: pan-y;
}
.nqeg-lightbox.nqeg-open { opacity: 1; visibility: visible; }
.nqeg-lightbox-backdrop { position: absolute; inset: 0; background: rgba(10,10,12,.9); }

.nqeg-lightbox-img {
	position: relative;
	max-width: min(92vw, 1200px);
	max-height: 88vh;
	border-radius: 6px;
	opacity: 0;
	transition: opacity .18s ease, transform .22s cubic-bezier(.22,.8,.4,1);
}
.nqeg-lightbox.nqeg-open .nqeg-lightbox-img { opacity: 1; }
.nqeg-lightbox-img.nqeg-slide-next { animation: nqeg-slide-from-right .28s cubic-bezier(.22,.8,.4,1); }
.nqeg-lightbox-img.nqeg-slide-prev { animation: nqeg-slide-from-left .28s cubic-bezier(.22,.8,.4,1); }
@keyframes nqeg-slide-from-right { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes nqeg-slide-from-left  { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: translateX(0); } }

.nqeg-lightbox-close, .nqeg-lightbox-nav, .nqeg-lightbox-download {
	position: absolute;
	background: rgba(255,255,255,.1);
	border: 1px solid rgba(255,255,255,.18);
	color: #fff;
	cursor: pointer;
	transition: background .2s;
}
.nqeg-lightbox-close { top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; }
.nqeg-lightbox-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; font-size: 15px; }
.nqeg-lightbox-prev { left: 20px; }
.nqeg-lightbox-next { right: 20px; }
.nqeg-lightbox-download {
	bottom: 26px; left: 50%; transform: translateX(-50%);
	display: flex; align-items: center; gap: 8px;
	padding: 10px 20px; border-radius: 999px;
	font-size: 13px; font-weight: 600;
}
.nqeg-lightbox-download svg { width: 14px; height: 14px; fill: currentColor; }
.nqeg-lightbox-close:hover, .nqeg-lightbox-nav:hover, .nqeg-lightbox-download:hover { background: rgba(255,255,255,.22); }

/* ---------- 7. TRANSITIONS (list <-> single-event view) ----------
   A short cross-fade + slight rise, the same easing curve used
   throughout — this is what makes switching feel like a single
   smooth app rather than a page reflow. */
.nqeg-list-view,
.nqeg-view {
	transition: opacity .22s cubic-bezier(.22,.8,.4,1), transform .22s cubic-bezier(.22,.8,.4,1);
	opacity: 1;
	transform: translateY(0);
}
.nqeg-fade-out { opacity: 0; transform: translateY(6px); }
.nqeg-fade-in-start { opacity: 0; transform: translateY(6px); }

/* ---------- 8. RESPONSIVE ---------- */
@media (max-width: 900px) {
	.nqeg-grid { grid-template-columns: repeat(var(--nqeg-tablet-columns, 2), minmax(0, 1fr)); }
}
@media (max-width: 560px) {
	.nqeg-grid { grid-template-columns: repeat(var(--nqeg-mobile-columns, 1), minmax(0, 1fr)); }
	.nqeg-toolbar {
		margin-bottom: 30px; /* extra clearance once the controls wrap to their own row */
	}
	.nqeg-toolbar-right { flex-wrap: wrap; row-gap: 10px; }
	.nqeg-view-header { padding-bottom: 12px; }
	.nqeg-lightbox-prev { left: 10px; }
	.nqeg-lightbox-next { right: 10px; }
	.nqeg-lightbox-nav { width: 38px; height: 38px; }
}
