/*
 * TalentAstro / DIVSA — Layout Studio (v4.9.48, Phase 4B).
 *
 * Maps the admin's choices (custom properties + body classes printed by
 * TAP_Layout) onto the class names the app already renders. Nothing here
 * invents a new component and nothing here uses !important — the nine UI
 * presets must still be able to win where they are supposed to.
 *
 * Loads last, and only on DIVSA pages.
 */

/* ── Date & time selector cards ──────────────────────────────────────────
 * `.tap-slots` was a one-column flex list with a fixed card size. It is now a
 * grid whose column count and card scale come from the admin.
 */
.tap-lay .tap-slots {
	display: grid;
	grid-template-columns: var(--tap-slot-cols, 1fr);
	gap: 10px;
	margin-top: 12px;
}

.tap-lay .tap-slot {
	padding: var(--tap-slot-pad, 14px 16px);
	min-width: var(--tap-slot-min, 100px);
	border-radius: var(--tap-slot-radius, 14px);
	margin: 0;                       /* the grid owns the spacing now */
}

.tap-lay .tap-slot2-date {
	min-width: var(--tap-slot-date, 48px);
}

.tap-lay .tap-slot2-num {
	font-size: var(--tap-slot-num, 21px);
}

.tap-lay .tap-slot2-time {
	font-size: var(--tap-slot-time, 13px);
}

/* Small cards in multiple columns: the seats line is the first thing to go —
 * it wraps, and a wrapped card in a 3-column grid drags the whole row taller. */
.tap-lay.tap-slot-sm.tap-slotcols-3 .tap-slot2-seats {
	font-size: 10px;
}

/* Optional information. Hidden, not deleted — the countdown keeps running and
 * keeps firing `tap-slot-expired`, so a slot that closes still closes. */
.tap-no-seats .tap-slot2-seats { display: none; }
.tap-no-countdown .tap-countdown,
.tap-no-countdown .tap-slot-countdown,
.tap-no-countdown .tap-slot2-countdown { display: none; }

/* ── Cards & density ────────────────────────────────────────────────────── */
.tap-density-compact .tap-section { margin-bottom: var(--tap-section-gap, 20px); }
.tap-density-compact .tap-card,
.tap-density-compact .tap-pkg { padding: var(--tap-card-pad, 12px 14px); }
.tap-lay .tap-card,
.tap-lay .tap-pkg { border-radius: var(--tap-card-radius, 16px); }

/* ── Gallery: shared ────────────────────────────────────────────────────── */
.tap-lay .tap-gallery img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 10px;
}

.tap-lay .tap-gthumb {
	aspect-ratio: var(--tap-gallery-ratio, 4 / 3);
	display: block;
	overflow: hidden;
	border-radius: 10px;
	background: #f3eefa;
}

/* natural → let the image decide */
.tap-lay .tap-gallery[data-ratio="auto"] .tap-gthumb { aspect-ratio: auto; }

/* ── Gallery: grid (default) ────────────────────────────────────────────── */
.tap-gal-grid .tap-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}

/* ── Gallery: masonry — pure CSS, photos keep their own shape ───────────── */
.tap-gal-masonry .tap-gallery {
	column-count: 3;
	column-gap: 10px;
}

.tap-gal-masonry .tap-gthumb {
	aspect-ratio: auto;
	break-inside: avoid;
	margin-bottom: 10px;
}

.tap-gal-masonry .tap-gallery img { height: auto; }

@media (max-width: 700px) {
	.tap-gal-masonry .tap-gallery { column-count: 2; }
}

/* ── Gallery: lightbox grid ─────────────────────────────────────────────── */
.tap-gal-lightbox .tap-gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}

.tap-gal-lightbox .tap-gthumb { cursor: zoom-in; }

.tap-lb {
	position: fixed;
	inset: 0;
	z-index: 200;
	background: rgba(14, 4, 24, .92);
	display: grid;
	place-items: center;
	padding: 24px;
}

.tap-lb img {
	max-width: 92vw;
	max-height: 86vh;
	border-radius: 12px;
}

.tap-lb-x,
.tap-lb-prev,
.tap-lb-next {
	position: absolute;
	background: rgba(255, 255, 255, .12);
	color: #fff;
	border: 0;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 20px;
	cursor: pointer;
}

.tap-lb-x { top: 18px; right: 18px; }
.tap-lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.tap-lb-next { right: 14px; top: 50%; transform: translateY(-50%); }

