/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V5 */
/* ==========================================================================
   KS LP Instagram Block Styles
   Responsive Grid, Reels Indicator, Profile Header, Filter Tabs, Lightbox
   ========================================================================== */

.kslp-ig-block {
	position: relative;
	width: 100%;
	box-sizing: border-box;
	overflow-x: clip;
}

.kslp-ig-container {
	margin: 0 auto;
	box-sizing: border-box;
	position: relative;
	z-index: 2;
	width: 100%;
}

/* Full Width Container Option */
.kslp-ig-block--full {
	width: 100vw !important;
	max-width: 100vw !important;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
}

/* --------------------------------------------------------------------------
   Section Header
   -------------------------------------------------------------------------- */
.kslp-ig-header {
	margin-bottom: 32px;
	box-sizing: border-box;
}

.kslp-ig-header--center { text-align: center; }
.kslp-ig-header--left   { text-align: left; }
.kslp-ig-header--right  { text-align: right; }

.kslp-ig-sub {
	display: inline-block;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin: 0 0 8px 0;
	font-style: normal;
}

.kslp-ig-title {
	font-size: clamp(24px, 4vw, 36px);
	font-weight: 800;
	line-height: 1.25;
	margin: 0 0 12px 0;
	font-style: normal;
	overflow-wrap: anywhere;
}

.kslp-ig-desc {
	font-size: clamp(14px, 2vw, 16px);
	line-height: 1.6;
	margin: 0;
	max-width: 680px;
	display: inline-block;
	font-style: normal;
}

.kslp-ig-header--center .kslp-ig-desc {
	margin-left: auto;
	margin-right: auto;
}

/* --------------------------------------------------------------------------
   Profile Header (Instagram Authentic Style)
   -------------------------------------------------------------------------- */
.kslp-ig-profile {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 20px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 16px;
	padding: 20px 24px;
	margin-bottom: 28px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	box-sizing: border-box;
}

.kslp-ig-profile__main {
	display: flex;
	align-items: center;
	gap: 16px;
}

.kslp-ig-profile__avatar-wrap {
	position: relative;
	width: 68px;
	height: 68px;
	flex-shrink: 0;
	border-radius: 50%;
	padding: 3px;
	background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
	box-sizing: border-box;
}

.kslp-ig-profile__avatar {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	display: block;
	border: 2px solid #ffffff;
	background: #f1f5f9;
}

.kslp-ig-profile__info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.kslp-ig-profile__username-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.kslp-ig-profile__username {
	font-size: 18px;
	font-weight: 700;
	color: #0f172a;
	text-decoration: none;
	font-style: normal;
}

.kslp-ig-profile__badge {
	color: #0095f6;
	display: inline-flex;
	align-items: center;
}

.kslp-ig-profile__fullname {
	font-size: 14px;
	font-weight: 600;
	color: #334155;
	font-style: normal;
}

.kslp-ig-profile__bio {
	font-size: 13px;
	color: #64748b;
	line-height: 1.4;
	max-width: 480px;
	font-style: normal;
}

.kslp-ig-profile__stats {
	display: flex;
	align-items: center;
	gap: 20px;
	margin-top: 4px;
}

.kslp-ig-profile__stat-item {
	font-size: 13px;
	color: #64748b;
}

.kslp-ig-profile__stat-item strong {
	color: #0f172a;
	font-weight: 700;
}

.kslp-ig-profile__actions {
	display: flex;
	align-items: center;
	gap: 12px;
}

.kslp-ig-profile__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 10px;
	text-decoration: none;
	transition: opacity 0.2s ease, transform 0.15s ease;
	cursor: pointer;
	border: none;
	box-sizing: border-box;
}

.kslp-ig-profile__btn:hover {
	opacity: 0.92;
	transform: translateY(-1px);
}

.kslp-ig-profile__btn:active {
	transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Filter Tabs (Frontend & Editor)
   -------------------------------------------------------------------------- */
.kslp-ig-filter-bar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 24px;
	box-sizing: border-box;
}

.kslp-ig-filter-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 8px 18px;
	font-size: 14px;
	font-weight: 600;
	background: #f1f5f9;
	color: #475569;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: none;
	font-style: normal;
}

