/*
Theme Name: TGP Gallery
Theme URI: https://example.com/
Author: Your Name
Author URI: https://example.com/
Description: A minimal, mobile-first, full-screen picture gallery theme. A single image fills the screen edge to edge under a slim header. Posts with more than one image automatically become a swipeable left/right slider — still full screen. No sidebar. Related posts appear below each post as full-width thumbnail cards.
Version: 1.0.0
Requires at least: 5.9
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tgp-gallery
*/

:root {
	--tgp-header-h: 52px;
	--tgp-bg: #000;
	--tgp-fg: #fff;
	--tgp-dim: rgba(255, 255, 255, 0.6);
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	padding: 0;
	background: var(--tgp-bg);
	color: var(--tgp-fg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	overflow-x: hidden;
}

img {
	max-width: 100%;
	display: block;
}

a {
	color: inherit;
	text-decoration: none;
}

/* ---------- Header (small, fixed, overlays the image) ---------- */
.tgp-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--tgp-header-h);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 14px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
	z-index: 100;
}

.tgp-logo {
	font-weight: 700;
	font-size: 16px;
	letter-spacing: 0.03em;
}

.tgp-menu-toggle {
	background: none;
	border: none;
	width: 28px;
	height: 22px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	cursor: pointer;
	padding: 0;
}

.tgp-menu-toggle span {
	display: block;
	height: 2px;
	background: #fff;
	border-radius: 2px;
}

.tgp-nav {
	position: fixed;
	top: var(--tgp-header-h);
	right: 0;
	background: rgba(0, 0, 0, 0.92);
	width: 220px;
	max-width: 70vw;
	transform: translateX(100%);
	transition: transform 0.25s ease;
	z-index: 99;
}

.tgp-nav.is-open {
	transform: translateX(0);
}

.tgp-nav ul {
	list-style: none;
	margin: 0;
	padding: 10px 0;
}

.tgp-nav a {
	display: block;
	padding: 12px 18px;
	font-size: 14px;
}

/* ---------- Full-screen single image / slider ---------- */
.tgp-single {
	width: 100%;
}

.tgp-single-image,
.tgp-slider {
	position: relative;
	width: 100vw;
	height: 100vh;
	height: 100dvh; /* modern mobile browsers: real visible viewport */
	overflow: hidden;
	background: #000;
}

.tgp-single-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tgp-slider-track {
	display: flex;
	width: 100%;
	height: 100%;
	transition: transform 0.3s ease;
	touch-action: pan-y;
}

.tgp-slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
}

.tgp-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tgp-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 40px 16px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
	font-size: 13px;
	color: var(--tgp-dim);
}

.tgp-dots {
	position: absolute;
	bottom: 12px;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 6px;
	z-index: 10;
}

.tgp-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.4);
}

.tgp-dot.is-active {
	background: #fff;
}

.tgp-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	border: none;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 10;
	display: none;
}

.tgp-arrow-prev {
	left: 10px;
}

.tgp-arrow-next {
	right: 10px;
}

@media (hover: hover) and (pointer: fine) {
	.tgp-arrow {
		display: block;
	}
}

/* ---------- Post info under the image ---------- */
.tgp-post-info {
	padding: 18px 16px 8px;
}

.tgp-title {
	font-size: 18px;
	margin: 0 0 8px;
}

.tgp-content {
	font-size: 14px;
	line-height: 1.6;
	color: var(--tgp-dim);
}

/* ---------- Related posts (full-width thumbnails) ---------- */
.tgp-related {
	padding: 20px 0 40px;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	margin-top: 10px;
}

.tgp-related-title {
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	padding: 0 16px;
	margin: 0 0 14px;
	color: var(--tgp-dim);
}

.tgp-related-item {
	display: block;
	position: relative;
	width: 100vw;
	margin-bottom: 4px;
}

.tgp-related-item img {
	width: 100%;
	height: 60vh;
	object-fit: cover;
}

.tgp-related-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 30px 16px 14px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
	font-size: 14px;
	font-weight: 600;
}

/* ---------- Archive / home grid (also full-screen thumbnails) ---------- */
.tgp-archive {
	padding-top: 0;
}

.tgp-archive-item {
	display: block;
	position: relative;
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	margin-bottom: 4px;
}

.tgp-archive-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tgp-archive-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 40px 16px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
	font-size: 15px;
	font-weight: 600;
}

.tgp-count {
	position: absolute;
	top: 12px;
	right: 12px;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 12px;
	padding: 3px 8px;
	border-radius: 20px;
}

.tgp-none {
	padding: 100px 16px;
	text-align: center;
	color: var(--tgp-dim);
}

/* ---------- Static pages ---------- */
.tgp-page {
	padding-top: calc(var(--tgp-header-h) + 24px);
}

/* ---------- Footer ---------- */
.tgp-footer {
	text-align: center;
	padding: 20px 16px 30px;
	font-size: 12px;
	color: var(--tgp-dim);
}

/* Wider screens: keep it image-first but cap slide/thumbnail height */
@media (min-width: 900px) {
	.tgp-single-image,
	.tgp-slider,
	.tgp-archive-item {
		height: 100vh;
	}
	.tgp-related-item img {
		height: 70vh;
	}

	/* Show the actual photo at its own aspect ratio, centered, rather than
	   cropping it edge-to-edge like on mobile. The container stays full
	   width/height as a dark backdrop; only the image itself is contained. */
	.tgp-single-image,
	.tgp-slide {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.tgp-single-image img,
	.tgp-slide img {
		width: auto;
		height: auto;
		max-width: 100%;
		max-height: 100%;
		object-fit: contain;
	}
}
