/**
 * Additions to the single-tour page, on top of the supplied design.
 *
 *   1. Left column order — title above the image, the duration/guide facts below
 *      it on one line.
 *   2. Booking widget — the currency toggle, the Adults / Children / Age row, the
 *      arrival-date hint, and the Book Now + secondary button layout. These match
 *      ProjectData/booking-widget.html.
 *   3. The "Your selection" summary card below the customise form.
 *   4. The hero gallery's pacing and the fade between photos.
 *
 * Items 2, 3 and 4 are driven by assets/js/tour-itinerary.js.
 *
 * Why its own file rather than the end of tour-itinerary.css: that stylesheet is
 * 31KB of the supplied design, and this plugin can only replace files whole, not
 * patch them. Rewriting it to append a component means transcribing 800 unrelated
 * lines and risking a slip in them. Small, self-contained additions in their own
 * file are the safer trade, and it is enqueued as a dependent of
 * ct-tour-itinerary so source order is still guaranteed.
 *
 * Everything is scoped under .ct-itin, like every other rule on this page, so it
 * cannot reach the Elementor header and footer that render around it.
 *
 * @package CustomTours
 */

/* ==========================================================================
   Left column: title, main image, thumbnails, facts
   ==========================================================================
 * `.gallery` is a flex column and the design already reorders it — the main image
 * is order 1 and the thumbnails order 2, so the DOM can keep the thumbnails first
 * for keyboard users while the picture shows on top.
 *
 * That existing reordering is what makes this cheap: the title block takes the
 * default order of 0 so it lands above both, and the facts take 3 so they land
 * below both. No markup fights the design's own rules.
 */

.ct-itin .gallery > .tour-head { order: 0; }

/*
 * The h1 used to live in a centred .section-head, which is where it got its size
 * from. In the left column it is left-aligned and a little smaller, because it
 * now shares a row with the booking widget rather than spanning the page.
 */
.ct-itin .tour-head h1 {
	margin: 0;
	font-size: 30px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--dark);
	overflow-wrap: break-word;
}

@media (max-width: 900px) {
	.ct-itin .tour-head h1 { font-size: 26px; }
}

/*
 * 16px on a phone, asked for directly. It is the same size as the body text
 * around it, so the tour's name reads as a label rather than as a banner —
 * which is the point: on a 360px screen the picture and the price are what the
 * visitor came for, and a 22px name pushed both further down.
 *
 * Desktop and tablet are untouched at 30px and 26px.
 */
@media (max-width: 560px) {
	.ct-itin .tour-head h1 { font-size: 16px; }
}

/* ==========================================================================
   The duration / guide facts — one line
   ==========================================================================
 * The design had these as two stacked cards, each with a bold line and a grey
 * line under it: four lines of text in two grey boxes. Under the image that reads
 * as a second, heavier block competing with the picture.
 *
 * Reset to a single strip: one row, one line, fact and detail inline, separated by
 * a middot. The two grey boxes become one.
 *
 * Only inside `.gallery` — the `> ` child combinator matters. `.info-cards` is a
 * shared class and the design uses it elsewhere; scoping to the direct child of
 * the gallery leaves those untouched.
 *
 * flex-wrap stays on. The request is one line and on any normal width that is
 * what this gives, but forcing nowrap would push a long language list off the
 * side of a phone rather than letting it drop.
 */
.ct-itin .gallery > .info-cards {
	order: 3;
	/* The gallery's own 12px flex gap spaces this; the design's margin would
	   double up on top of it. */
	margin-top: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 18px;
	padding: 11px 14px;
	border-radius: 10px;
	background: var(--gray-bg);
}

/*
 * Each fact is now inline text, not a card. The background, padding and radius
 * the design gave the individual cards move up to the strip above.
 */
.ct-itin .gallery > .info-cards .info-card {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 6px;
	min-width: 0;
	padding: 0;
	border-radius: 0;
	background: none;
}

.ct-itin .gallery > .info-cards .info-card .t {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
}

.ct-itin .gallery > .info-cards .info-card .d {
	/* The design stacked this under .t with a 2px offset; inline it needs neither. */
	margin-top: 0;
	font-size: 12.5px;
	line-height: 1.4;
	color: var(--muted);
	min-width: 0;
}

/*
 * The separator lives on the detail, not between the cards, so it only ever
 * appears where there is actually a detail to separate.
 */
.ct-itin .gallery > .info-cards .info-card .d::before {
	content: '·';
	margin-right: 6px;
	color: #C9D4DE;
}

@media (max-width: 480px) {

	.ct-itin .gallery > .info-cards {
		gap: 4px 12px;
		padding: 10px 12px;
	}

	.ct-itin .gallery > .info-cards .info-card .t { font-size: 12.5px; }
	.ct-itin .gallery > .info-cards .info-card .d { font-size: 12px; }
}

