/* Insta Reels Feed — inherits the theme font and text colour. */
.irf {
	--irf-gap: clamp(8px, 1.4vw, 16px);
	--irf-radius: 16px;
	--irf-grad: linear-gradient(45deg, #feda75 0%, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5 100%);
	--irf-muted: rgba(127, 127, 127, 0.14);
	margin: 2rem 0;
}

/* Header */
.irf-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 18px;
}
.irf-profile {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: inherit !important;
	text-decoration: none !important;
}
.irf-avatar {
	position: relative;
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	padding: 2px;
	border-radius: 50%;
	background: var(--irf-grad);
}
.irf-avatar img,
.irf-avatar-fallback {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	border: 2px solid #fff;
	object-fit: cover;
}
.irf-avatar img { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); z-index: 1; }
.irf-avatar-fallback {
	display: grid;
	place-items: center;
	background: #1d1d1f;
	color: #fff;
	font-weight: 700;
	font-size: 20px;
}
.irf-who { display: flex; flex-direction: column; line-height: 1.25; }
.irf-who strong { font-size: 1.05rem; }
.irf-who small { opacity: 0.65; font-size: 0.85rem; }

.irf-follow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--irf-grad);
	color: #fff !important;
	font-weight: 600;
	font-size: 0.95rem;
	line-height: 1;
	text-decoration: none !important;
	box-shadow: 0 6px 18px rgba(214, 41, 118, 0.25);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.irf-follow:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(214, 41, 118, 0.32); }
