/**
 * MrStiff Interactive Content — front-end styles.
 *
 * Two columns: main image + content on the left, a clickable thumbnail list on
 * the right. The active item is highlighted; switching animates the main image
 * and the content block.
 */

.msic {
	--msic-speed: 400ms;
	display: flex;
	align-items: flex-start;
	gap: 32px;
	width: 100%;
	box-sizing: border-box;
}

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

.msic__left {
	flex: 1 1 45%;
	min-width: 0;
}

.msic__right {
	flex: 1 1 55%;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* -------------------------------------------------------------------------
 * Main image
 * ---------------------------------------------------------------------- */
.msic-main {
	position: relative;
	width: 100%;
	overflow: hidden;
	border: 1px solid #ececec;
	border-radius: 12px;
	background: #fff;
	font-size: 0; /* remove inline whitespace under the image */
}

/*
 * The main image sizes to its natural aspect ratio by default, so the frame
 * never leaves empty space. When a fixed ratio is set on the widget
 * (--msic-main-ratio) the image fills that frame with object-fit: cover.
 */
.msic-main__img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	user-select: none;
}

.msic-main.msic-main--ratio {
	aspect-ratio: var(--msic-main-ratio, 1 / 1);
}

.msic-main--ratio .msic-main__img {
	position: absolute;
	inset: 0;
	height: 100%;
}

/* -------------------------------------------------------------------------
 * Header (fixed content)
 * ---------------------------------------------------------------------- */
.msic-header__title {
	margin: 0 0 10px;
	font-size: 22px;
	line-height: 1.25;
	font-weight: 700;
}

.msic-header__intro {
	font-size: 15px;
	line-height: 1.6;
	color: #555;
}

.msic-header__intro p {
	margin: 0 0 10px;
}

.msic-header__intro p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Thumbnails — horizontal slider
 * ---------------------------------------------------------------------- */
.msic-thumbs-slider {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.msic-thumbs__viewport {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	/* Allow vertical page scrolling; horizontal gestures drag the rail. */
	touch-action: pan-y;
}

.msic-thumbs__viewport.is-draggable {
	cursor: grab;
}

.msic-thumbs__viewport.is-dragging {
	cursor: grabbing;
	user-select: none;
}

/* The track follows the pointer 1:1 while dragging. */
.msic-thumbs__viewport.is-dragging .msic-thumbs {
	transition: none;
}

.msic-thumbs {
	--msic-thumbs-per-view: 3;
	--msic-thumbs-gap: 10px;
	display: flex;
	flex-wrap: nowrap;
	gap: var(--msic-thumbs-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	transition: transform .35s ease;
	will-change: transform;
}

/* Each slide is an equal fraction of the viewport, so N fit exactly. */
.msic-thumb {
	flex: 0 0 calc((100% - (var(--msic-thumbs-per-view) - 1) * var(--msic-thumbs-gap)) / var(--msic-thumbs-per-view));
	min-width: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	background: #f2f2f3;
	border-radius: 10px;
	cursor: pointer;
	transition: background-color .25s ease, color .25s ease, box-shadow .25s ease;
	outline: none;
}

/* Slider arrows */
.msic-thumbs__nav {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid #e2e2e4;
	border-radius: 50%;
	background: #fff;
	color: #1f1f1f;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}

.msic-thumbs__nav:hover {
	background: #1f1f1f;
	color: #fff;
}

.msic-thumbs__nav[disabled] {
	opacity: .3;
	cursor: default;
	pointer-events: none;
}

.msic-thumbs__nav[hidden] {
	display: none;
}

.msic-thumb:hover {
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.msic-thumb:focus-visible {
	box-shadow: 0 0 0 2px rgba(31, 31, 31, .4);
}

.msic-thumb.is-active {
	background: #1f1f1f;
}

.msic-thumb__img {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
}

.msic-thumb__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.msic-thumb__label {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	color: #1f1f1f;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.msic-thumb.is-active .msic-thumb__label {
	color: #fff;
}

/* -------------------------------------------------------------------------
 * Content block
 * ---------------------------------------------------------------------- */
.msic-content {
	border: 1px solid #e6e6e6;
	border-radius: 10px;
	padding: 16px 18px;
}

.msic-content__title {
	margin: 0 0 6px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
}

.msic-content__subtitle {
	margin-bottom: 6px;
	font-size: 14px;
	color: #777;
}

.msic-content__desc {
	font-size: 14px;
	line-height: 1.6;
	color: #555;
}

.msic-content__desc p {
	margin: 0 0 8px;
}

.msic-content__desc p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Button
 * ---------------------------------------------------------------------- */
.msic-btn {
	display: inline-block;
	margin-top: 14px;
	padding: 10px 18px;
	border: 1px solid transparent;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: opacity .2s ease, background-color .2s ease, color .2s ease;
}

.msic-btn--filled {
	background: #1f1f1f;
	border-color: #1f1f1f;
	color: #fff;
}

.msic-btn--outline {
	background: transparent;
	border-color: #1f1f1f;
	color: #1f1f1f;
}

.msic-btn--text {
	margin-top: 12px;
	padding: 0;
	border: 0;
	border-radius: 0;
	color: #1f1f1f;
	text-decoration: underline;
}

.msic-btn:hover {
	opacity: .88;
}

/* -------------------------------------------------------------------------
 * Transition animations (applied by JS on switch)
 * ---------------------------------------------------------------------- */
.msic--anim-fade .msic-animating {
	animation: msicFade var(--msic-speed) ease both;
}

.msic--anim-slide .msic-animating {
	animation: msicSlide var(--msic-speed) ease both;
}

.msic--anim-zoom .msic-animating {
	animation: msicZoom var(--msic-speed) ease both;
}

@keyframes msicFade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes msicSlide {
	from { opacity: 0; transform: translateX(26px); }
	to   { opacity: 1; transform: none; }
}

@keyframes msicZoom {
	from { opacity: 0; transform: scale(.94); }
	to   { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------------------
 * Misc
 * ---------------------------------------------------------------------- */
.msic-notice {
	padding: 14px 16px;
	border: 1px dashed #e0e0e0;
	border-radius: 10px;
	color: #777;
	background: #fafafa;
	font-size: 14px;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */
@media (max-width: 1024px) {
	.msic {
		gap: 24px;
	}
}

@media (max-width: 767px) {
	.msic {
		flex-direction: column;
	}

	.msic__left,
	.msic__right {
		flex: 1 1 100%;
		width: 100%;
	}

	.msic-thumbs {
		--msic-thumbs-per-view: 2;
	}
}

@media (max-width: 420px) {
	.msic-thumbs {
		--msic-thumbs-per-view: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.msic .msic-animating {
		animation: none !important;
	}
}