/* ── Gallery: carousel (Flipkart style) ─────────────────────────────────
 * Thumbnail rail beside a large main image. On a phone the rail moves under
 * the image and turns horizontal — a vertical rail on a 380px screen steals
 * half the width from the thing people came to look at.
 */
.tap-gal-carousel .tap-gallery {
	display: grid;
	grid-template-columns: 72px 1fr;
	gap: 12px;
	align-items: start;
}

.tap-gal-carousel .tap-gal-rail {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 420px;
	overflow-y: auto;
	scrollbar-width: thin;
}

.tap-gal-carousel .tap-gal-rail .tap-gthumb {
	aspect-ratio: 1 / 1;
	border: 2px solid transparent;
	opacity: .72;
	transition: opacity .15s ease, border-color .15s ease;
}

.tap-gal-carousel .tap-gal-rail .tap-gthumb.is-active,
.tap-gal-carousel .tap-gal-rail .tap-gthumb:hover {
	opacity: 1;
	border-color: var(--tap-purple, #6109be);
}

.tap-gal-carousel .tap-gal-main {
	position: relative;
	aspect-ratio: var(--tap-gallery-ratio, 4 / 3);
	overflow: hidden;
	border-radius: 14px;
	background: #f3eefa;
}

.tap-gal-carousel .tap-gal-main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Hover zoom — desktop only. On a touch screen there is no hover, and a
 * transform that never resets is a photo the devotee cannot see. */
@media (hover: hover) {
	.tap-gal-zoom .tap-gal-main img {
		transition: transform .25s ease;
	}
	.tap-gal-zoom .tap-gal-main:hover img {
		transform: scale(1.6);
	}
}

@media (max-width: 700px) {
	.tap-gal-carousel .tap-gallery {
		grid-template-columns: 1fr;
	}
	.tap-gal-carousel .tap-gal-rail {
		flex-direction: row;
		max-height: none;
		overflow-x: auto;
		order: 2;
	}
	.tap-gal-carousel .tap-gal-rail .tap-gthumb { flex: 0 0 62px; }
	.tap-gal-carousel .tap-gal-main { order: 1; }
}

/* ── Gallery: full-width swipeable slider ───────────────────────────────── */
.tap-gal-slider .tap-gallery {
	display: block;
	position: relative;
}

.tap-gal-slider .tap-gal-track {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.tap-gal-slider .tap-gal-track::-webkit-scrollbar { display: none; }

.tap-gal-slider .tap-gal-track .tap-gthumb {
	flex: 0 0 100%;
	scroll-snap-align: center;
	aspect-ratio: var(--tap-gallery-ratio, 4 / 3);
}

.tap-gal-slider .tap-gal-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
}

.tap-gal-slider .tap-gal-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #ded4ea;
	border: 0;
	padding: 0;
	cursor: pointer;
}