.irf-follow:focus-visible { outline: 3px solid #d62976; outline-offset: 3px; }
.irf-more { margin: 20px 0 0; text-align: center; }

/* Track */
.irf-viewport { position: relative; }
.irf-track {
	display: grid;
	grid-template-columns: repeat(var(--irf-cols, 4), minmax(0, 1fr));
	gap: var(--irf-gap);
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}
.irf-item { margin: 0 !important; padding: 0 !important; list-style: none !important; }
.irf-item::before, .irf-item::marker { content: none !important; }

@media (max-width: 900px) { .irf--grid .irf-track { grid-template-columns: repeat(min(var(--irf-cols, 4), 3), minmax(0, 1fr)); } }
@media (max-width: 600px) { .irf--grid .irf-track { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Carousel */
.irf--carousel .irf-track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 2px !important;
}
.irf--carousel .irf-track::-webkit-scrollbar { display: none; }
.irf--carousel .irf-item {
	flex: 0 0 calc((100% - (var(--irf-cols, 4) - 1) * var(--irf-gap)) / var(--irf-cols, 4));
	scroll-snap-align: start;
}
@media (max-width: 900px) { .irf--carousel .irf-item { flex-basis: calc((100% - 2 * var(--irf-gap)) / 2.6); } }
@media (max-width: 600px) { .irf--carousel .irf-item { flex-basis: 62%; } }

.irf .irf-nav,
.irf .irf-nav:hover,
.irf .irf-nav:focus {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: -22px 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: #fff !important;
	color: #1d1d1f !important;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18) !important;
	cursor: pointer;
	transition: opacity 0.2s ease, transform 0.2s ease;
}
.irf .irf-nav:hover { transform: scale(1.06); }
.irf .irf-nav[disabled] { opacity: 0; pointer-events: none; }
.irf .irf-nav--prev { left: -14px; }
.irf .irf-nav--next { right: -14px; }
@media (max-width: 600px) { .irf .irf-nav { display: none; } }

/* Card */
.irf .irf-card,
.irf .irf-card:hover,
.irf .irf-card:focus,
.irf .irf-card:active {
	display: block;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: var(--irf-radius) !important;
	background: none !important;
	box-shadow: none !important;
	color: #fff !important;
	font: inherit !important;
	text-align: left;
	text-transform: none !important;
	letter-spacing: normal !important;
	cursor: pointer;
}
.irf .irf-card:focus-visible .irf-media { outline: 3px solid #d62976; outline-offset: 3px; }

.irf-media {
	position: relative;
	display: block;
	aspect-ratio: var(--irf-ratio, 9/16);
	border-radius: var(--irf-radius);
	overflow: hidden;
	background: var(--irf-muted);
	isolation: isolate;
}
.irf-img {
	position: absolute;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.irf-card:hover .irf-img { transform: scale(1.06); }

.irf-placeholder {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	background: var(--irf-grad);
}
.irf-placeholder .irf-i { width: 42px; height: 42px; opacity: 0.9; }

.irf-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 2;
	display: grid;
	filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

/* Instagram cover images have their own play icon baked in near the centre.
   This solid button is sized to the card so it always covers it cleanly. */
.irf-play {
	position: absolute;
	left: 50%;
	top: 50%;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 30%;
	min-width: 44px;
	height: auto;
	aspect-ratio: 1;
	margin: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.96);
	color: #111;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	transform: translate(-50%, -50%);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.irf-play .irf-i { width: 30%; height: 30%; margin: 0; }
.irf-card:hover .irf-play,
.irf-card:focus-visible .irf-play { transform: translate(-50%, -50%) scale(1.05); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }

.irf-overlay {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 48px 12px 12px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
	font-size: 0.82rem;
	line-height: 1.35;
}
.irf-stats { display: flex; gap: 12px; font-weight: 600; }
.irf-stats > span { display: inline-flex; align-items: center; gap: 4px; }
.irf-stats .irf-i { width: 15px; height: 15px; }
.irf-caption {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}
.irf-card:hover .irf-caption,
.irf-card:focus-visible .irf-caption { opacity: 1; transform: none; }
@media (hover: none) { .irf-caption { opacity: 1; transform: none; } }

.irf-empty { opacity: 0.7; }

/* Player */
.irf-modal,
.irf-modal[open] {
	width: fit-content !important;
	min-width: 0 !important;
	max-width: 100vw !important;
	height: fit-content !important;
	max-height: none;
	inset: 0;
	margin: auto !important;
	padding: 0;
	border: 0;
	background: transparent;
	overflow: visible;
}
.irf-modal::backdrop { background: rgba(10, 10, 12, 0.88); backdrop-filter: blur(4px); }
.irf-modal-inner { position: relative; display: flex; flex-direction: column; align-items: center; width: min(400px, 88vw); margin: 0 auto; }
.irf-stage {
	position: relative;
	width: min(400px, 88vw);
	height: min(760px, 80vh);
	border-radius: 14px;
	overflow: hidden;
	background: #fff;
}
.irf-stage::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-top-color: #d62976;
	border-radius: 50%;
	animation: irf-spin 0.8s linear infinite;
}
.irf-stage iframe { position: relative; z-index: 1; display: block; width: 100%; height: 100%; border: 0; background: transparent; }
@keyframes irf-spin { to { transform: rotate(360deg); } }

.irf-modal .irf-close,
.irf-modal .irf-step,
.irf-modal .irf-close:hover,
.irf-modal .irf-step:hover,
.irf-modal .irf-close:focus,
.irf-modal .irf-step:focus {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.95) !important;
	color: #1d1d1f !important;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
	cursor: pointer;
}
.irf-modal .irf-close { position: absolute; top: 0; right: -60px; z-index: 3; }
.irf-modal .irf-step { position: absolute; top: 50%; margin-top: -22px !important; z-index: 2; }
.irf-modal .irf-step--prev { left: -64px; }
.irf-modal .irf-step--next { right: -64px; }
.irf-modal .irf-step[disabled] { opacity: 0.35; cursor: default; }
@media (max-width: 600px) {
	.irf-modal .irf-step--prev { left: 6px; }
	.irf-modal .irf-step--next { right: 6px; }
	.irf-modal .irf-step { width: 38px; height: 38px; margin-top: -19px !important; opacity: 0.85; }
	.irf-modal .irf-close { top: auto; bottom: -2px; right: 50%; margin-right: -22px !important; }
	.irf-modal-bar { padding-top: 48px; }
}
.irf-modal-bar {
	display: flex;
	justify-content: space-between;
	width: min(400px, 88vw);
	margin-top: 12px;
	color: #fff;
	font-size: 0.9rem;
}
.irf-modal-bar a { color: #fff !important; text-decoration: none !important; opacity: 0.9; }
.irf-modal-bar a:hover { opacity: 1; text-decoration: underline !important; }

@media (prefers-reduced-motion: reduce) {
	.irf-img, .irf-play, .irf-caption, .irf-follow, .irf .irf-nav { transition: none; }
	.irf-card:hover .irf-img { transform: none; }
	.irf-stage::before { animation-duration: 2.4s; }
}

/* ---------- 3D slider (coverflow) ----------
   Wide cards like the reference: flat centre card, side cards angled in 3D
   (outer edge near, inner edge far), plain chevron arrows outside the cards.
   Geometry is in cqw (share of slider width) so the shape is the same on
   every screen, and nothing ever pushes the page sideways. */
.irf--coverflow {
	--irf-cw: 35.5;          /* centre card width, % of track */
	--irf-sw: 46.5;          /* side card width before the 3D turn */
	--irf-ry: 40deg;         /* side card turn */
	--irf-persp: 140cqw;     /* depth */
	--irf-arrow: currentColor;
	max-width: 100%;
	overflow: hidden;
	overflow: clip;
}
.irf--coverflow .irf-viewport {
	position: relative;
	max-width: 100%;
	padding: 24px clamp(34px, 4.5%, 72px);
	overflow: hidden;
	overflow: clip;
	touch-action: pan-y;
}
.irf--coverflow .irf-track {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 100 / 16.9;
	overflow: visible;
	container-type: inline-size;
}
.irf--coverflow .irf-item {
	--x: calc((100cqw - var(--irf-cw) * 1cqw) / 2);
	--w: calc(var(--irf-cw) * 1cqw);
	--r: 0deg;
	position: absolute;
	top: 0;
	left: var(--x);
	width: var(--w);
	height: 100%;
	opacity: 0;
	pointer-events: none;
	transform-origin: 50% 50%;
	transform: perspective(var(--irf-persp)) rotateY(var(--r)) scale(0.86);
	transition: left 0.6s cubic-bezier(0.22, 0.75, 0.2, 1), width 0.6s cubic-bezier(0.22, 0.75, 0.2, 1), transform 0.6s cubic-bezier(0.22, 0.75, 0.2, 1), transform-origin 0.6s cubic-bezier(0.22, 0.75, 0.2, 1), opacity 0.45s ease;
	will-change: transform, left, width;
}
.irf--coverflow .irf-item[data-pos="0"] {
	z-index: 3;
	opacity: 1;
	pointer-events: auto;
	transform: perspective(var(--irf-persp)) rotateY(0deg) scale(1);
}
.irf--coverflow .irf-item[data-pos="-1"],
.irf--coverflow .irf-item[data-pos="-2"],
.irf--coverflow .irf-item[data-pos="-3"] {
	--x: 0cqw;
	--w: calc(var(--irf-sw) * 1cqw);
	--r: var(--irf-ry);
	transform-origin: 0% 50%;
}
.irf--coverflow .irf-item[data-pos="1"],
.irf--coverflow .irf-item[data-pos="2"],
.irf--coverflow .irf-item[data-pos="3"] {
	--x: calc(100cqw - var(--irf-sw) * 1cqw);
	--w: calc(var(--irf-sw) * 1cqw);
	--r: calc(var(--irf-ry) * -1);
	transform-origin: 100% 50%;
}
.irf--coverflow .irf-item[data-pos="-1"],
.irf--coverflow .irf-item[data-pos="1"] {
	z-index: 2;
	opacity: 1;
	pointer-events: auto;
	transform: perspective(var(--irf-persp)) rotateY(var(--r)) scale(1);
}
.irf--coverflow .irf-item[data-pos="-2"],
.irf--coverflow .irf-item[data-pos="2"],
.irf--coverflow .irf-item[data-pos="-3"],
.irf--coverflow .irf-item[data-pos="3"] {
	z-index: 1;
	transform: perspective(var(--irf-persp)) rotateY(var(--r)) scale(0.9);
}

.irf--coverflow .irf-card,
.irf--coverflow .irf-card:hover,
.irf--coverflow .irf-card:focus,
.irf--coverflow .irf-card:active { height: 100%; border-radius: 14px !important; }
.irf--coverflow .irf-media {
	height: 100%;
	aspect-ratio: auto;
	border-radius: 14px;
	background: #c3cad2;
	box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}
/* Image fills the card. Instagram reel covers are tall, so the crop keeps the
   upper-middle part (where faces usually are) and leaves out the big play
   icon Instagram puts in the centre of link covers. Your own wide featured
   images are shown centred. */
.irf.irf--coverflow .irf-img {
	object-fit: cover;
	object-position: 50% 50%;
	transition: none;
}
.irf.irf--coverflow .irf-card--baked .irf-img { object-position: 50% 24%; }
.irf--coverflow .irf-card:hover .irf-img { transform: none; }
/* Side card shading: darker toward the inner edge. */
.irf--coverflow .irf-media::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.5s ease;
}
.irf--coverflow .irf-item[data-pos="-1"] .irf-media::after { opacity: 1; background: linear-gradient(to right, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.55)); }
.irf--coverflow .irf-item[data-pos="1"] .irf-media::after { opacity: 1; background: linear-gradient(to left, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.55)); }

