.s1m-portfolio,
.s1m-portfolio *,
.s1m-modal,
.s1m-modal * {
	box-sizing: border-box;
}

.s1m-portfolio {
	position: relative;
	width: 100%;
	padding: clamp(18px, 3vw, 38px);
	color: var(--s1m-text);
	background: var(--s1m-bg);
	border-radius: calc(var(--s1m-radius) + 8px);
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
}

.s1m-portfolio-header {
	max-width: 900px;
	margin: 0 auto clamp(28px, 4vw, 48px);
	text-align: center;
}

.s1m-portfolio-heading {
	margin: 0;
	color: var(--s1m-text);
	font: inherit;
	font-size: clamp(34px, 5vw, 58px);
	font-weight: 750;
	letter-spacing: -.045em;
	line-height: 1.04;
	text-wrap: balance;
}

.s1m-portfolio-heading::after {
	display: block;
	width: 46px;
	height: 3px;
	margin: 17px auto 0;
	background: var(--s1m-accent);
	border-radius: 999px;
	content: "";
}

.s1m-carousel-shell {
	position: relative;
}

.s1m-carousel {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--s1m-gap) * (var(--s1m-desktop) - 1))) / var(--s1m-desktop));
	gap: var(--s1m-gap);
	overflow-x: auto;
	padding: 2px;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
}

.s1m-carousel::-webkit-scrollbar {
	display: none;
}

.s1m-carousel:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--s1m-accent) 40%, transparent);
	outline-offset: 5px;
}

.s1m-project-card {
	min-width: 0;
	margin: 0;
	scroll-snap-align: start;
}

.s1m-project-trigger {
	display: grid;
	position: relative;
	width: 100%;
	min-height: clamp(360px, 36vw, 520px);
	padding: 0;
	overflow: hidden;
	color: #fff;
	background: var(--s1m-card);
	border: 0;
	border-radius: var(--s1m-radius);
	box-shadow: 0 15px 40px rgba(17, 18, 26, .1);
	cursor: pointer;
	font: inherit;
	text-align: left;
	isolation: isolate;
	-webkit-appearance: none;
	appearance: none;
}

.s1m-card-media,
.s1m-card-content {
	grid-area: 1 / 1;
}

.s1m-card-media {
	position: relative;
	min-height: inherit;
	overflow: hidden;
	background: linear-gradient(135deg, color-mix(in srgb, var(--s1m-accent) 85%, #fff), var(--s1m-overlay));
}

.s1m-card-media--placeholder::before,
.s1m-card-media--placeholder::after {
	content: "";
	position: absolute;
	width: 62%;
	aspect-ratio: 1;
	border: 1px solid rgba(255,255,255,.22);
	border-radius: 50%;
}

.s1m-card-media--placeholder::before {
	top: -18%;
	right: -22%;
}

.s1m-card-media--placeholder::after {
	left: -28%;
	bottom: -30%;
}

.s1m-card-media img {
	display: block;
	width: 100%;
	height: 100%;
	min-height: inherit;
	object-fit: cover;
	transition: transform .7s cubic-bezier(.2,.7,.2,1);
}

.s1m-card-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, color-mix(in srgb, var(--s1m-overlay) 90%, transparent) 0%, color-mix(in srgb, var(--s1m-overlay) 20%, transparent) 58%, transparent 100%);
	transition: opacity .35s ease;
}

.s1m-card-content {
	display: flex;
	position: relative;
	z-index: 1;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	min-width: 0;
	padding: clamp(24px, 3vw, 38px);
	pointer-events: none;
}

.s1m-card-date {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .12em;
	line-height: 1.35;
	text-transform: uppercase;
	opacity: .82;
}

.s1m-card-title {
	display: block;
	max-width: 100%;
	margin: 0;
	font-size: clamp(25px, 2.2vw, 38px);
	font-weight: 700;
	letter-spacing: -.035em;
	line-height: 1.08;
	overflow-wrap: anywhere;
}

.s1m-card-link {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	margin-top: 18px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.2;
}

.s1m-card-link span {
	transition: transform .25s ease;
}

.s1m-project-trigger:hover .s1m-card-media img,
.s1m-project-trigger:focus-visible .s1m-card-media img {
	transform: scale(1.045);
}

