/**
 * Vacation deals carousel ([ny_vacation_deals]).
 *
 * - A native scroll-snap track, so it swipes on touch screens; assets/js/package-deals.js adds the arrows.
 * - CSS logical properties, so LTR and RTL (Hebrew) share one file.
 * - Uses the --ny-* tokens from package-search.css. Set --ny-deals-columns (from the "columns"
 *   attribute) or --ny-deals-gap on .ny-deals to change the layout.
 *
 * @package NYIsraelines
 */

.ny-deals {
	--ny-star: #f5a524;
	--ny-deals-gap: 20px;
	--ny-deals-visible: var(--ny-deals-columns, 4);
	--ny-deals-bleed: 16px;
	position: relative;
	container: ny-deals / inline-size;
	margin: 0;
	color: var(--ny-text);
	font-size: 15px;
	line-height: 1.35;
	text-align: start;
}

.ny-deals *,
.ny-deals *::before,
.ny-deals *::after {
	box-sizing: border-box;
}

.ny-deals [dir="auto"] {
	text-align: left;
}

[dir="rtl"] .ny-deals [dir="auto"] {
	text-align: right;
}

.ny-deals .ny-deals__title {
	margin: 0 0 16px;
	color: var(--ny-text);
	font-size: 26px;
	font-weight: 700;
	line-height: 1.2;
}

/* ------------------------------------------------------------------------
 * Carousel
 * --------------------------------------------------------------------- */

.ny-deals .ny-deals__carousel {
	position: relative;
}

.ny-deals .ny-deals__track {
	display: flex;
	gap: var(--ny-deals-gap);
	/*
	 * A scrolling element clips everything outside its padding box: pad it for the card shadows and the
	 * hover lift, and pull it back with negative margins so the cards stay aligned with the content.
	 */
	margin: -12px calc(-1 * var(--ny-deals-bleed)) -20px;
	padding: 12px var(--ny-deals-bleed) 32px;
	scroll-padding-inline: var(--ny-deals-bleed);
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	list-style: none;
}

.ny-deals .ny-deals__track::-webkit-scrollbar {
	display: none;
}

.ny-deals .ny-deals__track:focus-visible {
	outline: 2px solid var(--ny-primary);
	outline-offset: 2px;
	border-radius: var(--ny-radius);
}

@media (prefers-reduced-motion: no-preference) {

	.ny-deals .ny-deals__track {
		scroll-behavior: smooth;
	}
}

/* Arrows: floating over the track edges, hidden while there's nothing to scroll to. */
.ny-deals .ny-deals__nav {
	position: absolute;
	z-index: 2;
	/* Centered on the photos (set by package-deals.js), clear of the card text. */
	inset-block-start: var(--ny-deals-nav-top, 90px);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	background: var(--ny-surface);
	border: 1px solid var(--ny-border);
	border-radius: 50%;
	box-shadow: var(--ny-shadow);
	color: var(--ny-text);
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease, color 0.15s ease;
}

.ny-deals .ny-deals__nav:hover,
.ny-deals .ny-deals__nav:focus-visible {
	background: var(--ny-primary);
	border-color: var(--ny-primary);
	color: #fff;
}

.ny-deals .ny-deals__nav:focus-visible {
	outline: 2px solid var(--ny-primary);
	outline-offset: 2px;
}

.ny-deals .ny-deals__nav:disabled {
	opacity: 0;
	pointer-events: none;
	transform: scale(0.85);
}

.ny-deals .ny-deals__nav--prev {
	inset-inline-start: 10px;
}

.ny-deals .ny-deals__nav--next {
	inset-inline-end: 10px;
}

/* Chevrons point the way the cards move. */
[dir="rtl"] .ny-deals .ny-deals__nav svg,
[dir="rtl"] .ny-deals .ny-deal__cta svg {
	transform: scaleX(-1);
}

/* Without JS (or while loading) there is no scroll state: rely on swiping/scrolling. */
.ny-deals:not(.is-ready) .ny-deals__nav {
	display: none;
}

/* ------------------------------------------------------------------------
 * Card
 * --------------------------------------------------------------------- */

.ny-deals .ny-deal {
	position: relative;
	display: flex;
	flex: 0 0 calc((100% - (var(--ny-deals-visible) - 1) * var(--ny-deals-gap)) / var(--ny-deals-visible));
	flex-direction: column;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	background: var(--ny-surface);
	border: 1px solid var(--ny-border);
	border-radius: var(--ny-radius);
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.06);
	scroll-snap-align: start;
	transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.ny-deals .ny-deal:not(.ny-deal--skeleton):hover {
	border-color: transparent;
	box-shadow: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 24px rgba(15, 23, 42, 0.12);
	transform: translateY(-3px);
}

.ny-deals .ny-deal:focus-within {
	border-color: var(--ny-primary);
}

/* Media */
.ny-deals .ny-deal__media {
	position: relative;
	aspect-ratio: 16 / 11;
	overflow: hidden;
	background: linear-gradient(135deg, #eaf1fb 0%, #d7e4f7 100%);
}

.ny-deals .ny-deal__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.ny-deals .ny-deal:hover .ny-deal__media img {
	transform: scale(1.05);
}

.ny-deals .ny-deal__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #93acd0;
}

.ny-deals .ny-deal__badge {
	position: absolute;
	z-index: 1;
	inset-block-start: 12px;
	inset-inline-start: 12px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	background: rgba(255, 255, 255, 0.94);
	border-radius: 999px;
	box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
	color: var(--ny-text);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	backdrop-filter: blur(4px);
}

