/* =========================================================================
   BW Instagram Stories — ön yüz stilleri
   ========================================================================= */

.bwis {
	--bwis-size: 84px;
	--bwis-gap: 14px;
	--bwis-radius: 50%;
	--bwis-ring-w: 3px;
	--bwis-ring-bg: conic-gradient(from 200deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888, #f09433);
	--bwis-title-size: 12px;
	--bwis-gap-inner: 2px;

	/* Blok hiçbir koşulda kapsayıcısından taşmaz.
	   min-width:0 — flex/grid kapsayıcı içindeyken içerik genişliğine
	   büyümesini engeller (yatay sayfa kaymasının en yaygın sebebi). */
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

/* ---------- Küçük resim şeridi ---------- */

.bwis-strip {
	display: flex;
	align-items: flex-start;
	gap: var(--bwis-gap);
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain; /* şeridin sonuna gelince sayfayı kaydırmasın */
	padding: 4px 2px 10px;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

.bwis-strip > * {
	min-width: 0;
}

.bwis--align-center .bwis-strip {
	justify-content: flex-start;
}

@media (min-width: 600px) {
	.bwis--align-center .bwis-strip {
		justify-content: center;
	}
}

.bwis-strip::-webkit-scrollbar {
	height: 6px;
}

.bwis-strip::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.18);
	border-radius: 3px;
}

.bwis-item {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: var(--bwis-size);
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	cursor: pointer;
	scroll-snap-align: start;
	font: inherit;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
}

.bwis-ring {
	display: block;
	width: var(--bwis-size);
	height: var(--bwis-size);
	border-radius: var(--bwis-radius);
	padding: var(--bwis-ring-w);
	background: var(--bwis-ring-bg);
	transition: transform 0.18s ease, filter 0.18s ease;
	box-sizing: border-box;
}

.bwis--no-ring .bwis-ring {
	padding: 0;
	background: none;
}

.bwis-item:hover .bwis-ring,
.bwis-item:focus-visible .bwis-ring {
	transform: scale(1.045);
}

.bwis-item:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
	border-radius: 6px;
}

/* İzlendi durumu */
.bwis-item.is-seen .bwis-ring {
	background: #d8d8d8;
}

.bwis-thumb {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: inherit;
	overflow: hidden;
	background: #eee;
	box-shadow: 0 0 0 var(--bwis-gap-inner) #fff inset;
	border: var(--bwis-gap-inner) solid #fff;
	box-sizing: border-box;
}

.bwis--no-ring .bwis-thumb {
	border: 0;
	box-shadow: none;
}

.bwis-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: inherit;
}

.bwis-label {
	font-size: var(--bwis-title-size);
	line-height: 1.25;
	text-align: center;
	max-width: 100%;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	word-break: break-word;
	opacity: 0.85;
}

/* =========================================================================
   Popup (viewer)
   ========================================================================= */

.bwis-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	overflow: hidden;
	max-width: 100vw;
	transition: opacity 0.22s ease, visibility 0.22s;
}

/* Kapalıyken hiçbir şekilde yer kaplamasın / taşma yaratmasın. */
.bwis-modal:not(.is-open) {
	pointer-events: none;
	width: 0;
	height: 0;
	inset: 0 auto auto 0;
}

.bwis-modal.is-open {
	opacity: 1;
	visibility: visible;
	width: auto;
	height: auto;
	inset: 0;
}

.bwis-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 12, 0.94);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.bwis-stage {
	position: relative;
	width: min(430px, 96vw, calc(92vh * 9 / 16));
	height: min(92vh, calc(96vw * 16 / 9));
	background: #000;
	border-radius: 14px;
	overflow: hidden;
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
	transform: scale(0.96);
	transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
}

.bwis-modal.is-open .bwis-stage {
	transform: scale(1);
}

@media (max-width: 640px) {
	.bwis-stage {
		/* 100vw kullanmıyoruz: dikey kaydırma çubuğu varsa yatay taşma yaratır. */
		width: 100%;
		max-width: 100%;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
	}
}

/* ---------- Süre çubukları ---------- */

.bwis-bars {
	position: absolute;
	top: 10px;
	left: 10px;
	right: 10px;
	display: flex;
	gap: 4px;
	z-index: 6;
	pointer-events: none;
}