.s1m-project-trigger:hover .s1m-card-link span,
.s1m-project-trigger:focus-visible .s1m-card-link span {
	transform: translate(3px, -3px);
}

.s1m-project-trigger:focus-visible {
	outline: 3px solid var(--s1m-accent);
	outline-offset: 3px;
}

.s1m-carousel-arrow {
	display: grid;
	position: absolute;
	z-index: 2;
	top: 50%;
	place-items: center;
	width: 48px;
	height: 48px;
	padding: 0;
	color: var(--s1m-text);
	background: color-mix(in srgb, var(--s1m-card) 94%, transparent);
	border: 1px solid color-mix(in srgb, var(--s1m-text) 10%, transparent);
	border-radius: 50%;
	box-shadow: 0 10px 28px rgba(17, 18, 26, .16);
	cursor: pointer;
	transform: translateY(-50%);
	transition: transform .2s ease, background-color .2s ease, opacity .2s ease;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	-webkit-appearance: none;
	appearance: none;
}

.s1m-carousel-arrow:hover {
	color: var(--s1m-button-text);
	background: var(--s1m-accent);
	transform: translateY(-50%) scale(1.06);
}

.s1m-carousel-arrow:focus-visible,
.s1m-modal button:focus-visible,
.s1m-modal a:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--s1m-accent) 55%, #fff);
	outline-offset: 3px;
}

.s1m-carousel-arrow:disabled {
	opacity: .35;
	cursor: default;
}

.s1m-carousel-prev {
	left: -20px;
}

.s1m-carousel-next {
	right: -20px;
}

.s1m-carousel-arrow svg,
.s1m-modal-close svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.s1m-carousel-dots {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 7px;
	min-height: 10px;
	margin-top: 24px;
}

.s1m-carousel-dot {
	display: block;
	width: 8px;
	height: 8px;
	padding: 0;
	background: color-mix(in srgb, var(--s1m-muted) 35%, transparent);
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: width .25s ease, background-color .25s ease;
	-webkit-appearance: none;
	appearance: none;
}

.s1m-carousel-dot.is-active {
	width: 28px;
	background: var(--s1m-accent);
}

.s1m-modal[hidden] {
	display: none !important;
}

.s1m-modal {
	display: flex;
	position: fixed;
	z-index: 999999;
	inset: 0;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100vh;
	height: var(--s1m-viewport-height, 100dvh);
	min-height: 0;
	overflow: hidden;
	padding: clamp(12px, 3vw, 34px);
	color: var(--s1m-text);
	font-family: inherit;
	-webkit-font-smoothing: antialiased;
	overscroll-behavior: none;
	animation: s1mFadeIn .22s ease both;
}

.s1m-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 11, 16, .76);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
}

.s1m-modal-dialog {
	display: flex;
	position: relative;
	z-index: 1;
	flex-direction: column;
	width: min(1220px, 100%);
	max-height: min(900px, calc(var(--s1m-viewport-height, 100dvh) - clamp(24px, 6vw, 68px)));
	min-height: 0;
	overflow: hidden;
	color: var(--s1m-text);
	background: var(--s1m-card);
	border-radius: var(--s1m-popup-radius);
	box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
	animation: s1mModalIn .35s cubic-bezier(.2,.8,.2,1) both;
}

.s1m-modal-close {
	display: grid;
	position: absolute;
	z-index: 4;
	top: 16px;
	right: 16px;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--s1m-text);
	background: color-mix(in srgb, var(--s1m-card) 92%, transparent);
	border: 1px solid color-mix(in srgb, var(--s1m-text) 10%, transparent);
	border-radius: 50%;
	cursor: pointer;
	transition: transform .2s ease, background-color .2s ease;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	-webkit-appearance: none;
	appearance: none;
}

.s1m-modal-close:hover {
	background: var(--s1m-bg);
	transform: rotate(6deg) scale(1.04);
}

.s1m-modal-layout {
	display: grid;
	flex: 1 1 auto;
	grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
	height: min(720px, calc(var(--s1m-viewport-height, 100dvh) - clamp(24px, 6vw, 68px)));
	min-height: 0;
	max-height: inherit;
}

.s1m-modal-layout--no-media {
	display: block;
	min-height: auto;
}