/* ==========================================================================
   Hero gallery — pacing, and how one photo becomes the next
   ==========================================================================
 * Two numbers control the slideshow and BOTH live here, deliberately:
 *
 *   --ct-slide-ms   how long a photo is held before the next one
 *   ct-photo-in     how the next one arrives
 *
 * The hold is read out of this custom property by assets/js/tour-itinerary.js
 * rather than being written into that script. They are one setting in two parts
 * — a hold that is shorter than the fade would start the next photo before this
 * one finished arriving — so keeping them apart in two files invites exactly the
 * mismatch that is hardest to spot. The script's own number is only a fallback
 * for when this stylesheet has not loaded.
 *
 * The swap itself is an animation, not a transition. The script changes photo by
 * toggling the `hidden` attribute, which is display:none: it cannot be
 * transitioned, and the incoming photo has no previous state to move from. An
 * element going from display:none to displayed starts its animations fresh, and
 * that is the hook — the script keeps toggling `hidden` exactly as it did and
 * needs to know nothing about any of this.
 *
 * It fades up over the slot rather than crossfading. A real crossfade needs both
 * photos stacked and absolutely positioned, and this hero deliberately has no
 * fixed height on phones — tour-responsive.css drops its 16/9 ratio so the image
 * sets its own — so taking the visible photo out of flow there would collapse
 * the container to nothing.
 *
 * ease-out, not ease, and that choice is doing work: fading up from nothing means
 * the slot's own backdrop shows through at the start, so the curve is picked to
 * get most of the opacity back quickly and then settle gently. A symmetric curve
 * over the same duration reads as a grey wash instead of a photo arriving.
 *
 * The small delay is the beat before it starts — the photo arrives rather than
 * being already halfway there.
 *
 * The thumbnails are not touched: they live in .thumbs, not .main-gallery, and a
 * strip that faded every time you clicked it would be worse than one that did not.
 */

.ct-itin {
	--ct-slide-ms: 6000;
}

.ct-itin .main-gallery .ph img {
	animation: ct-photo-in 1000ms ease-out 150ms both;
}

@keyframes ct-photo-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/*
 * Someone who has asked their OS to stop things moving gets the cut instead. The
 * script already declines to auto-advance for them, so in practice this covers
 * the photo they picked themselves — which should appear the instant they ask.
 */
@media (prefers-reduced-motion: reduce) {

	.ct-itin .main-gallery .ph img {
		animation: none;
	}
}

/* ==========================================================================
   Booking widget — currency toggle
   ==========================================================================
 * Replaces the old "I am: Indian national / Foreign national" bar with the pill
 * toggle from the reference: label on the left, two buttons on the right.
 *
 * The markup keeps `data-ct-tiers` / `data-ct-tier` and the `active` class, so
 * the script that swaps the price panels is unchanged — this is presentation
 * only. The buttons say only what currency you are looking at; nothing on the
 * page asks the visitor to declare a nationality to read a price.
 */

.ct-itin .row-between {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.ct-itin .cur-label {
	font-size: 11.5px;
	font-weight: 700;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: .5px;
	/* Single-line chrome: the page's 1.6 would add leading this does not want. */
	line-height: 1.3;
}

.ct-itin .currency-toggle {
	display: inline-flex;
	background: var(--gray-bg);
	border-radius: 24px;
	padding: 3px;
	gap: 2px;
	/* The label can shrink; the control must not. */
	flex: 0 0 auto;
}

.ct-itin .currency-toggle__btn {
	border: 0;
	background: transparent;
	color: #5A5A57;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.3;
	padding: 7px 16px;
	border-radius: 20px;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s ease, color .15s ease;
}

.ct-itin .currency-toggle__btn.active {
	background: var(--blue);
	color: #fff;
}

.ct-itin .currency-toggle__btn:not(.active):hover {
	background: #E9ECF1;
}

.ct-itin .currency-toggle__btn:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 2px;
}

/* ==========================================================================
   Booking widget — the arrival-date hint
   ========================================================================== */
/*
 * The line explaining that departure is derived. It has to exist: the customise
 * form asks for both dates, and a visitor who only ever gives one is entitled to
 * know where the other came from.
 */
.ct-itin .field-hint {
	margin: 6px 0 0;
	font-size: 11.5px;
	line-height: 1.45;
	color: var(--muted);
}

/* ==========================================================================
   Booking widget — Adults / Children / Age in one row
   ==========================================================================
 * Two columns normally; three once there are children to give ages for. The age
 * column is added to the SAME row rather than pushed onto a new one, which is
 * the specific behaviour the reference calls for — the grid goes 2-col to 3-col
 * and the row does not break.
 *
 * The third column is a fixed 96px because its contents are always a short
 * "N yrs" select: giving it a fraction would steal width from the two dropdowns
 * that actually need it.
 */