.bwis-bar {
	flex: 1 1 0;
	height: 3px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.34);
	overflow: hidden;
}

.bwis-bar__fill {
	display: block;
	height: 100%;
	width: 0;
	background: #fff;
	border-radius: 3px;
}

/* ---------- Üst bar ---------- */

.bwis-head {
	position: absolute;
	top: 24px;
	left: 10px;
	right: 10px;
	display: flex;
	align-items: center;
	gap: 10px;
	z-index: 6;
	color: #fff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
	pointer-events: none; /* taplar shield'a geçsin */
}

.bwis-head__actions {
	pointer-events: auto;
}

.bwis-head__avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	overflow: hidden;
	flex: 0 0 auto;
	background: rgba(255, 255, 255, 0.2);
}

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

.bwis-head__title {
	flex: 1 1 auto;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bwis-head__actions {
	display: flex;
	align-items: center;
	gap: 2px;
	flex: 0 0 auto;
}

.bwis-btn {
	width: 36px;
	height: 36px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	padding: 0;
	background: transparent;
	color: #fff;
	cursor: pointer;
	border-radius: 50%;
	transition: background 0.15s ease;
}

.bwis-btn:hover,
.bwis-btn:focus-visible {
	background: rgba(255, 255, 255, 0.16);
}

.bwis-btn svg {
	width: 20px;
	height: 20px;
	fill: currentColor;
	display: block;
}

.bwis-btn .bwis-icon--off {
	display: none;
}

.bwis-btn.is-active .bwis-icon--on {
	display: none;
}

.bwis-btn.is-active .bwis-icon--off {
	display: block;
}

/* ---------- Oynatıcı ---------- */

.bwis-player {
	position: absolute;
	inset: 0;
	background: #000;
}

.bwis-player iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* YouTube arayüzünü ve tıklamalarını yakalayan şeffaf katman */
.bwis-shield {
	position: absolute;
	inset: 0;
	z-index: 4;
	cursor: pointer;
	touch-action: none;
}

.bwis-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 34px;
	height: 34px;
	margin: -17px 0 0 -17px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: #fff;
	border-radius: 50%;
	z-index: 5;
	animation: bwis-spin 0.8s linear infinite;
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: none;
}

.bwis-stage.is-loading .bwis-spinner {
	opacity: 1;
}

@keyframes bwis-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Duraklatıldığında arayüzü sönükleştir */
.bwis-stage.is-paused .bwis-bars,
.bwis-stage.is-paused .bwis-head {
	opacity: 0.25;
	transition: opacity 0.2s ease;
}

/* ---------- Navigasyon okları (masaüstü) ---------- */

.bwis-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #111;
	cursor: pointer;
	z-index: 7;
	display: none;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.bwis-arrow svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.bwis-arrow--prev {
	left: -54px;
}

.bwis-arrow--next {
	right: -54px;
}

@media (min-width: 900px) {
	.bwis-arrow {
		display: flex;
	}

	.bwis-arrow[disabled] {
		opacity: 0.3;
		cursor: default;
	}
}

/* ---------- Alt CTA ---------- */

.bwis-cta {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 40px 16px 18px;
	z-index: 6;
	display: none;
	justify-content: center;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
	pointer-events: none;
}

.bwis-cta a {
	pointer-events: auto;
}

.bwis-cta.is-visible {
	display: flex;
}

.bwis-cta a {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: 999px;
	background: #fff;
	color: #111;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.bwis-cta a:hover {
	background: #f2f2f2;
}

/* ---------- Erişilebilirlik ---------- */

.bwis-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

html.bwis-locked {
	overflow: hidden;
}

/* ---------- Taşma güvenlik ağı ----------
   Bazı temalar alignfull/alignwide için 100vw kullanır; dikey kaydırma
   çubuğu varsa bu yatay taşma yaratır. Blok kendi içinde kaydığı için
   burada kırpmak güvenli. */

.bwis.alignfull,
.bwis.alignwide {
	max-width: 100%;
	overflow-x: clip;
}

/* Şerit klavye ile gezilirken odaklanan öğe görünür alana gelsin. */
.bwis-strip {
	scroll-padding-inline: 12px;
}

@media (prefers-reduced-motion: reduce) {
	.bwis-modal,
	.bwis-stage,
	.bwis-ring {
		transition: none;
	}
}
