/**
 * TWTIS Swipe — styles.
 *
 * Part 1: site chrome (logo + menu) is shown only at >= 1280px — the smallest
 *         "looks like" resolution of a 13-inch MacBook. Below that the site is
 *         the pure image feed.
 * Part 2: the fullscreen swipe overlay (mobile photo viewer), variant C:
 *         photo first, quiet 1.25em title, typography mirroring the site's
 *         single-photo pages, plain TWTIS mark bottom-center as the exit.
 *
 * Targets the Kathy theme (UXBARN) with the twtis portfolio templates.
 */

/* ---------------------------------------------------------------------------
 * 1. Chrome gating
 *
 * Kathy's own layout: >=1151px the header (#side-container) is a side column
 * and #main-container is a 69.2% float; <=1150px Kathy already stacks and
 * centers #main-container (max-width 830px, width 90%). We hide the header at
 * every width below 1280px and replicate Kathy's stacked centering for the
 * 1151-1279px window it doesn't cover itself.
 * ------------------------------------------------------------------------- */

@media only screen and (max-width: 1279.98px) {
	#side-container {
		display: none !important;
	}

	#main-container {
		float: none !important;
		margin: 0 auto !important;
		width: 90% !important;
		max-width: 830px;
	}

	/* Pure image feed: drop the "Photography" heading with the chrome. */
	.page-template-template-all-works .portfolio-list-section > h1.post-title {
		display: none;
	}

	/* Breathing room the side header used to provide. */
	#root-container {
		padding-top: 1.25rem;
	}
}

/* ---------------------------------------------------------------------------
 * 2. Swipe overlay
 * ------------------------------------------------------------------------- */

.twtis-swipe-lock {
	position: fixed;
	overflow: hidden;
	width: 100%;
}

.twtis-swipe-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	/* Focused programmatically on open; never show a ring for that. */
	outline: none;
	height: 100vh;
	height: 100dvh;
	background: #fff;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.22s ease, visibility 0s linear 0.22s;
	overscroll-behavior: contain;
}

.twtis-swipe-overlay[data-state="open"] {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.22s ease;
}

.twtis-swipe-track {
	display: flex;
	height: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	/* Horizontal pans page the track; vertical pans scroll the slide. */
	touch-action: pan-x pan-y;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.twtis-swipe-track::-webkit-scrollbar {
	display: none;
}

/* Each slide is a full vertical page in a plain native scroller — no snap,
   no artificial scroll range, so reading never fights re-snapping. The JS
   exit gesture (pull from an edge) lives on touch events, not on scroll. */
.twtis-swipe-slide {
	flex: 0 0 100%;
	width: 100%;
	scroll-snap-align: center;
	scroll-snap-stop: always;
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior-y: none;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.twtis-swipe-slide::-webkit-scrollbar {
	display: none;
}

/* Auto margins center short content (photo + a few lines) as a block and
   collapse to zero when the page is taller than the screen — no clipping. */
.twtis-swipe-page {
	box-sizing: border-box;
	min-height: 100%;
	display: flex;
	flex-direction: column;
	padding: calc(env(safe-area-inset-top, 0px) + 1em) 1.25em
		calc(env(safe-area-inset-bottom, 0px) + 1em);
	background: #fff;
}

.twtis-swipe-slide {
	transform: translateY(0);
}

.twtis-swipe-overlay.is-settling .twtis-swipe-slide {
	transition: transform 0.22s ease;
}

/* The photo hugs its own height — the text sits directly below it with no
   artificial gap, whatever the aspect ratio. Tall photos cap at 72svh. */
.twtis-swipe-figure {
	flex: 0 0 auto;
	margin: auto 0 0;
	display: flex;
	justify-content: center;
}

.twtis-swipe-figure img {
	display: block;
	max-width: 100%;
	max-height: 72vh;
	max-height: 72svh;
	width: auto;
	height: auto;
	object-fit: contain;
}

/* Text block: the single-photo page's type system, title stepped down.
   No height cap — the page scrolls as a whole to read all of it. */
.twtis-swipe-card {
	flex: 0 0 auto;
	text-align: left;
	line-height: 1.6;
	color: #555;
}

.twtis-swipe-title {
	font-size: 1.25em;
	font-weight: 400;
	letter-spacing: 0.01em;
	color: #050505;
	margin: 1em 0 0.3em;
}

.twtis-swipe-caption {
	color: #555;
}

/* Neutralize inline styles carried by imported post content — same fix the
   site's own single-page CSS applies to .twtis-info-body p[style]. */
.twtis-swipe-caption p,
.twtis-swipe-caption p[style] {
	margin: 0 0 0.6em;
	text-align: left !important;
	font-size: 1em !important;
}

.twtis-swipe-meta {
	font-size: 0.92em;
	margin-top: 0.5em;
}

.twtis-swipe-meta .twtis-info-line {
	display: block;
	margin: 0.1em 0;
	color: #666;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.twtis-swipe-meta .twtis-info-label {
	color: #999;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 0.78em;
	margin-right: 0.5em;
}

/* Exit affordance: the plain TWTIS mark at the end of the page content —
   it scrolls into view when you reach the bottom, exactly like the home
   button on the single-photo pages. No disc, no shadow, no border. */
.twtis-swipe-exit {
	border: 0;
	background: none;
	padding: 8px;
	margin: 2.5rem auto auto;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-tap-highlight-color: transparent;
	outline: none;
}

.twtis-swipe-exit img {
	display: block;
	width: 32px;
	height: 32px;
}

/* Keyboard users still get a ring (never painted for taps or script focus,
   since open() focuses the overlay, not this button). */
.twtis-swipe-exit:focus-visible {
	outline: 1px solid #999;
	outline-offset: 3px;
	border-radius: 50%;
}

/* Screen-reader-only live region. */
.twtis-swipe-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.twtis-swipe-overlay {
		transition: none;
	}
}