.irf--coverflow .irf-overlay,
.irf--coverflow .irf-more { display: none !important; }

/* Small play button on the centre card. */
.irf--coverflow .irf-play {
	z-index: 3;
	width: clamp(30px, 9%, 52px);
	min-width: 0;
	background: rgba(0, 0, 0, 0.5);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
	color: #fff;
	box-shadow: none;
	border: 0;
	transition: transform 0.25s ease, background 0.25s ease, opacity 0.4s ease;
}
.irf--coverflow .irf-play .irf-i { width: 40%; height: 40%; margin: 0 0 0 6%; }
.irf--coverflow .irf-card:hover .irf-play { background: rgba(0, 0, 0, 0.65); }
.irf--coverflow .irf-item:not([data-pos="0"]) .irf-play { opacity: 0; }

/* Plain chevron arrows outside the cards. */
.irf.irf--coverflow .irf-nav,
.irf.irf--coverflow .irf-nav:hover,
.irf.irf--coverflow .irf-nav:focus {
	display: grid;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 !important;
	z-index: 5;
	opacity: 1;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--irf-arrow) !important;
	transform: none;
	transition: opacity 0.2s ease;
}
.irf.irf--coverflow .irf-nav:hover { opacity: 0.65; }
.irf.irf--coverflow .irf-nav:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.irf.irf--coverflow .irf-nav .irf-i { width: 22px; height: 22px; }
.irf.irf--coverflow .irf-nav--prev { left: max(0px, calc(clamp(34px, 4.5%, 72px) / 2 - 20px)); }
.irf.irf--coverflow .irf-nav--next { right: max(0px, calc(clamp(34px, 4.5%, 72px) / 2 - 20px)); }