.s1m-project-gallery {
	display: flex;
	min-width: 0;
	min-height: 0;
	padding: 18px;
	background: var(--s1m-bg);
	flex-direction: column;
}

.s1m-gallery-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 340px;
	overflow: hidden;
	background: color-mix(in srgb, var(--s1m-overlay) 6%, var(--s1m-bg));
	border-radius: calc(var(--s1m-popup-radius) - 8px);
}

.s1m-gallery-slide {
	position: absolute;
	inset: 0;
	animation: s1mImageIn .3s ease both;
}

.s1m-gallery-slide[hidden] {
	display: none;
}

.s1m-gallery-slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.s1m-gallery-arrow {
	position: absolute;
	z-index: 2;
	top: 50%;
	width: 44px;
	height: 44px;
	padding: 0;
	color: #fff;
	background: rgba(15, 16, 22, .6);
	border: 1px solid rgba(255,255,255,.18);
	border-radius: 50%;
	cursor: pointer;
	font: 300 34px/1 Arial, sans-serif;
	transform: translateY(-50%);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	-webkit-appearance: none;
	appearance: none;
}

.s1m-gallery-prev {
	left: 14px;
}

.s1m-gallery-next {
	right: 14px;
}

.s1m-gallery-count {
	position: absolute;
	z-index: 2;
	right: 14px;
	bottom: 14px;
	padding: 7px 11px;
	color: #fff;
	background: rgba(15, 16, 22, .62);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}