.kslp-ig-filter-btn:hover {
	background: #e2e8f0;
	color: #1e293b;
}

.kslp-ig-filter-btn:focus-visible {
	outline: 2px solid #e1306c;
	outline-offset: 2px;
}

.kslp-ig-filter-btn.is-active {
	background: #e1306c;
	color: #ffffff;
	border-color: #e1306c;
	box-shadow: 0 3px 10px rgba(225, 48, 108, 0.25);
}

.kslp-ig-filter-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

/* --------------------------------------------------------------------------
   Grid Layout & Responsive Columns
   -------------------------------------------------------------------------- */
.kslp-ig-grid {
	display: grid;
	width: 100%;
	box-sizing: border-box;
	gap: var(--kslp-ig-gap-desk, 16px);
	grid-template-columns: repeat(var(--kslp-ig-cols-desk, 4), minmax(0, 1fr));
}

@media (min-width: 992px) {
	.kslp-ig-grid {
		grid-template-columns: repeat(var(--kslp-ig-cols-desk, 4), minmax(0, 1fr));
		gap: var(--kslp-ig-gap-desk, 16px);
	}
}

@media (min-width: 576px) and (max-width: 991px) {
	.kslp-ig-grid {
		grid-template-columns: repeat(var(--kslp-ig-cols-tab, 3), minmax(0, 1fr));
		gap: var(--kslp-ig-gap-tab, var(--kslp-ig-gap-desk, 16px));
	}
}

@media (max-width: 575px) {
	.kslp-ig-grid {
		grid-template-columns: repeat(var(--kslp-ig-cols-mob, 2), minmax(0, 1fr));
		gap: var(--kslp-ig-gap-mob, 12px);
	}
}

/* --------------------------------------------------------------------------
   Instagram Card Item
   -------------------------------------------------------------------------- */
.kslp-ig-card {
	position: relative;
	border-radius: var(--kslp-ig-card-radius, 12px);
	overflow: hidden;
	background: #0f172a;
	box-sizing: border-box;
	cursor: pointer;
	transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
	aspect-ratio: var(--kslp-ig-aspect, 1 / 1);
	display: block;
	text-decoration: none;
	color: inherit;
}

/* Aspect Ratio Modifiers */
.kslp-ig-card.is-aspect-1-1 { aspect-ratio: 1 / 1; }
.kslp-ig-card.is-aspect-4-5 { aspect-ratio: 4 / 5; }
.kslp-ig-card.is-aspect-9-16 { aspect-ratio: 9 / 16; }
.kslp-ig-card.is-aspect-auto { aspect-ratio: auto; min-height: 220px; }

/* Shadow presets */
.kslp-ig-card--shadow-sm { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.kslp-ig-card--shadow-md { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.kslp-ig-card--shadow-lg { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15); }
.kslp-ig-card--shadow-none { box-shadow: none; }

.kslp-ig-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.kslp-ig-card:focus-visible {
	outline: 2px solid #e1306c;
	outline-offset: 3px;
}

/* Card Media / Image */
.kslp-ig-card__media-wrap {
	width: 100%;
	height: 100%;
	position: relative;
	overflow: hidden;
}

.kslp-ig-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.kslp-ig-card:hover .kslp-ig-card__img {
	transform: scale(1.05);
}

/* Reels Indicator Badge */
.kslp-ig-badge-reel {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 4px 8px;
	background: rgba(15, 23, 42, 0.75);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	border-radius: 6px;
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	pointer-events: none;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
	font-style: normal;
}

.kslp-ig-badge-reel svg {
	width: 13px;
	height: 13px;
	fill: currentColor;
}

/* Overlay on Hover */
.kslp-ig-card__overlay {
	position: absolute;
	inset: 0;
	z-index: 4;
	background: var(--kslp-ig-overlay-bg, rgba(0, 0, 0, 0.65));
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	color: var(--kslp-ig-overlay-color, #ffffff);
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 16px;
	text-align: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	box-sizing: border-box;
}

.kslp-ig-card:hover .kslp-ig-card__overlay,
.kslp-ig-card:focus-visible .kslp-ig-card__overlay {
	opacity: 1;
	visibility: visible;
}

.kslp-ig-card__stats {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-bottom: 8px;
}

.kslp-ig-card__stat {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 13px;
	font-weight: 700;
	color: #ffffff;
}

.kslp-ig-card__stat svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
}

.kslp-ig-card__caption {
	font-size: 12px;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.92);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-top: 4px;
	max-width: 90%;
	font-style: normal;
}