.ct-itin .pax-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	align-items: start;
}

/*
 * The ages get a row to themselves rather than a third column.
 *
 * As a column they had a fixed 96px — enough for "N yrs" and nothing else — and
 * that width came off the two dropdowns beside them, which need it more. On
 * their own row they have the whole width to run across.
 *
 * The grid stays 1fr 1fr; only this item spans it.
 */
.ct-itin .pax-grid.has-ages .ct-ages-col {
	grid-column: 1 / -1;
}

/*
 * min-width:0 on the columns is load-bearing. A grid item's default min-width is
 * auto, so a long option string ("Pickup from Delhi airport, railway…") would
 * force the column wider than its track and push the whole row out of the
 * widget. This is the same guard the page already applies to .booking-form > *.
 */
.ct-itin .pax-grid > .field {
	min-width: 0;
}

/*
 * A full-width field inside the pax grid spans the PAX GRID.
 *
 * tour-responsive.css sets `.ct-itin .booking-form .full { grid-column: auto }`
 * below 900px. That is correct for the booking form's own children, which go to
 * three columns there — but it is a descendant selector, so it also lands on
 * this field, which is nested one grid deeper and knows nothing about that
 * change. The hotel dropdown lost its span and took half a row on every phone.
 *
 * Four classes, so it wins at every width rather than depending on stylesheet
 * order.
 */
.ct-itin .booking-form .pax-grid > .full {
	grid-column: 1 / -1;
}

/*
 * Line the dropdowns up when one label wraps and the other does not.
 *
 * "Children (0 to 12 yrs)" takes two lines in a narrow column while "Adults"
 * takes one, and the grid is align-items:start — so the taller label pushed its
 * select down and the two sat at different heights.
 *
 * align-self on the items, not align-items on the grid, so the top alignment
 * every other cell relies on is left exactly as it is. The age column is left
 * out because its stack is sized by its own max-height and stretching it would
 * fight that.
 */
.ct-itin .pax-grid > .field:not(.ct-ages-col) {
	align-self: stretch;
	display: flex;
	flex-direction: column;
}

.ct-itin .pax-grid > .field:not(.ct-ages-col) > select {
	margin-top: auto;
}

/*
 * Across the row and wrapping onto a second line when there are enough children
 * to need one.
 *
 * This used to be a scrolling vertical stack with a 96px ceiling, because in a
 * 96px column six ages would otherwise have made the row twice as tall as the
 * dropdowns beside it. On its own row there is nothing beside it to match, and
 * a list you have to scroll to reach the sixth child's age was the worst part of
 * that arrangement — every age is now visible at once.
 */
/*
 * The ages fill their row, split into as many columns as the child count wants.
 *
 * --ct-age-cols is set by syncAgeSlots() from the number of children: one, two
 * or three across as they come, then four splits into two columns so it reads
 * 2 + 2 instead of stranding the fourth alone under a row of three. Three is the
 * ceiling — the widget is about 300px wide on a phone and a fourth column leaves
 * each select too narrow for "12 yrs".
 *
 * The fallback of 3 matters: it is what applies for the moment between the
 * markup arriving and the script running.
 */
.ct-itin .ct-ages__stack {
	display: grid;
	grid-template-columns: repeat( var( --ct-age-cols, 3 ), minmax( 0, 1fr ) );
	gap: 6px;
}

/*
 * min-width:0 for the same reason the pax columns have it — a grid item defaults
 * to min-width:auto, and the select's own intrinsic width would otherwise stop
 * the track from shrinking and push the row out of the widget.
 */
.ct-itin .ct-age {
	display: block;
	min-width: 0;
}

/*
 * Shorter and tighter than the main fields — these sit three-to-a-column next to
 * a 44px control, so matching that height would make the row twice as tall.
 */
.ct-itin .ct-ages__stack select {
	width: 100%;
	height: 36px;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0 4px;
	font-family: inherit;
	font-size: 12px;
	color: var(--dark);
	background: #fff;
}

.ct-itin .ct-ages__stack select:focus-visible {
	outline: 2px solid var(--blue);
	outline-offset: 1px;
	border-color: var(--blue);
}

/* ==========================================================================
   Booking widget — buttons
   ==========================================================================
 * Book Now is full width and leaves the page. Customise and Enquire share one
 * row at 50/50 and feed the form further down.
 */

.ct-itin .book-now {
	width: 100%;
	margin-top: 4px;
}

.ct-itin .btn-row {
	display: flex;
	gap: 10px;
	margin-top: 10px;
}