.tap-gal-slider .tap-gal-dot.is-active {
	background: var(--tap-purple, #6109be);
	width: 18px;
	border-radius: 999px;
}

/* ── Motion level (Layout Studio → Motion) — v6.9.4 (P6) ─────────────────────
   Admin-chosen animation level as a body class. 'full' adds no class (the
   shipped feel). 'subtle' quickens and calms motion; 'off' removes it entirely
   (fastest, and the most accessible — it also reinforces a device already set
   to "reduce motion"). Scoped to the body class, so only DIVSA pages that opt
   in are affected. */
.tap-motion-subtle *,
.tap-motion-subtle *::before,
.tap-motion-subtle *::after {
	animation-duration: .18s !important;
	transition-duration: .12s !important;
}
.tap-motion-off *,
.tap-motion-off *::before,
.tap-motion-off *::after {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}

/* ══ Booking experience formats (Layout Studio → Booking experience) — P6d ═══
   ONE curated, coherent presentation the whole journey inherits. Presentation
   only — rhythm, scale, density. Brand colour stays with the Brand Customizer;
   step order stays with Flow Builder. 'signature' is the baseline (no rules).
   Scoped to the tap-fmt-* body class, no !important, so the UI presets and the
   Customizer still win where they should, and any client colour is respected. */

/* ── Compact — dense & app-like, fits noticeably more per screen (Swiggy/Zepto
      efficiency). Tighter vertical rhythm, smaller hero, denser imagery. ── */
.tap-fmt-compact .tap-problem-search { padding: 22px 0; }
.tap-fmt-compact .tap-home-section,
.tap-fmt-compact .tap-section { margin-bottom: 22px; }
.tap-fmt-compact .tap-section-head { margin-bottom: 12px; }
.tap-fmt-compact .tap-display { font-size: clamp(24px, 4.2vw, 40px); }
.tap-fmt-compact .tap-deity-grid { gap: 12px; }
.tap-fmt-compact .tap-deity-icon { width: 54px; height: 54px; font-size: 24px; }
.tap-fmt-compact .tap-deity-name { font-size: 11px; }

/* ── Devotional — spacious & warm, temple-first storytelling (Sri Mandir / VAMA
      warmth). Generous rhythm, larger hero and imagery, a soft gold wash on the
      discovery header drawn from the brand palette (not a hardcoded colour). ── */
.tap-fmt-devotional .tap-problem-search {
	padding: 60px 0;
	background: linear-gradient(180deg, var(--tap-gold-light, #FFF8E7), transparent);
}
.tap-fmt-devotional .tap-home-section,
.tap-fmt-devotional .tap-section { margin-bottom: 46px; }
.tap-fmt-devotional .tap-section-head { margin-bottom: 26px; }
.tap-fmt-devotional .tap-display { font-size: clamp(32px, 6vw, 60px); }
.tap-fmt-devotional .tap-deity-grid { gap: 22px; }
.tap-fmt-devotional .tap-deity-icon { width: 76px; height: 76px; font-size: 34px; }
.tap-fmt-devotional .tap-deity-name { font-size: 13px; }

/* Format targeting for the booking page's real classes (hero = .tap-headline,
   intent search = .tap-search-box, blocks = .tap-section). The home-page
   selectors above cover /puja-home/; these cover /book/. */
.tap-fmt-compact .tap-headline { font-size: clamp(24px, 4vw, 38px); }
.tap-fmt-compact .tap-section { margin-bottom: 20px; }
.tap-fmt-compact .tap-search-suggestions { margin: 8px 0; }
.tap-fmt-compact .tap-ptabs { margin-bottom: 10px; }

/* v6.9.10 (QA #6): the Compact format now scales the listing CARDS too, not
   just the section rhythm. Before, only the image shrank (via card size) and
   the card kept its full footprint — a small picture floating in a large
   empty card. The whole card contracts together here: image, width, padding,
   button. Custom properties, so an explicit admin card-size still wins where
   it sets a smaller value. */
.tap-fmt-compact .tap-thumb { height: 118px; }
.tap-fmt-compact .tap-pcard .tap-body { padding: 10px 12px 12px; }
.tap-fmt-compact .tap-pcard h3 { font-size: 14px; margin: 0 0 4px; }
.tap-fmt-compact .tap-book-btn-sm { padding: 9px 12px; font-size: 13px; }
.tap-fmt-compact .tap-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
/* Below the desktop breakpoint the scroller is a horizontal snap row —
   narrower cards fit one more per screen. At ≥1024px tap-premium turns the
   scroller into a fluid grid (min-width:0), which must keep winning — so the
   fixed width applies only under 1024px, and the desktop grid just gets a
   denser column minimum. */
@media (max-width: 1023px) {
	.tap-fmt-compact .tap-root .tap-section-scroller .tap-pcard { min-width: 208px; max-width: 208px; }
}
@media (min-width: 1024px) {
	.tap-fmt-compact .tap-root .tap-section-scroller { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); }
}
@media (max-width: 600px) {
	.tap-fmt-compact .tap-thumb { height: 92px; }
	.tap-fmt-compact .tap-root .tap-section-scroller .tap-pcard { min-width: 62vw; max-width: 62vw; }
}

.tap-fmt-devotional .tap-headline { font-size: clamp(34px, 6.5vw, 64px); line-height: 1.12; }
.tap-fmt-devotional .tap-section { margin-bottom: 44px; }
.tap-fmt-devotional .tap-search-box {
	margin-top: 18px; padding-top: 16px; padding-bottom: 16px;
	box-shadow: 0 10px 34px rgba(249,144,0,.16), var(--tap-shadow);
}
.tap-fmt-devotional .tap-search-suggestions { margin: 18px 0; gap: 10px; }
.tap-fmt-devotional .tap-ptabs { margin-bottom: 22px; }