@media (max-width: 1024px) {
	.irf--coverflow { --irf-cw: 44; --irf-sw: 45.1; --irf-ry: 45deg; --irf-persp: 127.5cqw; }
	.irf--coverflow .irf-track { aspect-ratio: 100 / 20.95; }
}
@media (max-width: 600px) {
	.irf--coverflow { --irf-cw: 60; --irf-sw: 33.8; --irf-ry: 50deg; --irf-persp: 118cqw; }
	.irf--coverflow .irf-track { aspect-ratio: 100 / 28.57; }
	.irf--coverflow .irf-viewport { padding: 16px 30px; }
	.irf.irf--coverflow .irf-nav,
	.irf.irf--coverflow .irf-nav:hover,
	.irf.irf--coverflow .irf-nav:focus { width: 30px; height: 30px; margin-top: -15px !important; }
	.irf.irf--coverflow .irf-nav--prev { left: 0; }
	.irf.irf--coverflow .irf-nav--next { right: 0; }
	.irf.irf--coverflow .irf-nav .irf-i { width: 18px; height: 18px; }
	.irf--coverflow .irf-media,
	.irf--coverflow .irf-card,
	.irf--coverflow .irf-card:hover,
	.irf--coverflow .irf-card:focus,
	.irf--coverflow .irf-card:active { border-radius: 10px !important; }
	.irf--coverflow .irf-media { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16); }
}
@media (prefers-reduced-motion: reduce) {
	.irf--coverflow .irf-item { transition: opacity 0.3s ease; }
}
