/* 3pika Gallery – front-end styles (v2) */

.tpg-gallery {
	--tpg-cols: 3;
	--tpg-cols-t: 2;
	--tpg-cols-m: 2;
	--tpg-gap: 10px;
	--tpg-radius: 6px;
	--tpg-accent: #2271b1;
	--tpg-row-h: 220px;
	--tpg-text: #1d2327;
	--tpg-muted: #646970;
	--tpg-line: rgba(0, 0, 0, .12);
	position: relative;
	box-sizing: border-box;
	margin: 0 0 1.5em;
	font-size: 15px;
	line-height: 1.4;
}
.tpg-gallery *, .tpg-gallery *::before, .tpg-gallery *::after { box-sizing: border-box; }
.tpg-notice { padding: 10px 14px; background: #fcf9e8; border-left: 4px solid #dba617; font-size: 14px; border-radius: 6px; }

/* ---------- Filters ---------- */
.tpg-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; align-items: center; }
.tpg-align-left .tpg-filters { justify-content: flex-start; }
.tpg-align-center .tpg-filters { justify-content: center; }
.tpg-align-right .tpg-filters { justify-content: flex-end; }

.tpg-filter-btn {
	--c: var(--tpg-filter-color, var(--tpg-accent));
	appearance: none;
	background: transparent;
	border: 1px solid var(--tpg-line);
	color: var(--tpg-text);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	padding: 8px 18px;
	border-radius: 10px;
	cursor: pointer;
	transition: background .2s, color .2s, border-color .2s, box-shadow .2s, transform .15s;
	line-height: 1.3;
	display: inline-flex;
	align-items: center;
	gap: 7px;
}
.tpg-filter-btn:hover { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent); }
.tpg-filter-btn:active { transform: translateY(1px); }
.tpg-filter-btn:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
.tpg-filter-btn.is-active { background: var(--c); border-color: var(--c); color: var(--tpg-filter-text, var(--tpg-accent-text, #fff)); box-shadow: 0 6px 16px -8px var(--c); }
.tpg-count { font-size: 11px; font-weight: 700; opacity: .75; background: rgba(0, 0, 0, .08); padding: 1px 7px; border-radius: 999px; line-height: 1.5; }
.tpg-filter-btn.is-active .tpg-count { background: rgba(127, 127, 127, .28); opacity: 1; }

.tpg-filters-pills .tpg-filter-btn { border-radius: 999px; padding: 8px 20px; }
.tpg-filters-underline .tpg-filter-btn { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 4px; margin: 0 10px; background: transparent !important; color: var(--tpg-text); box-shadow: none; }
.tpg-filters-underline .tpg-filter-btn.is-active { color: var(--c); border-bottom-color: var(--c); }
.tpg-filter-select { font: inherit; font-size: 14px; font-weight: 500; padding: 9px 40px 9px 14px; border: 1px solid var(--tpg-line); border-radius: 10px; background: #fff; min-width: 200px; color: var(--tpg-text); }
.tpg-filter-select:focus { outline: 2px solid var(--tpg-accent); outline-offset: 1px; }

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

.tpg-item { margin: 0; padding: 0; min-width: 0; opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; }
.tpg-item.is-hidden { display: none; }
.tpg-item.is-entering { opacity: 0; transform: scale(.96); }
.tpg-item-inner { position: relative; overflow: hidden; border-radius: var(--tpg-radius); background: #eceded; }
.tpg-link { display: block; position: relative; text-decoration: none; color: inherit; outline: none; }
.tpg-link:focus-visible { box-shadow: 0 0 0 3px var(--tpg-accent); }
.tpg-link img { display: block; width: 100%; height: auto; margin: 0; border: 0; border-radius: 0; }
.tpg-caption { font-size: 13px; color: var(--tpg-muted); padding: 9px 2px 0; text-align: center; line-height: 1.4; }

/* Aspect ratios (grid layout only) */
.tpg-layout-grid.tpg-aspect-square .tpg-link img   { aspect-ratio: 1 / 1;  object-fit: cover; }
.tpg-layout-grid.tpg-aspect-4-3 .tpg-link img      { aspect-ratio: 4 / 3;  object-fit: cover; }
.tpg-layout-grid.tpg-aspect-3-2 .tpg-link img      { aspect-ratio: 3 / 2;  object-fit: cover; }
.tpg-layout-grid.tpg-aspect-16-9 .tpg-link img     { aspect-ratio: 16 / 9; object-fit: cover; }
.tpg-layout-grid.tpg-aspect-3-4 .tpg-link img      { aspect-ratio: 3 / 4;  object-fit: cover; }



/* Caption overlay (on hover) */
.tpg-overlay {
	position: absolute; inset: 0; display: flex; align-items: flex-end; padding: 16px;
	background: linear-gradient(to top, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0) 60%);
	color: #fff; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.tpg-overlay-text { font-size: 14px; font-weight: 600; line-height: 1.35; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.tpg-item:hover .tpg-overlay, .tpg-link:focus-visible .tpg-overlay { opacity: 1; }
@media (hover: none) { .tpg-caption-hover .tpg-overlay { opacity: 1; } }

/* ---------- Hover effects ---------- */
.tpg-link img { transition: transform .6s cubic-bezier(.2, .8, .2, 1), opacity .35s, filter .4s; }
.tpg-hover-zoom .tpg-item:hover img { transform: scale(1.08); }
.tpg-hover-fade .tpg-item:hover img { opacity: .7; }


/* ---------- Pagination ---------- */
.tpg-pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 26px; }
.tpg-pagination:empty { display: none; }
.tpg-page-btn {
	appearance: none; font: inherit; font-size: 14px; font-weight: 600; min-width: 40px; height: 40px; padding: 0 12px;
	border: 1px solid var(--tpg-line); background: #fff; color: var(--tpg-text); border-radius: 10px; cursor: pointer;
	transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.tpg-page-btn:hover { border-color: var(--tpg-accent); color: var(--tpg-accent); }
.tpg-page-btn:active { transform: translateY(1px); }
.tpg-page-btn.is-active { background: var(--tpg-accent); border-color: var(--tpg-accent); color: var(--tpg-accent-text, #fff); }
.tpg-page-btn:disabled { opacity: .4; cursor: default; transform: none; }
.tpg-page-ellipsis { padding: 0 4px; color: var(--tpg-muted); }
.tpg-loadmore { padding: 0 30px; height: 46px; border-radius: 999px; font-weight: 700; background: var(--tpg-accent); color: var(--tpg-accent-text, #fff); border-color: var(--tpg-accent); box-shadow: 0 8px 20px -10px var(--tpg-accent); }
.tpg-loadmore:hover { color: var(--tpg-accent-text, #fff); filter: brightness(1.08); }
@keyframes tpg-spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.tpg-lb {
	position: fixed; inset: 0; z-index: 999999; background: rgba(8, 8, 10, .95);
	display: flex; align-items: center; justify-content: center;
	opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
	-webkit-tap-highlight-color: transparent; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #fff;
}
.tpg-lb.is-open { opacity: 1; visibility: visible; }
body.tpg-lb-open { overflow: hidden; }
.tpg-lb-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.tpg-lb-slide { position: relative; max-width: calc(100vw - 32px); max-height: calc(100vh - 120px); display: flex; align-items: center; justify-content: center; }
.tpg-lb-slide img { display: block; max-width: calc(100vw - 32px); max-height: calc(100vh - 120px); width: auto; height: auto; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); cursor: default; transition: transform .35s cubic-bezier(.2, .8, .2, 1); transform-origin: center; }
.tpg-lb-slide.is-loading::before { content: ""; position: absolute; width: 40px; height: 40px; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; border-radius: 50%; animation: tpg-spin .8s linear infinite; }
.tpg-lb-slide.is-loading img { opacity: 0; }
.tpg-lb-slide.is-anim { animation: tpg-lb-in .3s ease; }
@keyframes tpg-lb-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.tpg-lb-btn { appearance: none; background: rgba(255, 255, 255, .1); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .08); color: #fff; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s, transform .2s; padding: 0; }
.tpg-lb-btn:hover { background: rgba(255, 255, 255, .22); }
.tpg-lb-btn:active { transform: scale(.95); }
.tpg-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tpg-lb-btn svg { display: block; }
.tpg-lb-close { position: absolute; top: 14px; right: 14px; z-index: 3; }
.tpg-lb-prev, .tpg-lb-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 54px; height: 54px; }
.tpg-lb-prev:active, .tpg-lb-next:active { transform: translateY(-50%) scale(.95); }
.tpg-lb-prev { left: 16px; } .tpg-lb-next { right: 16px; }
.tpg-lb.is-single .tpg-lb-prev, .tpg-lb.is-single .tpg-lb-next { display: none; }
.tpg-lb-counter { position: absolute; top: 22px; left: 20px; font-size: 13px; font-weight: 600; opacity: .85; z-index: 3; letter-spacing: .06em; background: rgba(255, 255, 255, .1); padding: 6px 12px; border-radius: 999px; backdrop-filter: blur(8px); }
.tpg-lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 70px 24px; text-align: center; font-size: 15px; line-height: 1.45; background: linear-gradient(to top, rgba(0, 0, 0, .65), rgba(0, 0, 0, 0)); z-index: 2; pointer-events: none; }
.tpg-lb-caption:empty { display: none; }
.tpg-lb-caption a { color: #fff; pointer-events: auto; margin-left: 10px; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 767px) {
	.tpg-lb-prev, .tpg-lb-next { width: 44px; height: 44px; background: rgba(0, 0, 0, .4); }
	.tpg-lb-prev { left: 8px; } .tpg-lb-next { right: 8px; }
	.tpg-lb-caption { padding: 12px 16px 18px; font-size: 14px; }
	.tpg-lb-close { top: 10px; right: 10px; }
	.tpg-lb-counter { top: 14px; left: 12px; font-size: 12px; }
	.tpg-filter-btn { font-size: 13px; padding: 7px 14px; }
}

/* ---------- Filter styles (v2) ---------- */
.tpg-filter-btn.is-active { box-shadow: none; }
.tpg-filter-shadow .tpg-filter-btn.is-active { box-shadow: 0 8px 18px -8px var(--c); }
.tpg-filters-square .tpg-filter-btn { border-radius: 0; }
.tpg-filters-soft .tpg-filter-btn { border-color: transparent; background: rgba(0, 0, 0, .055); border-radius: 10px; }
.tpg-filters-soft .tpg-filter-btn:hover { background: color-mix(in srgb, var(--c) 12%, transparent); }
.tpg-filters-soft .tpg-filter-btn.is-active { background: var(--c); color: var(--tpg-filter-text, var(--tpg-accent-text, #fff)); }
.tpg-filters-outline .tpg-filter-btn { border: 2px solid var(--tpg-line); border-radius: 999px; background: transparent; }
.tpg-filters-outline .tpg-filter-btn:hover { border-color: var(--c); background: transparent; }
.tpg-filters-outline .tpg-filter-btn.is-active { background: transparent; border-color: var(--c); color: var(--c); box-shadow: none; }
.tpg-filters-outline .tpg-filter-btn.is-active .tpg-count { background: var(--c); color: var(--tpg-filter-text, var(--tpg-accent-text, #fff)); opacity: 1; }
.tpg-filters-text .tpg-filter-btn { border: 0; background: transparent !important; padding: 6px 10px; color: var(--tpg-muted); box-shadow: none; }
.tpg-filters-text .tpg-filter-btn:hover { color: var(--tpg-text); }
.tpg-filters-text .tpg-filter-btn.is-active { color: var(--c); font-weight: 700; }
.tpg-filters-text .tpg-filter-btn .tpg-count { background: rgba(0, 0, 0, .08); color: inherit; }
/* Underline and text-only are plain text: never a box, background or shadow (also beats theme button styles). */
.tpg-gallery.tpg-filters-underline .tpg-filter-btn, .tpg-gallery.tpg-filters-underline .tpg-filter-btn.is-active,
.tpg-gallery.tpg-filters-text .tpg-filter-btn, .tpg-gallery.tpg-filters-text .tpg-filter-btn.is-active { box-shadow: none !important; background: transparent !important; border-radius: 0; }
.tpg-gallery.tpg-filters-text .tpg-filter-btn { border: 0 !important; }
.tpg-gallery.tpg-filters-underline .tpg-filter-btn { border-width: 0 0 2px !important; }
.tpg-gallery.tpg-filters-underline .tpg-filter-btn:focus { color: var(--tpg-text); }
.tpg-gallery.tpg-filters-text .tpg-filter-btn:focus { color: var(--tpg-muted); }
.tpg-gallery.tpg-filters-text .tpg-filter-btn:hover { color: var(--tpg-text); }
.tpg-gallery.tpg-filters-underline .tpg-filter-btn:hover, .tpg-gallery.tpg-filters-underline .tpg-filter-btn.is-active, .tpg-gallery.tpg-filters-text .tpg-filter-btn.is-active { color: var(--c); }

/* ---------- Filter dropdown (custom menu, the native select stays hidden inside for forms / no-JS) ---------- */
.tpg-fdd { position: relative; display: inline-block; min-width: 220px; max-width: 100%; text-align: left; vertical-align: middle; }
.tpg-fdd > select { position: absolute !important; left: 0; top: 0; width: 1px !important; min-width: 0 !important; height: 1px !important; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.tpg-gallery .tpg-fdd-btn, .tpg-gallery .tpg-fdd-btn:hover, .tpg-gallery .tpg-fdd-btn:focus, .tpg-gallery .tpg-fdd-btn:active {
	appearance: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 44px; margin: 0; padding: 9px 14px 9px 16px;
	border: 1px solid var(--tpg-line); border-radius: 10px; background: #fff; color: var(--tpg-text);
	font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; letter-spacing: 0; text-transform: none; text-align: left; text-decoration: none;
	cursor: pointer; box-shadow: none; outline: none; transition: border-color .2s, box-shadow .2s;
}
.tpg-gallery .tpg-fdd-btn:hover { border-color: rgba(0, 0, 0, .35); }
.tpg-gallery .tpg-fdd-btn:focus-visible, .tpg-gallery .tpg-fdd.is-open .tpg-fdd-btn { border-color: var(--tpg-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tpg-accent) 18%, transparent); }
.tpg-fdd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpg-fdd-btn svg { flex: none; width: 16px; height: 16px; color: var(--tpg-muted); transition: transform .2s; }
.tpg-fdd.is-open .tpg-fdd-btn svg { transform: rotate(180deg); color: var(--tpg-text); }
.tpg-fdd-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 320px; overflow: auto; margin: 0; padding: 6px; background: #fff; border: 1px solid var(--tpg-line); border-radius: 12px; box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .35); z-index: 60; display: none; }
.tpg-fdd.is-open .tpg-fdd-menu { display: block; animation: tpg-fdd-in .14s ease-out; }
.tpg-fdd.is-up .tpg-fdd-menu { top: auto; bottom: calc(100% + 6px); }
.tpg-align-right .tpg-fdd-menu { left: auto; right: 0; }
@keyframes tpg-fdd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tpg-fdd-opt { --c: var(--tpg-accent); --ct: var(--tpg-accent-text, #fff); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--tpg-text); white-space: nowrap; cursor: pointer; transition: background .15s; }
.tpg-fdd-opt + .tpg-fdd-opt { margin-top: 2px; }
.tpg-fdd-opt:hover { background: rgba(0, 0, 0, .06); }
.tpg-fdd-opt.is-selected, .tpg-fdd-opt.is-selected:hover { background: var(--c); color: var(--ct); font-weight: 600; }
.tpg-fdd-opt svg { flex: none; width: 15px; height: 15px; }
.tpg-fsize-sm .tpg-fdd { min-width: 190px; }
.tpg-gallery.tpg-fsize-sm .tpg-fdd-btn { min-height: 38px; font-size: 13px; padding: 7px 12px 7px 14px; }
.tpg-fsize-sm .tpg-fdd-opt { font-size: 13px; padding: 8px 11px; }
.tpg-fsize-lg .tpg-fdd { min-width: 260px; }
.tpg-gallery.tpg-fsize-lg .tpg-fdd-btn { min-height: 52px; font-size: 16px; padding: 12px 16px 12px 20px; }
.tpg-fsize-lg .tpg-fdd-opt { font-size: 15px; padding: 12px 14px; }
.tpg-fdd-mobile { display: none; }
/* sizes */
.tpg-fsize-sm .tpg-filter-btn { font-size: 13px; padding: 6px 14px; }
.tpg-fsize-lg .tpg-filter-btn { font-size: 16px; padding: 12px 26px; }
.tpg-fsize-lg .tpg-count { font-size: 12px; }
.tpg-fsize-sm .tpg-filter-select { font-size: 13px; padding: 7px 34px 7px 12px; }
.tpg-fsize-lg .tpg-filter-select { font-size: 16px; padding: 12px 44px 12px 18px; }
/* mobile behaviour */
.tpg-filter-select-mobile { display: none; }
@media (max-width: 767px) {
	.tpg-fm-scroll .tpg-filters { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 6px; margin-left: -4px; margin-right: -4px; padding-left: 4px; padding-right: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
	.tpg-fm-scroll .tpg-filters::-webkit-scrollbar { display: none; }
	.tpg-fm-scroll .tpg-filter-btn { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
	.tpg-fm-dropdown .tpg-filters .tpg-filter-btn { display: none; }
	.tpg-fm-dropdown .tpg-filter-select-mobile { display: block; width: 100%; }
	.tpg-fm-dropdown .tpg-fdd-mobile { display: block; width: 100%; }
	.tpg-filters-dropdown .tpg-fdd { width: 100%; }
	.tpg-fsize-lg .tpg-filter-btn { font-size: 14px; padding: 9px 18px; }
}

/* ---------- Mobile filter variants ---------- */
@media (max-width: 767px) {
	.tpg-fm-chips .tpg-filter-btn { font-size: 12px; padding: 5px 11px; border-radius: 999px; }
	.tpg-fm-chips .tpg-filters { gap: 6px; }
	.tpg-fm-grid2 .tpg-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
	.tpg-fm-grid2 .tpg-filter-btn { width: 100%; justify-content: center; }
	.tpg-fm-stack .tpg-filters { display: grid; grid-template-columns: 1fr; gap: 6px; }
	.tpg-fm-stack .tpg-filter-btn { width: 100%; justify-content: space-between; }
}

/* ---------- Layouts: mosaic, list, slider ---------- */
.tpg-layout-mosaic .tpg-grid { grid-auto-flow: dense; }
.tpg-layout-mosaic .tpg-item.is-big { grid-column: span 2; grid-row: span 2; }
.tpg-layout-mosaic .tpg-item-inner, .tpg-layout-mosaic .tpg-link { height: 100%; }
.tpg-layout-mosaic .tpg-link img { aspect-ratio: 1 / 1; object-fit: cover; height: 100%; width: 100%; }
@media (max-width: 480px) { .tpg-layout-mosaic .tpg-item.is-big { grid-column: span 2; grid-row: span 2; } }

.tpg-layout-list .tpg-grid { grid-template-columns: 1fr; gap: calc(var(--tpg-gap) * 2); }
.tpg-layout-list .tpg-link img { aspect-ratio: auto; width: 100%; }
.tpg-layout-list .tpg-caption { text-align: left; font-size: 15px; color: var(--tpg-text); padding-top: 12px; }


/* ---------- Hover icon ---------- */
.tpg-hicon { position: absolute; top: 50%; left: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #111; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(.6); transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1); pointer-events: none; z-index: 3; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.tpg-has-hicon .tpg-link::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .28); opacity: 0; transition: opacity .25s; z-index: 2; pointer-events: none; }
.tpg-has-hicon .tpg-item:hover .tpg-link::before, .tpg-has-hicon .tpg-link:focus-visible::before { opacity: 1; }
.tpg-item:hover .tpg-hicon, .tpg-link:focus-visible .tpg-hicon { opacity: 1; transform: scale(1); }
.tpg-has-hicon .tpg-overlay { z-index: 3; }
@media (hover: none) { .tpg-hicon { display: none; } .tpg-has-hicon .tpg-link::before { content: none; } }

@media (prefers-reduced-motion: reduce) {
	.tpg-item, .tpg-link img, .tpg-lb, .tpg-lb-slide img, .tpg-overlay, .tpg-hicon, .tpg-fdd-menu { transition: none !important; animation: none !important; }
}