.kslp-ig-card__action-icon {
	margin-top: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	color: #ffffff;
	transition: background 0.2s ease, transform 0.2s ease;
}

.kslp-ig-card:hover .kslp-ig-card__action-icon {
	background: #e1306c;
	transform: scale(1.08);
}

.kslp-ig-card__action-icon svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
}

/* --------------------------------------------------------------------------
   Modal Lightbox
   -------------------------------------------------------------------------- */
.kslp-ig-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 23, 42, 0.85);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	padding: 20px;
	box-sizing: border-box;
}

.kslp-ig-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.kslp-ig-modal__dialog {
	position: relative;
	background: #ffffff;
	border-radius: 18px;
	max-width: 900px;
	width: 100%;
	max-height: 90vh;
	display: flex;
	overflow: hidden;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
	animation: kslpIgPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
	box-sizing: border-box;
}

@keyframes kslpIgPopIn {
	from { transform: scale(0.95); opacity: 0; }
	to   { transform: scale(1); opacity: 1; }
}

.kslp-ig-modal__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 10;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(15, 23, 42, 0.6);
	color: #ffffff;
	border: none;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.15s ease;
}

.kslp-ig-modal__close:hover {
	background: rgba(15, 23, 42, 0.9);
	transform: scale(1.05);
}

.kslp-ig-modal__close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.kslp-ig-modal__media {
	flex: 1 1 55%;
	background: #000000;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	min-height: 350px;
	max-height: 85vh;
}

.kslp-ig-modal__media img,
.kslp-ig-modal__media video {
	max-width: 100%;
	max-height: 85vh;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.kslp-ig-modal__sidebar {
	flex: 1 1 45%;
	padding: 24px;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	overflow-y: auto;
	box-sizing: border-box;
	background: #ffffff;
}

.kslp-ig-modal__sidebar-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-bottom: 16px;
	border-bottom: 1px solid #f1f5f9;
	margin-bottom: 16px;
}

.kslp-ig-modal__sidebar-avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	background: #f1f5f9;
}

.kslp-ig-modal__sidebar-user {
	font-size: 14px;
	font-weight: 700;
	color: #0f172a;
	font-style: normal;
}

.kslp-ig-modal__caption-text {
	font-size: 14px;
	line-height: 1.6;
	color: #334155;
	margin-bottom: 20px;
	white-space: pre-line;
	font-style: normal;
}

.kslp-ig-modal__sidebar-footer {
	border-top: 1px solid #f1f5f9;
	padding-top: 16px;
	margin-top: auto;
}

.kslp-ig-modal__stats {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
	color: #64748b;
	font-size: 13px;
	font-weight: 600;
}

.kslp-ig-modal__stats span {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.kslp-ig-modal__stats svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

.kslp-ig-modal__cta-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	min-height: 44px;
	background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	border-radius: 10px;
	transition: opacity 0.2s ease, transform 0.15s ease;
	box-sizing: border-box;
}

.kslp-ig-modal__cta-btn:hover {
	opacity: 0.94;
	transform: translateY(-1px);
}

.kslp-ig-modal__cta-btn svg {
	width: 16px;
	height: 16px;
	fill: currentColor;
}

@media (max-width: 767px) {
	.kslp-ig-modal__dialog {
		flex-direction: column;
		max-height: 94vh;
	}
	.kslp-ig-modal__media {
		max-height: 45vh;
		min-height: 220px;
	}
	.kslp-ig-modal__sidebar {
		padding: 16px;
	}
	.kslp-ig-profile {
		padding: 16px;
	}
	.kslp-ig-profile__actions {
		width: 100%;
	}
	.kslp-ig-profile__btn {
		width: 100%;
	}
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
	.kslp-ig-card,
	.kslp-ig-card__img,
	.kslp-ig-card__overlay,
	.kslp-ig-modal,
	.kslp-ig-modal__dialog,
	.kslp-ig-profile__btn {
		transition: none !important;
		animation: none !important;
	}
}
