/* Obsidian Posts */

/* ---------- Tag menu above the posts (same look as the gallery menu) ---------- */

.obp-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 18px;
	box-sizing: border-box;
	width: 100%;
	margin: 0 0 20px !important;
	padding: 0;
}

.obp-filter .obp-tag {
	display: inline-block;
	margin: 0;
	padding: 6px 2px;
	color: var(--obp-tag-color, #008bdc) !important;
	font-family: inherit;
	font-size: var(--obp-tag-size, 20px);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	text-underline-offset: 3px;
	-webkit-tap-highlight-color: transparent;
}

.obp-filter .obp-tag:hover,
.obp-filter .obp-tag:focus,
.obp-filter .obp-tag.obp-active {
	text-decoration: underline !important;
}

.obp-filter .obp-tag:focus-visible {
	outline: 2px solid var(--obp-tag-color, #008bdc);
	outline-offset: 2px;
}

/* ---------- The stack ---------- */

/* On the post's own page: full width, the shape of the first image */
.obp-media {
	margin: 0 0 1.5em;
	padding: 0;
}

.obp-media .obp-pic {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 6px;
}

/* Inside a Framed Posts frame the box keeps the frame's own size and spacing */
.fpp-card .fpp-pic.obp-stack {
	overflow: hidden;
}

.obp-stack .obp-track {
	position: absolute;
	inset: 0;
	display: flex;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	touch-action: pan-x pan-y;
}

.obp-stack .obp-track::-webkit-scrollbar {
	display: none;
}

.obp-stack .obp-track.obp-dragging {
	scroll-snap-type: none;
	cursor: grabbing;
}

.obp-stack .obp-slide {
	position: relative;
	flex: 0 0 100%;
	min-width: 0;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.obp-stack .obp-link {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	line-height: 0;
	cursor: zoom-in;
	box-shadow: none !important;
	text-decoration: none !important;
}

/* Every image fills the box, which has the shape of the first image (like gallery stacks) */
.obp-stack .obp-img {
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	object-fit: cover !important;
	aspect-ratio: auto !important;
	user-select: none;
	-webkit-user-drag: none;
}

.obp-stack .obp-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	z-index: 2;
	display: flex;
	justify-content: center;
	gap: 5px;
	padding: 0 52px; /* keeps the dots clear of the like heart */
	pointer-events: none;
}

.obp-stack .obp-dot {
	display: block;
	flex: 0 0 auto;
	width: 6px !important;
	height: 6px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.55) !important;
	box-shadow: 0 0 3px rgba(0, 0, 0, 0.5) !important;
	cursor: pointer;
	pointer-events: auto;
	transition: background 0.2s ease, transform 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.obp-stack .obp-dot:hover {
	background: rgba(255, 255, 255, 0.85) !important;
}

.obp-stack .obp-dot.obp-dot-on {
	background: #fff !important;
	transform: scale(1.3);
}

.obp-stack .obp-dot:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* ---------- Lightbox (same look as the gallery's) ---------- */

.obp-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.94);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.obp-lightbox[hidden] {
	display: none;
}

.obp-lightbox.obp-open {
	opacity: 1;
}

.obp-lightbox .obp-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: pan-y;
}

.obp-lightbox .obp-lb-figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 94vw;
	margin: 0;
	will-change: transform;
}

.obp-lightbox .obp-lb-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 94vw;
	max-height: 84vh;
	max-height: 84dvh;
	margin: 0;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
}

.obp-lightbox .obp-lb-count {
	margin: 10px 0 0;
	color: #bdbdbd;
	font-size: 0.8rem;
	letter-spacing: 0.06em;
	line-height: 1;
}

.obp-lightbox .obp-lb-count:empty {
	display: none;
}

.obp-lightbox .obp-lb-figure[hidden],
.obp-lightbox .obp-lb-group[hidden] {
	display: none;
}

.obp-lightbox .obp-lb-group {
	display: grid;
	grid-template-columns: repeat(var(--obp-cols, 3), minmax(0, 1fr));
	gap: 10px;
	width: min(1100px, 92vw);
	margin: 0;
	will-change: transform;
}

.obp-lightbox .obp-lb-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	border-radius: 6px;
	cursor: zoom-in;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.obp-lightbox .obp-lb-thumb img {
	display: block;
	width: 100%;
	height: calc((82vh - (var(--obp-rows, 1) - 1) * 10px) / var(--obp-rows, 1));
	height: calc((82dvh - (var(--obp-rows, 1) - 1) * 10px) / var(--obp-rows, 1));
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transition: transform 0.15s ease;
}

@media (hover: hover) {
	.obp-lightbox .obp-lb-thumb:hover img {
		transform: scale(1.02);
	}
}

.obp-lightbox .obp-lb-thumb:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.obp-lightbox .obp-close {
	position: absolute;
	top: max(12px, env(safe-area-inset-top));
	right: max(12px, env(safe-area-inset-right));
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
	cursor: pointer;
	box-shadow: none;
}

.obp-lightbox .obp-close:hover,
.obp-lightbox .obp-close:focus-visible {
	background: rgba(255, 255, 255, 0.3);
	color: #fff;
}

.obp-lightbox .obp-close svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.5;
	stroke-linecap: round;
}

html.obp-lb-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.obp-lightbox,
	.obp-stack .obp-dot,
	.obp-lightbox .obp-lb-thumb img {
		transition: none;
	}
}