.ct-itin .btn-row .btn {
	/* flex-basis 0 with min-width 0 makes the two halves genuinely equal
	   regardless of label length — otherwise the longer label takes more room. */
	flex: 1 1 0;
	min-width: 0;
	padding: 0 12px;
	font-size: 13.5px;
	text-align: center;
}

/* ==========================================================================
   "Your selection" summary card
   ==========================================================================
 * A sibling directly after the customise form, not a child of it: its markup
 * would otherwise sit among the theme's own fields, which this plugin does not
 * own, and would read as more of the form rather than as a summary of it.
 */

.ct-itin .ct-quote {
	/* Local tokens. .ct-itin declares the page palette, but this card is also
	   inserted next to the theme's form markup, so it states its own values
	   rather than depending on inheritance from a container it does not own. */
	--q-line: #E3E7EC;
	--q-ink: #1B2733;
	--q-muted: #6B7280;
	--q-accent: #F68B2D;

	/* Margin on top, not bottom: the card follows the form, so the gap it needs
	   is the one between the Send button and itself. */
	margin: 24px 0 0;
	border: 1px solid var(--q-line);
	border-radius: 14px;
	background: #fff;
	font-family: 'Inter', sans-serif;
	line-height: 1.5;
	overflow: hidden;
}

.ct-itin .ct-quote__head {
	display: flex;
	align-items: center;
	padding: 12px 18px;
	border-bottom: 1px solid var(--q-line);
	background: #F8FAFC;
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: 1.4px;
	text-transform: uppercase;
	color: var(--q-muted);
}

.ct-itin .ct-quote__head::before {
	content: '\2022';
	margin-right: 8px;
	color: var(--q-accent);
}

.ct-itin .ct-quote__body {
	padding: 6px 18px 14px;
}

/*
 * Label left, value right, with the rule between rows rather than around them —
 * a full border on each row reads as a table the visitor has to parse.
 */
.ct-itin .ct-quote__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 9px 0;
	border-bottom: 1px dashed var(--q-line);
}

.ct-itin .ct-quote__row:last-child {
	border-bottom: 0;
}

.ct-itin .ct-quote__k {
	flex: 0 0 auto;
	font-size: 13px;
	color: var(--q-muted);
}

.ct-itin .ct-quote__v {
	/* min-width:0 is what stops a long value from pushing the row wider than the
	   card instead of wrapping inside it. */
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
	font-weight: 600;
	color: var(--q-ink);
	text-align: right;
	overflow-wrap: anywhere;
}

/* The total is the one number the visitor is looking for, so it is the one thing
   here allowed to be loud. */
.ct-itin .ct-quote__row.is-total {
	margin-top: 4px;
	padding-top: 13px;
	border-top: 1px solid var(--q-line);
	border-bottom: 0;
}

.ct-itin .ct-quote__row.is-total .ct-quote__k {
	font-size: 14px;
	font-weight: 600;
	color: var(--q-ink);
}

.ct-itin .ct-quote__row.is-total .ct-quote__v {
	font-family: 'Poppins', sans-serif;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--q-accent);
}

/*
 * The caveat. Small, but not hidden: it is the line that keeps "Total" from
 * reading as a confirmed, payable amount, and that says children are counted at
 * the adult rate.
 */
.ct-itin .ct-quote__note {
	margin: 0;
	padding: 11px 18px;
	border-top: 1px solid var(--q-line);
	background: #F8FAFC;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--q-muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */


@media (max-width: 480px) {

	.ct-itin .ct-quote {
		margin-top: 20px;
		border-radius: 12px;
	}

	.ct-itin .ct-quote__head,
	.ct-itin .ct-quote__note {
		padding-left: 14px;
		padding-right: 14px;
	}

	.ct-itin .ct-quote__body {
		padding: 4px 14px 12px;
	}

	.ct-itin .ct-quote__row {
		display: block;
	}

	.ct-itin .ct-quote__v {
		display: block;
		margin-top: 2px;
		text-align: left;
	}

	.ct-itin .ct-quote__row.is-total .ct-quote__v {
		font-size: 20px;
	}

	/* Two buttons at 13.5px stop fitting side by side on a narrow phone. */
	.ct-itin .btn-row {
		flex-direction: column;
	}
}

/*
 * The currency label and the toggle stop fitting on one line on the narrowest
 * phones, so the label steps above the control rather than squeezing it.
 */
@media (max-width: 380px) {

	.ct-itin .row-between {
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;
	}

	.ct-itin .currency-toggle {
		width: 100%;
	}

	.ct-itin .currency-toggle__btn {
		flex: 1 1 0;
		padding: 7px 10px;
	}
}
