/**
 * Archive presentation layer — discovery layout.
 * Relies on design tokens from ztsm-components.
 */

/* Archive hero — fixed band matching Destinations (image size stays consistent). */
.ztsm-archive .ztsm-section-hero {
	--ztsm-archive-hero-h: 20rem; /* ~320px */
	min-height: var(--ztsm-archive-hero-h);
	height: var(--ztsm-archive-hero-h);
	max-height: var(--ztsm-archive-hero-h);
	padding-top: clamp(2rem, 5vw, 3rem) !important;
	padding-bottom: clamp(1.75rem, 4vw, 2.75rem) !important;
	align-items: flex-end;
	overflow: hidden;
	box-sizing: border-box;
}

@media (min-width: 700px) {
	.ztsm-archive .ztsm-section-hero {
		--ztsm-archive-hero-h: 26rem; /* ~416px */
	}
}

@media (min-width: 1100px) {
	.ztsm-archive .ztsm-section-hero {
		--ztsm-archive-hero-h: 31.25rem; /* 500px — destinations reference */
	}
}

.ztsm-archive .ztsm-section-hero__media,
.ztsm-archive .ztsm-section-hero__image,
.ztsm-archive .ztsm-section-hero__slide {
	background-size: cover !important;
	background-position: center !important;
}

.ztsm-archive .ztsm-section-hero__inner {
	max-height: 100%;
}

