/* ==========================================================================
   LM Image Slider
   Mobile-first. No framework, no jQuery. Swiping is native scroll-snap,
   so the slider keeps working even if JavaScript fails to load.
   ========================================================================== */

.lmis {
	--lmis-desktop: 3;
	--lmis-tablet: 2;
	--lmis-mobile: 1.15;
	--lmis-n: var(--lmis-mobile);
	--lmis-gap: 24px;
	--lmis-ratio: 3/4;
	--lmis-fit: cover;
	--lmis-radius: 16px;
	--lmis-card-bg: #f7f2e8;
	--lmis-desc-size: 14px;
	--lmis-ink: #2b2320;
	--lmis-pill-bg: #ffffff;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
}

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

/* --- Track ---------------------------------------------------------------- */

.lmis-viewport {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

.lmis-track {
	display: flex;
	gap: var(--lmis-gap);
	margin: 0;
	padding: 0 0 4px;
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
}

.lmis-track::-webkit-scrollbar {
	display: none;
}

.lmis-track > .lmis-slide {
	flex: 0 0 calc((100% - (var(--lmis-n) - 1) * var(--lmis-gap)) / var(--lmis-n));
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

.lmis-track > .lmis-slide::before,
.lmis-track > .lmis-slide::marker {
	content: none;
}

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

.lmis-card {
	position: relative;
	margin: 0;
	height: 100%;
	border-radius: var(--lmis-radius);
	background: var(--lmis-card-bg);
	overflow: hidden;
	outline-offset: 3px;
}

.lmis-media {
	position: relative;
	width: 100%;
	aspect-ratio: var(--lmis-ratio);
	overflow: hidden;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 3/4) {
	.lmis-media {
		height: 0;
		padding-top: 125%;
	}
	.lmis-media > * {
		position: absolute;
		inset: 0;
	}
}

/* The rules that keep the image visible on every screen size.
   !important is deliberate: themes commonly force img { height: auto }
   or max-width rules that collapse the slide on small viewports. */
.lmis-media .lmis-img,
.lmis-media img {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	object-fit: var(--lmis-fit);
	object-position: center;
	transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.lmis-noimg {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 13px;
	color: #9a8f86;
}

/* --- Name pill ------------------------------------------------------------ */

.lmis-name {
	position: absolute;
	left: 50%;
	bottom: 16px;
	z-index: 3;
	transform: translateX(-50%);
	max-width: calc(100% - 24px);
	padding: 9px 20px;
	border-radius: 999px;
	background: var(--lmis-pill-bg);
	color: var(--lmis-ink);
	font-size: 15px;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-shadow: 0 2px 10px rgba(43, 35, 32, 0.12);
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

/* --- Hover description ---------------------------------------------------- */

.lmis-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 22px 18px 68px;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.45) transparent;
	background: linear-gradient(180deg, rgba(43, 35, 32, 0.62) 0%, rgba(43, 35, 32, 0.88) 100%);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lmis-desc {
	margin: auto 0;
	width: 100%;
	color: #fff;
	font-size: var(--lmis-desc-size, 14px);
	line-height: 1.55;
	text-align: center;
	transform: translateY(10px);
	transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --- Rich text inside the hover description ------------------------------- */

.lmis-desc > *:first-child { margin-top: 0; }
.lmis-desc > *:last-child  { margin-bottom: 0; }

.lmis-desc p {
	margin: 0 0 0.7em;
	color: inherit;
	font-size: inherit;
	line-height: inherit;
}

.lmis-desc h2,
.lmis-desc h3,
.lmis-desc h4,
.lmis-desc h5,
.lmis-desc .lmis-h {
	margin: 0 0 0.35em;
	color: #fff;
	font-size: 1.15em;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.01em;
}

.lmis-desc .lmis-tagline {
	margin-bottom: 0.8em;
	font-size: 0.95em;
	font-style: italic;
	opacity: 0.92;
}

.lmis-desc .lmis-meta {
	margin-top: 0.85em;
	padding-top: 0.7em;
	border-top: 1px solid rgba(255, 255, 255, 0.28);
	font-size: 0.85em;
	line-height: 1.5;
	opacity: 0.9;
}

.lmis-desc strong,
.lmis-desc b { font-weight: 600; }

.lmis-desc em,
.lmis-desc i { font-style: italic; }

.lmis-desc ul,
.lmis-desc ol {
	margin: 0 0 0.7em;
	padding-left: 1.1em;
	text-align: left;
	list-style-position: outside;
}

.lmis-desc ul { list-style: disc; }
.lmis-desc ol { list-style: decimal; }

.lmis-desc li {
	margin: 0 0 0.25em;
	padding: 0;
	color: inherit;
}

.lmis-desc li::marker { color: rgba(255, 255, 255, 0.7); }

.lmis-desc a {
	color: #fff;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.lmis-desc hr {
	height: 1px;
	margin: 0.8em 0;
	border: 0;
	background: rgba(255, 255, 255, 0.28);
}

@media (hover: hover) and (pointer: fine) {
	.lmis-card:hover .lmis-overlay,
	.lmis-card:focus-visible .lmis-overlay {
		opacity: 1;
		visibility: visible;
	}
	.lmis-card:hover .lmis-desc,
	.lmis-card:focus-visible .lmis-desc {
		transform: translateY(0);
	}
	.lmis-card:hover .lmis-img {
		transform: scale(1.04);
	}
	.lmis-card:hover .lmis-name {
		box-shadow: 0 6px 18px rgba(43, 35, 32, 0.2);
	}
}

/* Touch screens: tap the card to reveal, tap again to hide. */
.lmis-card.is-open .lmis-overlay {
	opacity: 1;
	visibility: visible;
}

.lmis-card.is-open .lmis-desc {
	transform: translateY(0);
}

.lmis-card:focus-visible {
	outline: 2px solid var(--lmis-ink);
}

/* --- Arrows --------------------------------------------------------------- */

.lmis-arrow {
	position: absolute;
	top: calc(50% - 22px);
	z-index: 4;
	display: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--lmis-ink);
	cursor: pointer;
	box-shadow: 0 3px 14px rgba(43, 35, 32, 0.18);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.lmis-arrow svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.lmis-arrow--prev { left: -14px; }
.lmis-arrow--next { right: -14px; }

.lmis-arrow:hover { transform: scale(1.06); }

.lmis-arrow[disabled] {
	opacity: 0;
	pointer-events: none;
}

/* --- Dots ----------------------------------------------------------------- */

.lmis-dots {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 18px;
}

.lmis-dots:empty {
	display: none;
}

.lmis-dot {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(43, 35, 32, 0.22);
	cursor: pointer;
	transition: background 0.25s ease, width 0.25s ease;
}

.lmis-dot.is-active {
	width: 22px;
	border-radius: 999px;
	background: var(--lmis-ink);
}

/* --- Breakpoints ---------------------------------------------------------- */

@media (min-width: 768px) {
	.lmis {
		--lmis-n: var(--lmis-tablet);
	}
	.lmis-name {
		font-size: 16px;
		bottom: 20px;
	}
}

@media (min-width: 1025px) {
	.lmis {
		--lmis-n: var(--lmis-desktop);
	}
	.lmis-overlay {
		padding: 26px 24px 74px;
	}
	.lmis-arrow {
		display: grid;
		place-items: center;
	}
	.lmis-dots {
		margin-top: 22px;
	}
}

/* Give the arrows room when the slider runs edge to edge */
@media (min-width: 1025px) and (max-width: 1200px) {
	.lmis-arrow--prev { left: 8px; }
	.lmis-arrow--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.lmis-track { scroll-behavior: auto; }
	.lmis-img,
	.lmis-desc,
	.lmis-overlay,
	.lmis-arrow { transition: none; }
	.lmis-card:hover .lmis-img { transform: none; }
}

/* Admin-only notice when no slides exist */
.lmis-empty {
	padding: 16px 18px;
	border: 1px dashed #c9bfb4;
	border-radius: 10px;
	background: #fbf8f2;
	font-size: 14px;
}
