/*
 * ux.css — Frontend enrichment (Batch 1, Level-0, zero-backend)
 * Hand-written CSS served at /static/css/ux.css.
 * (router maps r.Static("/static", "./assets"), so this file lives in assets/css.)
 *
 * Pairs with /static/js/ux.js. All effects are opt-in via data-* attributes
 * and degrade gracefully (no JS, no IntersectionObserver, reduced-motion).
 *
 * Prevent accidental horizontal page scroll from overflowing children
 * (e.g. cramped mobile headers). clip avoids breaking position:sticky.
 */
html,
body {
	overflow-x: clip;
	max-width: 100%;
}

/* Brand logo fallback: keep broken imgs hidden in dark mode (dark:block wins over .hidden) */
[data-brand-logo-fallback-active] img[data-brand-logo] {
	display: none !important;
}

/* ---- Scroll reveal -------------------------------------------------------
   Opt-in via [data-reveal]. ux.js adds .is-visible when the element scrolls
   into view. Optional per-item stagger via [data-reveal-delay] -> --reveal-delay. */
[data-reveal] {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.5s ease, transform 0.5s ease;
	transition-delay: var(--reveal-delay, 0ms);
	will-change: opacity, transform;
}
[data-reveal].is-visible {
	opacity: 1;
	transform: none;
}

/* ---- Lazy image fade -----------------------------------------------------
   Opt-in via [data-fade] on <img>. Gated on html.ux-ready so images stay
   visible if JS is disabled. ux.js adds .img-loaded once the image loads. */
html.ux-ready img[data-fade] {
	opacity: 0;
	transition: opacity 0.5s ease;
}
html.ux-ready img[data-fade].img-loaded {
	opacity: 1;
}

/* ---- HTMX request affordance --------------------------------------------
   A subtle progress cursor while any HTMX request is in flight. */
.htmx-request {
	cursor: progress;
}

/* Count-up numbers use tabular figures so width does not jitter while animating. */
[data-countup] {
	font-variant-numeric: tabular-nums;
}

/* Sidebar scroll affordance — fade hints at more items below the fold. */
.sidebar-nav-scroll {
	mask-image: linear-gradient(to bottom, black calc(100% - 2rem), transparent);
	-webkit-mask-image: linear-gradient(to bottom, black calc(100% - 2rem), transparent);
}

/* Sticky table columns for wide admin tables (horizontal scroll). */
.table-sticky-start {
	position: sticky;
	inset-inline-start: 0;
	z-index: 10;
	background-color: hsl(var(--background));
}
.table-sticky-end {
	position: sticky;
	inset-inline-end: 0;
	z-index: 10;
	background-color: hsl(var(--background));
}
th.table-sticky-start,
th.table-sticky-end {
	z-index: 20;
}

/* Suppress color transitions during theme toggle to prevent header flash. */
html.no-transitions,
html.no-transitions * {
	transition: none !important;
}

/* Search map hotel popup card (Leaflet) — token colors for light + dark */
.munj-map-popup .leaflet-popup-content-wrapper {
	padding: 0;
	overflow: hidden;
	border-radius: 12px;
	background: hsl(var(--card));
	color: hsl(var(--card-foreground));
	box-shadow: 0 10px 30px hsl(var(--foreground) / 0.18);
}
.munj-map-popup .leaflet-popup-content {
	margin: 0;
	line-height: 1.35;
	color: inherit;
}
.munj-map-popup .leaflet-popup-tip {
	background: hsl(var(--card));
}
.munj-map-popup a.leaflet-popup-close-button {
	color: hsl(var(--muted-foreground)) !important;
}
.munj-map-popup a.leaflet-popup-close-button:hover {
	color: hsl(var(--foreground)) !important;
}

.munj-map-hotel-card {
	width: 240px;
	background: hsl(var(--card));
	color: hsl(var(--card-foreground));
	font-family: inherit;
}
.munj-map-hotel-card__media {
	display: block;
	width: 100%;
	height: 120px;
	overflow: hidden;
	background: hsl(var(--muted));
}
.munj-map-hotel-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.munj-map-hotel-card__body {
	padding: 10px 12px 12px;
}
.munj-map-hotel-card__stars {
	color: hsl(var(--rating));
	font-size: 12px;
	letter-spacing: 1px;
	line-height: 1;
}
.munj-map-hotel-card__name {
	margin-top: 4px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	color: hsl(var(--card-foreground));
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.munj-map-hotel-card__location {
	margin-top: 4px;
	font-size: 11px;
	color: hsl(var(--muted-foreground));
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.munj-map-hotel-card__rating {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-top: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: hsl(var(--muted));
	font-size: 11px;
	font-weight: 600;
	color: hsl(var(--foreground));
}
.munj-map-hotel-card__rating-label {
	color: hsl(var(--muted-foreground));
	font-weight: 500;
}
.munj-map-hotel-card__price {
	margin-top: 8px;
	font-size: 16px;
	font-weight: 700;
	color: hsl(var(--card-foreground));
	font-variant-numeric: tabular-nums;
}
.munj-map-hotel-card__cta {
	display: inline-flex;
	margin-top: 10px;
	padding: 6px 10px;
	border-radius: 8px;
	background: hsl(var(--primary));
	color: hsl(var(--primary-foreground));
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}
.munj-map-hotel-card__cta:hover {
	opacity: 0.92;
}

/* ---- Reduced motion ------------------------------------------------------
   Honor the user's OS preference: no reveal/fade/view-transition animations. */
@media (prefers-reduced-motion: reduce) {
	[data-reveal],
	html.ux-ready img[data-fade] {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	::view-transition-group(*),
	::view-transition-old(*),
	::view-transition-new(*) {
		animation: none !important;
	}
}