.ztsm-archive .ztsm-section-hero__description {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.ztsm-archive .ztsm-section,
.ztsm-arch-browse {
	padding-top: clamp(2rem, 4vw, 3.25rem);
	padding-bottom: clamp(2rem, 4vw, 3.25rem);
}

/* Shared section heading */
.ztsm-section-heading {
	margin: 0 0 clamp(1rem, 2.5vw, 1.5rem);
}

.ztsm-section-heading--center {
	text-align: center;
}

.ztsm-section-heading--center .ztsm-section-heading__subtitle {
	margin-inline: auto;
}

.ztsm-section-heading--right {
	text-align: right;
}

.ztsm-section-heading__eyebrow {
	margin: 0 0 0.4rem;
	color: var(--ztsm-color-muted);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ztsm-section-heading__title,
.ztsm-arch-browse__title,
.ztsm-archive .ztsm-section__title,
.ztsm-section-featured .ztsm-section__title,
.ztsm-section-intro .ztsm-section__title,
.ztsm-section-stats .ztsm-section__title,
.ztsm-section-faq .ztsm-section__title,
.ztsm-section-gallery .ztsm-section__title {
	margin: 0 0 0.5rem;
	font-family: var(--ztsm-font-heading);
	font-size: clamp(1.6rem, 3vw, 2.15rem);
	color: var(--ztsm-color-text);
}

.ztsm-section-heading__subtitle,
.ztsm-arch-browse__count {
	margin: 0;
	max-width: 40rem;
	color: var(--ztsm-color-muted);
	font-size: 0.98rem;
}

/* Archive secondary sections: titles + descriptions use full content width */
.ztsm-archive .ztsm-arch-browse ~ section .ztsm-section-heading__subtitle,
.ztsm-archive .ztsm-arch-browse ~ section .ztsm-section-gallery__desc,
.ztsm-archive .ztsm-section-featured .ztsm-section-heading__subtitle,
.ztsm-archive .ztsm-section-intro__content,
.ztsm-archive .ztsm-section-intro .ztsm-archive-seo__content {
	max-width: none;
	width: 100%;
}

.ztsm-arch-browse__intro {
	margin: 0 0 0.35rem;
}

.ztsm-arch-browse__count {
	margin: 0 0 clamp(1rem, 2.5vw, 1.5rem);
}

.ztsm-section-gallery__desc {
	margin: -0.25rem 0 1.25rem;
	max-width: 40rem;
	color: var(--ztsm-color-muted);
}

.ztsm-archive .ztsm-section-gallery__desc {
	max-width: none;
	width: 100%;
}

/* Mosaic inspiration gallery — images tile flush (no gaps). */
.ztsm-gallery--mosaic .ztsm-gallery__track {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	grid-auto-rows: minmax(8.5rem, 11rem);
	gap: 0;
}

.ztsm-gallery--mosaic .ztsm-gallery__item {
	margin: 0;
}

.ztsm-gallery--mosaic .ztsm-gallery__trigger {
	height: 100%;
}

.ztsm-gallery--mosaic .ztsm-gallery__thumb {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	object-fit: cover;
}

.ztsm-gallery--mosaic .ztsm-gallery__item--hero {
	grid-column: span 2;
	grid-row: span 2;
}

.ztsm-gallery--mosaic .ztsm-gallery__item--tall {
	grid-row: span 2;
}

.ztsm-gallery--mosaic .ztsm-gallery__item--wide {
	grid-column: span 2;
}

.ztsm-gallery--mosaic .ztsm-gallery__caption {
	display: none;
}

@media (max-width: 900px) {
	.ztsm-gallery--mosaic .ztsm-gallery__track {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-rows: minmax(8rem, 10rem);
	}

	.ztsm-gallery--mosaic .ztsm-gallery__item--hero {
		grid-column: span 2;
		grid-row: span 2;
	}

	.ztsm-gallery--mosaic .ztsm-gallery__item--wide {
		grid-column: span 2;
	}
}

@media (max-width: 520px) {
	.ztsm-gallery--mosaic .ztsm-gallery__track {
		grid-template-columns: 1fr 1fr;
		grid-auto-rows: minmax(7rem, 9rem);
	}

	.ztsm-gallery--mosaic .ztsm-gallery__item--hero {
		grid-column: span 2;
		grid-row: span 1;
		min-height: 11rem;
	}

	.ztsm-gallery--mosaic .ztsm-gallery__item--tall {
		grid-row: span 1;
	}
}

.ztsm-arch-browse__count {
	margin: 0;
	color: var(--ztsm-color-muted);
	font-size: 0.98rem;
}

.ztsm-arch-browse__toolbar {
	display: none;
	margin: 0 0 1rem;
}

.ztsm-arch-browse__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.4rem;
	min-height: 1.4rem;
	margin-left: 0.35rem;
	padding: 0 0.35rem;
	border-radius: var(--ztsm-radius-button);
	background: var(--ztsm-color-primary);
	color: var(--ztsm-color-on-primary, #fff);
	font-size: 0.75rem;
}

.ztsm-arch-browse__layout {
	display: grid;
	grid-template-columns: minmax(0, 25%) minmax(0, 1fr);
	gap: clamp(1.25rem, 3vw, 2.25rem);
	align-items: start;
}

.ztsm-arch-browse__layout--no-filters {
	grid-template-columns: 1fr;
}

.ztsm-arch-browse__aside {
	position: sticky;
	top: 1.25rem;
	min-width: 0;
	max-width: 100%;
}

.ztsm-arch-browse__aside-bar {
	display: none;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.75rem;
	font-family: var(--ztsm-font-heading);
	font-weight: 600;
}

.ztsm-arch-browse__filters-close {
	appearance: none;
	border: 0;
	background: transparent;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	color: var(--ztsm-color-text);
}

.ztsm-arch-browse__filters {
	padding: 1.15rem 1.2rem 1.25rem;
	border: 1px solid var(--ztsm-color-border);
	border-radius: var(--ztsm-radius-card);
	background: var(--ztsm-color-surface);
	min-width: 0;
	max-width: 100%;
	overflow: hidden;
}

.ztsm-arch-filters {
	min-width: 0;
	max-width: 100%;
}

.ztsm-arch-filters__heading {
	margin: 0 0 1rem;
	font-family: var(--ztsm-font-heading);
	font-size: 1.15rem;
}

.ztsm-arch-filters__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.9rem;
	margin-bottom: 1rem;
	min-width: 0;
	max-width: 100%;
}

.ztsm-arch-filters__field {
	margin: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.35rem;
	min-width: 0;
	max-width: 100%;
}

.ztsm-arch-filters__field label {
	font-weight: 600;
	font-size: 0.9rem;
}

/* Contain fields inside the sidebar — theme/select intrinsic widths must not spill. */
.ztsm-arch-filters__field input,
.ztsm-arch-filters__field select,
.ztsm-arch-filters__option-search {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	min-height: 2.5rem;
	padding: 0.45rem 0.7rem;
	border: 1px solid var(--ztsm-color-border);
	border-radius: var(--ztsm-radius-button);
	background: var(--ztsm-color-bg, #fff);
	font: inherit;
	line-height: 1.35;
	color: inherit;
}

.ztsm-arch-filters__field select {
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a5560' d='M1.4 1.2 6 5.8l4.6-4.6 1.2 1.2L6 8.2.2 2.4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 0.7rem;
	padding-right: 2rem;
	text-overflow: ellipsis;
}

.ztsm-arch-filters__search-wrap {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.4rem;
	min-width: 0;
	max-width: 100%;
}

.ztsm-arch-filters__actions {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.55rem;
	margin: 0;
	min-width: 0;
}

.ztsm-arch-filters__actions .ztsm-btn {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	justify-content: center;
}

.ztsm-arch-results {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 0 0 1.25rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--ztsm-color-border);
	border-radius: var(--ztsm-radius-card);
	background: var(--ztsm-color-surface);
}

.ztsm-arch-results__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	list-style: none;
	margin: 0;
	padding: 0;
	flex: 1 1 auto;
}