.s1m-gallery-thumbs {
	display: flex;
	flex: 0 0 auto;
	gap: 10px;
	margin-top: 12px;
	overflow-x: auto;
	padding: 2px 2px 6px;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

.s1m-gallery-thumb {
	flex: 0 0 70px;
	width: 70px;
	height: 58px;
	padding: 0;
	overflow: hidden;
	background: transparent;
	border: 2px solid transparent;
	border-radius: 10px;
	cursor: pointer;
	opacity: .65;
	transition: border-color .2s ease, opacity .2s ease, transform .2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.s1m-gallery-thumb:hover,
.s1m-gallery-thumb.is-active {
	border-color: var(--s1m-accent);
	opacity: 1;
	transform: translateY(-1px);
}

.s1m-gallery-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.s1m-project-info {
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	padding: clamp(40px, 5vw, 72px) clamp(30px, 4vw, 58px);
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.s1m-modal-layout--no-media .s1m-project-info {
	max-width: 820px;
	max-height: min(760px, calc(var(--s1m-viewport-height, 100dvh) - 48px));
	margin: 0 auto;
}

.s1m-project-info h2 {
	margin: 0 44px 28px 0;
	color: var(--s1m-text);
	font: inherit;
	font-size: clamp(32px, 4vw, 58px);
	font-weight: 750;
	letter-spacing: -.045em;
	line-height: 1.02;
}

.s1m-project-details {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1px;
	margin: 0 0 30px;
	overflow: hidden;
	background: color-mix(in srgb, var(--s1m-text) 10%, transparent);
	border: 1px solid color-mix(in srgb, var(--s1m-text) 10%, transparent);
	border-radius: 14px;
}

.s1m-project-detail {
	min-width: 0;
	padding: 16px;
	background: var(--s1m-card);
}

.s1m-project-detail dt,
.s1m-project-detail dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.s1m-project-detail dt {
	margin-bottom: 5px;
	color: var(--s1m-muted);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .09em;
	line-height: 1.3;
	text-transform: uppercase;
}

.s1m-project-detail dd {
	color: var(--s1m-text);
	font-size: 15px;
	font-weight: 650;
	line-height: 1.4;
}

.s1m-project-description {
	color: var(--s1m-muted);
	font-size: 16px;
	line-height: 1.72;
}

.s1m-project-description > :first-child {
	margin-top: 0;
}

.s1m-project-description > :last-child {
	margin-bottom: 0;
}

.s1m-project-description a {
	color: var(--s1m-accent);
}

.s1m-project-website {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 50px;
	margin-top: 30px;
	padding: 13px 22px;
	color: var(--s1m-button-text) !important;
	background: var(--s1m-accent);
	border-radius: 999px;
	font-size: 14px;
	font-weight: 750;
	line-height: 1.2;
	text-decoration: none !important;
	transition: transform .2s ease, box-shadow .2s ease;
}

.s1m-project-website:hover {
	box-shadow: 0 12px 26px color-mix(in srgb, var(--s1m-accent) 28%, transparent);
	transform: translateY(-2px);
}

html.s1m-modal-open,
body.s1m-modal-open {
	overflow: hidden !important;
	overscroll-behavior: none;
}

.s1m-portfolio-empty {
	margin: 0;
	padding: 18px 22px;
	color: #6f7280;
	background: #f6f7fb;
	border-radius: 14px;
}

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

@keyframes s1mModalIn {
	from { opacity: 0; transform: translateY(18px) scale(.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes s1mImageIn {
	from { opacity: 0; transform: scale(.995); }
	to { opacity: 1; transform: scale(1); }
}

@media (max-width: 1024px) {
	.s1m-carousel {
		grid-auto-columns: calc((100% - (var(--s1m-gap) * (var(--s1m-tablet) - 1))) / var(--s1m-tablet));
	}

	.s1m-modal-layout {
		grid-template-columns: minmax(0, 1fr) minmax(300px, .8fr);
	}

	.s1m-project-info {
		padding: 50px 30px 34px;
	}

	.s1m-project-details {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 767px) {
	.s1m-portfolio {
		padding: 12px;
		border-radius: calc(var(--s1m-radius) + 2px);
	}

	.s1m-carousel {
		grid-auto-columns: calc((100% - (var(--s1m-gap) * (var(--s1m-mobile) - 1))) / var(--s1m-mobile));
	}

	.s1m-project-trigger {
		min-height: 410px;
	}

	.s1m-carousel-arrow {
		display: none;
	}

	.s1m-modal {
		align-items: flex-end;
		height: 100vh;
		height: var(--s1m-viewport-height, 100dvh);
		padding: 8px 0 0;
		padding-top: max(8px, env(safe-area-inset-top));
	}

	.s1m-modal-dialog {
		width: 100%;
		height: 100%;
		max-height: none;
		border-radius: var(--s1m-popup-radius) var(--s1m-popup-radius) 0 0;
	}

	.s1m-modal-layout {
		display: block;
		flex: 1 1 auto;
		width: 100%;
		height: auto;
		min-height: 0;
		max-height: none;
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior-y: contain;
		-webkit-overflow-scrolling: touch;
	}

	.s1m-project-gallery {
		min-height: 0;
		padding: 10px;
		padding-right: max(10px, calc(env(safe-area-inset-right) + 6px));
		padding-left: max(10px, calc(env(safe-area-inset-left) + 6px));
	}

	.s1m-gallery-stage {
		height: min(56vh, 70vw);
		height: min(56dvh, 70vw);
		min-height: 0;
		max-height: 480px;
		aspect-ratio: auto;
	}

	.s1m-gallery-thumbs {
		margin-top: 8px;
	}

	.s1m-gallery-thumb {
		flex-basis: 58px;
		width: 58px;
		height: 48px;
	}

	.s1m-modal-close {
		position: absolute;
		top: 12px;
		right: 12px;
		right: max(12px, calc(env(safe-area-inset-right) + 8px));
		width: 48px;
		height: 48px;
	}

	.s1m-project-info,
	.s1m-modal-layout--no-media .s1m-project-info {
		max-height: none;
		overflow: visible;
		padding: 34px 22px 48px;
		padding-right: max(22px, calc(env(safe-area-inset-right) + 18px));
		padding-bottom: max(48px, calc(env(safe-area-inset-bottom) + 34px));
		padding-left: max(22px, calc(env(safe-area-inset-left) + 18px));
	}

	.s1m-project-info h2 {
		margin-bottom: 24px;
		font-size: clamp(31px, 10vw, 45px);
	}

	.s1m-project-details {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.s1m-gallery-arrow,
	.s1m-gallery-thumb,
	.s1m-project-website,
	.s1m-modal-close {
		touch-action: manipulation;
	}
}

@media (max-width: 767px) and (orientation: landscape) {
	.s1m-gallery-stage {
		height: min(52vh, 54vw);
		height: min(52dvh, 54vw);
		min-height: 180px;
	}
}

@media (max-width: 480px) {
	.s1m-project-details {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.s1m-portfolio *,
	.s1m-portfolio *::before,
	.s1m-portfolio *::after {
		scroll-behavior: auto !important;
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}