.ny-deals .ny-deal__badge--instant {
	inset-block-start: auto;
	inset-block-end: 12px;
	background: #fef3c7;
	color: #92400e;
}

/* Body */
.ny-deals .ny-deal__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 14px;
	padding: 16px 18px 18px;
}

.ny-deals .ny-deal__heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ny-deals .ny-deal__name {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--ny-text);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.ny-deals .ny-deal__link,
.ny-deals .ny-deal__link:hover,
.ny-deals .ny-deal__link:focus {
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	outline: none;
}

/* The whole card is the link. */
.ny-deals .ny-deal__link::after {
	content: "";
	position: absolute;
	z-index: 1;
	inset: 0;
}

.ny-deals .ny-deal__stars {
	display: inline-flex;
	gap: 1px;
	line-height: 0;
}

.ny-deals .ny-star {
	color: var(--ny-star);
	fill: currentColor;
}

.ny-deals .ny-deal__location {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 2px 0 0;
	color: var(--ny-muted);
	font-size: 14px;
}

.ny-deals .ny-deal__location svg {
	flex: 0 0 auto;
	color: var(--ny-primary);
}

.ny-deals .ny-deal__location span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Dates */
.ny-deals .ny-deal__dates {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 0;
	background: var(--ny-surface-alt, #f8fafc);
	border: 1px solid var(--ny-border);
	border-radius: var(--ny-radius-sm);
}

.ny-deals .ny-deal__date {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	padding: 9px 12px;
}

.ny-deals .ny-deal__date + .ny-deal__date {
	border-inline-start: 1px solid var(--ny-border);
}

.ny-deals .ny-deal__date dt {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	color: var(--ny-muted);
	font-size: 12px;
	font-weight: 500;
}

.ny-deals .ny-deal__date dd {
	margin: 0;
	color: var(--ny-muted);
	font-size: 13px;
	white-space: nowrap;
}

.ny-deals .ny-deal__date dd strong {
	color: var(--ny-text);
	font-size: 15px;
	font-weight: 700;
}

/* Tags */
.ny-deals .ny-deal__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ny-deals .ny-deal__tags li {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 4px 9px;
	background: var(--ny-primary-soft);
	border-radius: 999px;
	color: var(--ny-primary);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
}

/* Footer */
.ny-deals .ny-deal__footer {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 12px;
	margin-block-start: auto;
	padding-block-start: 14px;
	border-block-start: 1px dashed var(--ny-border);
}

.ny-deals .ny-deal__pricing {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ny-deals .ny-deal__from,
.ny-deals .ny-deal__per {
	color: var(--ny-muted);
	font-size: 12px;
	line-height: 1.3;
}

.ny-deals .ny-deal__price {
	color: var(--ny-text);
	font-size: 26px;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.01em;
}

.ny-deals .ny-deal__cta {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	background: var(--ny-primary);
	border-radius: 999px;
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	transition: background-color 0.15s ease, gap 0.15s ease;
}

.ny-deals .ny-deal:hover .ny-deal__cta {
	gap: 10px;
	background: var(--ny-primary-hover);
}

/* ------------------------------------------------------------------------
 * Loading
 * --------------------------------------------------------------------- */

.ny-deals .ny-deal--skeleton .ny-deal__media,
.ny-deals .ny-deal__line {
	background: linear-gradient(90deg, #eef2f6 25%, #f7f9fb 50%, #eef2f6 75%);
	background-size: 200% 100%;
	animation: ny-deals-shimmer 1.2s linear infinite;
}

.ny-deals .ny-deal__line {
	display: block;
	width: 80%;
	height: 14px;
	border-radius: 6px;
}

.ny-deals .ny-deal__line--lg {
	width: 70%;
	height: 20px;
}

.ny-deals .ny-deal__line--sm {
	width: 40%;
}

.ny-deals .ny-deal__line--md {
	width: 55%;
	height: 28px;
	margin-block-start: 18px;
}

@keyframes ny-deals-shimmer {

	from {
		background-position: 200% 0;
	}

	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {

	.ny-deals .ny-deal,
	.ny-deals .ny-deal__media img,
	.ny-deals .ny-deal__cta {
		transition: none;
	}

	.ny-deals .ny-deal--skeleton .ny-deal__media,
	.ny-deals .ny-deal__line {
		animation: none;
	}
}

/* ------------------------------------------------------------------------
 * Responsive: fewer cards, with the next one peeking in to invite a swipe.
 * --------------------------------------------------------------------- */

@container ny-deals (max-width: 1100px) {

	.ny-deals .ny-deals__track {
		--ny-deals-visible: min(var(--ny-deals-columns, 4), 3);
	}
}

@container ny-deals (max-width: 820px) {

	.ny-deals .ny-deals__track {
		--ny-deals-visible: min(var(--ny-deals-columns, 4), 2.2);
	}

	.ny-deals .ny-deals__nav {
		display: none;
	}
}

@container ny-deals (max-width: 540px) {

	/* No bleed: on phones the carousel may touch the screen edges, and bleeding would scroll the page sideways. */
	.ny-deals .ny-deals__track {
		--ny-deals-gap: 14px;
		--ny-deals-visible: 1.15;
		--ny-deals-bleed: 0px;
	}

	.ny-deals .ny-deals__title {
		font-size: 22px;
	}
}