.ztsm-arch-results__chip {
	display: inline-flex;
	gap: 0.25rem;
	padding: 0.35rem 0.65rem;
	border: 1px solid var(--ztsm-color-border);
	border-radius: var(--ztsm-radius-button);
	background: var(--ztsm-color-bg, #fff);
	font-size: 0.9rem;
}

.ztsm-arch-results__chip-label {
	color: var(--ztsm-color-muted);
	font-weight: 600;
}

.ztsm-arch-results__clear {
	margin-left: auto;
	font-weight: 600;
	color: var(--ztsm-btn-bg, var(--ztsm-color-primary));
	text-decoration: none;
}

.ztsm-arch-results__clear:hover,
.ztsm-arch-results__clear:focus-visible {
	color: var(--ztsm-btn-hover-bg, var(--ztsm-color-accent, #e85d04));
}

.ztsm-arch-browse__status {
	margin: 0 0 0.85rem;
	color: var(--ztsm-color-muted);
}

.ztsm-arch-browse.is-loading [data-ztsm-results] {
	opacity: 0.55;
	transition: opacity 0.2s ease;
}

/* Browse grid: 1 / 2 / 4 columns (safari + activity listings = 3 on medium+) */
.ztsm-arch-browse .ztsm-arch-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: clamp(1rem, 2.5vw, 1.5rem);
}

@media (min-width: 700px) {
	.ztsm-arch-browse .ztsm-arch-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.ztsm-arch-browse .ztsm-arch-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Safari + Activity listings: 3 per row from medium breakpoints up */
@media (min-width: 700px) {
	.ztsm-arch-browse .ztsm-arch-grid--safari,
	.ztsm-arch-browse .ztsm-arch-grid--activity {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.ztsm-arch-browse__more,
.ztsm-arch-pagination {
	margin-top: var(--ztsm-space-6, 2rem);
	text-align: center;
}

.ztsm-arch-browse__more {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--ztsm-space-3, 0.75rem);
}

.ztsm-arch-browse__more[hidden],
.ztsm-arch-browse__more [hidden] {
	display: none !important;
}

.ztsm-arch-pagination .page-numbers {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	justify-content: center;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ztsm-arch-pagination .page-numbers li {
	margin: 0;
}

.ztsm-arch-pagination a.page-numbers,
.ztsm-arch-pagination span.page-numbers {
	display: inline-flex;
	min-width: 2.35rem;
	min-height: 2.35rem;
	align-items: center;
	justify-content: center;
	padding: 0.35rem 0.65rem;
	border: 1px solid var(--ztsm-color-border);
	border-radius: var(--ztsm-radius-button);
	color: var(--ztsm-color-text);
	text-decoration: none;
	background: var(--ztsm-color-surface, #fff);
}

.ztsm-arch-pagination a.page-numbers:hover,
.ztsm-arch-pagination a.page-numbers:focus-visible {
	border-color: var(--ztsm-btn-hover-border, var(--ztsm-btn-hover-bg, var(--ztsm-color-accent, #e85d04)));
	background: var(--ztsm-btn-hover-bg, var(--ztsm-color-accent, #e85d04));
	color: var(--ztsm-btn-hover-text, var(--ztsm-btn-text, var(--ztsm-color-on-primary, #fff))) !important;
}

.ztsm-arch-pagination span.page-numbers.current {
	background: var(--ztsm-btn-bg, var(--ztsm-color-primary));
	border-color: var(--ztsm-btn-border, var(--ztsm-btn-bg, var(--ztsm-color-primary)));
	color: var(--ztsm-btn-text, var(--ztsm-color-on-primary, #fff));
}

.ztsm-arch-empty {
	padding: clamp(1.5rem, 4vw, 2.5rem) 0;
	text-align: center;
}

.ztsm-arch-empty__title {
	margin: 0 0 1rem;
	font-family: var(--ztsm-font-heading);
	font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

.ztsm-archive-card-enter {
	animation: ztsm-arch-fade-in 0.28s ease both;
}

@keyframes ztsm-arch-fade-in {
	from { opacity: 0; transform: translateY(0.35rem); }
	to { opacity: 1; transform: none; }
}

.ztsm-arch-filters-drawer {
	display: none;
}

.ztsm-arch-browse .is-hidden {
	display: none !important;
}

@media (max-width: 900px) {
	.ztsm-arch-browse__toolbar {
		display: flex;
	}

	.ztsm-arch-browse__layout {
		grid-template-columns: 1fr;
	}

	.ztsm-arch-filters-drawer:not([hidden]) {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 10030;
	}

	.ztsm-arch-filters-drawer__backdrop {
		position: absolute;
		inset: 0;
		border: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, 0.45);
		cursor: pointer;
	}

	.ztsm-arch-browse__aside {
		position: fixed;
		inset: 0 auto 0 0;
		width: min(22rem, 88vw);
		z-index: 10040;
		transform: translateX(-105%);
		transition: transform 0.25s ease;
		background: var(--ztsm-color-bg, #fff);
		box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
		overflow: auto;
		padding: 1rem 1rem 1.5rem;
	}

	.ztsm-arch-browse.is-filters-open .ztsm-arch-browse__aside,
	.ztsm-arch-browse__aside.is-open {
		transform: translateX(0);
	}

	.ztsm-arch-browse__aside-bar {
		display: flex;
	}

	body.ztsm-filters-open {
		overflow: hidden;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ztsm-arch-browse.is-loading [data-ztsm-results],
	.ztsm-arch-browse__aside,
	.ztsm-archive-card-enter {
		transition: none !important;
		animation: none !important;
	}
}

/*
 * Below the filters+listing block: independent full-width sections.
 * Filters only constrain the main archive grid — not featured / gallery / FAQ / CTA.
 */
.ztsm-archive .ztsm-arch-browse ~ section {
	width: 100%;
	max-width: none;
	box-sizing: border-box;
}

.ztsm-archive .ztsm-arch-browse ~ section > .ztsm-container,
.ztsm-archive .ztsm-arch-browse ~ .ztsm-global-cta > .ztsm-container {
	width: 100%;
	max-width: none;
}

/*
 * Secondary card grids (Featured Safaris / Destinations / etc.): full-width 4-up.
 */
.ztsm-archive .ztsm-section-featured .ztsm-arch-grid,
.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-featured .ztsm-grid {
	display: grid;
	width: 100%;
	gap: clamp(1rem, 2.5vw, 1.5rem);
	align-items: stretch;
	grid-template-columns: 1fr;
}

@media (min-width: 700px) {
	.ztsm-archive .ztsm-section-featured .ztsm-arch-grid,
	.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-featured .ztsm-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.ztsm-archive .ztsm-section-featured .ztsm-arch-grid,
	.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-featured .ztsm-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Keep MediaCard proportions consistent in secondary grids. */
.ztsm-archive .ztsm-section-featured .ztsm-media-card__link {
	aspect-ratio: 4 / 5;
	max-height: none;
}

.ztsm-archive .ztsm-arch-browse ~ .ztsm-arch-gallery .ztsm-gallery,
.ztsm-archive .ztsm-arch-browse ~ .ztsm-arch-gallery .ztsm-gallery__track {
	width: 100%;
}

/* FAQ accordion uses the full content width below the listing. */
.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-faq .ztsm-faqs {
	max-width: none;
	width: 100%;
}

/* SEO long-form content — width driven by section modifiers. */
.ztsm-archive .ztsm-section-seo .ztsm-archive-seo__content,
.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-seo .ztsm-archive-seo__content {
	width: 100%;
}

.ztsm-archive .ztsm-section-seo--full .ztsm-archive-seo__content,
.ztsm-archive .ztsm-arch-browse ~ .ztsm-section-seo--full .ztsm-archive-seo__content {
	max-width: none;
}
