/* ==========================================================================
   Esta Reels — anasayfa bölümü + tam ekran izleme
   Esta Modern temasının değişkenlerini kullanır (--red, --ink, --line, --font…);
   tema dışında da çalışsın diye her değişkenin yedeği var.
   ========================================================================== */

.esta-reels,
.er-viewer {
	--er-red: var(--red, #e1141c);
	--er-red-600: var(--red-600, #b90f16);
	--er-ink: var(--ink, #111214);
	--er-ink-3: var(--ink-3, #3b3d42);
	--er-muted: var(--muted, #6b6f76);
	--er-line: var(--line, #e7e5e1);
	--er-soft: var(--bg-soft, #f4f2ee);
	--er-stone: var(--stone, #ebe8e2);
	--er-wa: var(--wa, #1faa59);
	--er-radius: var(--radius-sm, 12px);
	--er-ease: var(--ease, cubic-bezier(.2, .7, .2, 1));
	--er-gutter: var(--gutter, clamp(16px, 4vw, 32px));
	--er-container: var(--container, 1200px);
}

/* --------------------------------------------------------------------------
   Bölüm
   -------------------------------------------------------------------------- */
.esta-reels {
	padding: clamp(56px, 7vw, 96px) 0 0;
	overflow: hidden;
}
.esta-reels__head {
	display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
	flex-wrap: wrap;
	margin-bottom: clamp(24px, 3.4vw, 40px);
}
.esta-reels__heading .kicker { margin-bottom: 12px; }
.esta-reels__title {
	margin: 0;
	font-size: clamp(2rem, 1.3rem + 2.4vw, 3.25rem);
	letter-spacing: -.035em; line-height: 1.05;
	color: var(--er-ink);
}
.esta-reels__links { display: flex; align-items: center; gap: 22px; padding-bottom: 6px; }
.esta-reels__follow {
	display: inline-flex; align-items: center; gap: 8px;
	font-weight: 700; font-size: .95rem; color: var(--er-ink-3); text-decoration: none;
	transition: color .2s var(--er-ease);
}
.esta-reels__follow:hover { color: var(--er-red); }
.esta-reels__all {
	font-weight: 800; font-size: 1rem; color: var(--er-ink); text-decoration: none;
	padding-bottom: 3px;
	background: linear-gradient(currentColor, currentColor) left bottom / 100% 2px no-repeat;
	transition: color .2s var(--er-ease), background-size .3s var(--er-ease);
}
.esta-reels__all:hover { color: var(--er-red); }

/* Şerit: kartlar konteyner hizasında başlar, sağda ekran kenarına taşar. */
.esta-reels__carousel {
	position: relative;
	--er-inset: max(var(--er-gutter), calc((100% - var(--er-container)) / 2));
}
.esta-reels__track {
	display: flex; gap: 24px;
	margin: 0; padding: 0 var(--er-inset) 4px; list-style: none;
	overflow-x: auto; overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: var(--er-inset);
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}
.esta-reels__track::-webkit-scrollbar { display: none; }
.esta-reels__track > li { margin: 0; padding: 0; }
.esta-reels__track > li::before { content: none; }

/* --- Kart --------------------------------------------------------------- */
.reel-card { flex: 0 0 211px; width: 211px; min-width: 0; scroll-snap-align: start; }
.reel-card__link {
	display: flex; flex-direction: column; gap: 12px; min-width: 0;
	color: var(--er-ink); text-decoration: none; outline: none;
}
.reel-card__thumb {
	position: relative; overflow: hidden; display: block;
	width: 100%; aspect-ratio: 211 / 373;
	border-radius: var(--er-radius);
	background: var(--er-stone);
	isolation: isolate;
}
.reel-card__thumb img,
.reel-card__thumb video {
	position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
	margin: 0; max-width: none; border-radius: 0;
}
.reel-card__thumb img { transition: transform .6s var(--er-ease); }
.reel-card__thumb video { opacity: 0; transition: opacity .3s var(--er-ease); }
.reel-card__thumb video.is-playing { opacity: 1; }
.reel-card__thumb::after {
	content: ""; position: absolute; inset: auto 0 0; height: 32%; z-index: 0; pointer-events: none;
	background: linear-gradient(180deg, rgba(17, 18, 20, 0), rgba(17, 18, 20, .28));
}
.reel-card__play {
	position: absolute; right: 12px; bottom: 12px; z-index: 1;
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; border-radius: 999px;
	background: rgba(255, 255, 255, .16); color: #fff;
	border: 1px solid rgba(255, 255, 255, .24);
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	transition: background-color .2s var(--er-ease), border-color .2s var(--er-ease), transform .3s var(--er-ease);
}
.reel-card__play .er-icon { margin-left: 0; } /* Üçgen yolu görsel olarak ortalı çizildi. */
.reel-card__title {
	/* İki satır: Instagram başlıkları yer adı + metrekare içerir, tek satıra sığmaz. */
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
	overflow: hidden; overflow-wrap: anywhere;
	min-height: calc(2em * 1.35);
	font-weight: 700; font-size: .98rem; line-height: 1.35; letter-spacing: -.01em;
	transition: color .2s var(--er-ease);
}
@media (hover: hover) and (pointer: fine) {
	.reel-card__link:hover .reel-card__thumb img { transform: scale(1.04); }
	.reel-card__link:hover .reel-card__play { background: var(--er-red); border-color: var(--er-red); transform: scale(1.08); }
	.reel-card__link:hover .reel-card__title { color: var(--er-red); }
}
.reel-card__link:focus-visible .reel-card__thumb { outline: 2px solid var(--er-red); outline-offset: 3px; }
.reel-card__link:active .reel-card__thumb img { transform: scale(.98); }

/* --- Oklar -------------------------------------------------------------- */
.esta-reels__nav {
	position: absolute; z-index: 2; top: calc(373px / 2); transform: translateY(-50%);
	width: 48px; height: 48px; padding: 0; border-radius: 999px;
	display: inline-flex; align-items: center; justify-content: center;
	background: #fff; color: var(--er-ink);
	border: 1px solid var(--er-line);
	box-shadow: 0 10px 24px -12px rgba(17, 18, 20, .35);
	cursor: pointer;
	transition: background-color .2s var(--er-ease), color .2s var(--er-ease), border-color .2s var(--er-ease), opacity .2s, visibility .2s;
}
.esta-reels__nav:hover { background: var(--er-red); border-color: var(--er-red); color: #fff; }
.esta-reels__nav--prev { left: calc(var(--er-inset) - 24px); }
.esta-reels__nav--next { right: calc(var(--er-inset) - 24px); }
.esta-reels__nav[hidden] { display: inline-flex; opacity: 0; visibility: hidden; pointer-events: none; }

@media (max-width: 1023px) {
	.esta-reels__links { padding-bottom: 2px; }
	.esta-reels__nav { display: none !important; }
	.esta-reels__track { gap: 14px; }
}
@media (max-width: 767px) {
	.esta-reels__head { align-items: flex-end; }
	.esta-reels__follow span { display: none; }
	.esta-reels__follow {
		width: 40px; height: 40px; justify-content: center; border-radius: 999px;
		border: 1px solid var(--er-line);
	}
	.esta-reels__links { gap: 14px; }
	.reel-card { flex-basis: 155px; width: 155px; }
	.reel-card__link { gap: 10px; }
	.reel-card__title { font-size: .9rem; }
	.reel-card__play { right: 8px; bottom: 8px; width: 30px; height: 30px; }
}

/* ==========================================================================
   Tam ekran izleme
   ========================================================================== */
.er-open, .er-open body { overflow: hidden; }
.er-viewer {
	position: fixed; inset: 0; z-index: 950;
	background: #fff;
	color: var(--er-ink);
	font-family: var(--font, inherit);
	opacity: 0; transition: opacity .25s var(--er-ease);
	--reel-h: clamp(420px, calc(var(--stage-h, 900px) - 64px), 860px);
	--reel-w: calc(var(--reel-h) * .5625);
	--reel-top: 32px;
	--reel-gap: 32px;
	isolation: isolate;
}
.er-viewer[hidden] { display: none; }
.er-viewer.is-open { opacity: 1; }
.er-viewer button { font-family: inherit; }

/* Ambiyans */
.er-ambient {
	position: absolute; z-index: 0; pointer-events: none;
	left: 50%; top: calc(var(--reel-top) + var(--reel-h) / 2);
	width: calc(var(--reel-w) * 3.04);
	height: calc(var(--reel-h) * 1.13);
	transform: translate(-50%, -50%);
	opacity: 0; transition: opacity .9s var(--er-ease);
	-webkit-mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, .45) 55%, rgba(0, 0, 0, .12) 80%, transparent 100%);
	mask-image: radial-gradient(closest-side, #000 20%, rgba(0, 0, 0, .45) 55%, rgba(0, 0, 0, .12) 80%, transparent 100%);
}
.er-ambient.is-ready { opacity: .6; }
.er-ambient canvas { width: 100%; height: 100%; filter: blur(80px) saturate(1.15) brightness(1.3); transform: scale(1.05); }

/* Geri */
.er-back {
	position: absolute; z-index: 3; top: 28px; left: var(--er-gutter);
	display: inline-flex; align-items: center; gap: 10px;
	padding: 10px 16px 10px 12px; border-radius: 999px;
	background: rgba(255, 255, 255, .72); color: var(--er-ink);
	border: 1px solid var(--er-line);
	-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
	font-weight: 700; font-size: .95rem; cursor: pointer;
	transition: border-color .2s var(--er-ease), color .2s var(--er-ease);
}
.er-back:hover { border-color: var(--er-ink); }
.er-back .er-icon { color: var(--er-red); }

/* Akış */
.er-feed {
	position: relative; z-index: 1; height: 100%;
	overflow-y: auto; overflow-x: hidden;
	scroll-snap-type: y mandatory; overscroll-behavior: contain;
	scrollbar-width: none;
	padding-bottom: calc(var(--stage-h, 900px) - var(--reel-h) - var(--reel-gap));
}
.er-feed::-webkit-scrollbar { display: none; }
.er-slide {
	position: relative; height: calc(var(--reel-h) + var(--reel-gap));
	padding-top: var(--reel-top);
	display: flex; justify-content: center;
	scroll-snap-align: start; scroll-snap-stop: always;
	box-sizing: border-box;
}
.er-slide__inner { position: relative; width: var(--reel-w); height: var(--reel-h); }

/* Reel kartı */
.er-reel {
	position: relative; overflow: hidden; width: 100%; height: 100%;
	border-radius: var(--er-radius);
	background: #0c0d0f; color: #fff;
	transform: translateZ(0);
	box-shadow: 0 40px 80px -40px rgba(17, 18, 20, .55);
}
.er-slide:not(.is-active) .er-reel { box-shadow: none; }
.er-reel__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0c0d0f; }
.er-reel__tap { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.er-reel__shade {
	position: absolute; inset: 0; z-index: 1; pointer-events: none;
	background:
		linear-gradient(180deg, rgba(0, 0, 0, .28) 0%, rgba(0, 0, 0, 0) 16%),
		linear-gradient(180deg, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, .66) 100%);
}
.er-reel__top {
	position: absolute; z-index: 2; top: 0; left: 0; right: 0;
	display: flex; justify-content: space-between; align-items: flex-start;
	padding: 14px; pointer-events: none;
}
.er-reel__top > * { pointer-events: auto; }
.er-reel__controls { display: flex; gap: 8px; margin-left: auto; }
.er-glass {
	width: 40px; height: 40px; padding: 0; border-radius: 999px;
	display: inline-flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .16); color: #fff;
	border: 1px solid rgba(255, 255, 255, .2);
	-webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
	cursor: pointer; text-decoration: none;
	transition: background-color .2s var(--er-ease), border-color .2s var(--er-ease);
}
.er-glass:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.er-reel__back { display: none; }

.er-reel__state {
	position: absolute; z-index: 2; left: 50%; top: 50%;
	width: 72px; height: 72px; margin: -36px 0 0 -36px;
	display: flex; align-items: center; justify-content: center;
	border-radius: 999px; background: rgba(17, 18, 20, .45); color: #fff;
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
	opacity: 0; transform: scale(.8); pointer-events: none;
	transition: opacity .25s var(--er-ease), transform .25s var(--er-ease);
}
.er-reel__state .er-icon { width: 34px; height: 34px; }
.er-reel.is-paused .er-reel__state { opacity: 1; transform: none; }
.er-reel__spinner {
	position: absolute; z-index: 2; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px;
	border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff;
	animation: er-spin .8s linear infinite; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.er-reel.is-waiting .er-reel__spinner { opacity: 1; }
.er-reel.is-waiting .er-reel__state { opacity: 0; }
@keyframes er-spin { to { transform: rotate(360deg); } }
.er-reel__error {
	position: absolute; z-index: 2; left: 16px; right: 16px; top: 50%; transform: translateY(-50%);
	text-align: center; font-weight: 600; font-size: .95rem; display: none;
}
.er-reel.is-error .er-reel__error { display: block; }
.er-reel.is-error .er-reel__state { opacity: 0; }

.er-reel__content {
	position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
	display: flex; flex-direction: column; gap: 10px;
	padding: 12px 0 22px; pointer-events: none;
}
.er-reel__content > * { pointer-events: auto; }
.er-reel__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 14px 0 18px; }
.er-reel__profile { display: flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; }
.er-reel__avatar {
	width: 36px; height: 36px; flex: none; overflow: hidden;
	display: flex; align-items: center; justify-content: center;
	border-radius: 999px; background: #fff; color: var(--er-red);
	font-weight: 800; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5);
}
.er-reel__avatar img { width: 100%; height: 100%; object-fit: cover; }
.er-reel__who { display: flex; flex-direction: column; min-width: 0; }
.er-reel__name { font-weight: 800; font-size: 1.02rem; line-height: 1.2; }
.er-reel__handle { font-size: .8rem; opacity: .8; }
.er-reel__caption {
	margin: 0; padding: 0 18px;
	font-weight: 500; font-size: .95rem; line-height: 1.45;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
	white-space: pre-line; overflow-wrap: anywhere;
}
.er-reel__caption-text {
	display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.er-reel__caption.is-expanded .er-reel__caption-text { display: block; max-height: 38vh; overflow-y: auto; }
.er-reel__more {
	padding: 0; margin-top: 2px; background: none; border: 0; color: #fff;
	font-weight: 800; font-size: .85rem; cursor: pointer; opacity: .9;
}

/* İlerleme */
.er-reel__progress {
	position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
	height: 16px; display: flex; align-items: flex-end;
	cursor: pointer; touch-action: none;
}
.er-reel__bar { position: relative; width: 100%; height: 4px; background: rgba(255, 255, 255, .25); transition: height .15s var(--er-ease); }
.er-reel__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: var(--er-red); transform-origin: left center; transform: scaleX(0); }
.er-reel__progress:hover .er-reel__bar, .er-reel__progress.is-dragging .er-reel__bar { height: 6px; }

/* Solda teklif kartı ("Videodaki Ürünler"in yerine) */
.er-side {
	position: absolute; bottom: 0; right: calc(100% + 16px);
	width: 236px;
	display: flex; flex-direction: column; gap: 10px;
	padding: 18px; border-radius: var(--er-radius);
	background: rgba(255, 255, 255, .92); border: 1px solid var(--er-line);
	-webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
	box-shadow: 0 24px 48px -28px rgba(17, 18, 20, .35);
}
.er-side__label {
	margin: 0 0 4px; display: inline-flex; align-items: center; gap: .6em;
	font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--er-red);
}
.er-side__label::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.er-btn {
	box-sizing: border-box; white-space: nowrap;
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 999px;
	font-weight: 700; font-size: .9rem; line-height: 1.2; text-align: center; text-decoration: none;
	border: 1px solid transparent; cursor: pointer;
	transition: background-color .2s var(--er-ease), color .2s var(--er-ease), border-color .2s var(--er-ease), transform .2s var(--er-ease);
}
.er-btn--primary { background: var(--er-red); color: #fff; box-shadow: 0 10px 24px -14px rgba(225, 20, 28, .9); }
.er-btn--primary:hover { background: var(--er-red-600); color: #fff; transform: translateY(-1px); }
.er-btn--wa { background: var(--er-wa); color: #fff; }
.er-btn--wa:hover { background: var(--wa-600, #178a48); color: #fff; }
.er-btn--ghost { background: #fff; color: var(--er-ink); border-color: var(--er-line); }
.er-btn--ghost:hover { border-color: var(--er-ink); color: var(--er-ink); }

/* Yukarı / aşağı */
.er-nav {
	position: absolute; z-index: 2;
	left: calc(50% + var(--reel-w) / 2 + 20px);
	top: calc(var(--reel-top) + var(--reel-h) / 2 - 56px);
	display: flex; flex-direction: column; gap: 16px;
}
.er-nav__btn {
	width: 48px; height: 48px; padding: 0; border-radius: 999px;
	display: inline-flex; align-items: center; justify-content: center;
	background: #fff; color: var(--er-ink); border: 1px solid var(--er-line);
	box-shadow: 0 10px 24px -12px rgba(17, 18, 20, .35); cursor: pointer;
	transition: background-color .2s var(--er-ease), color .2s var(--er-ease), border-color .2s var(--er-ease), opacity .2s;
}
.er-nav__btn:hover:not(:disabled) { background: var(--er-red); border-color: var(--er-red); color: #fff; }
.er-nav__btn:disabled { opacity: .4; cursor: default; box-shadow: none; }

/* Mobil teklif çubuğu (yalnızca mobilde görünür) */
.er-mcta { display: none; }

/* Bildirim */
.er-toast {
	position: absolute; z-index: 5; left: 50%; top: 28px; transform: translate(-50%, -12px);
	display: flex; align-items: center; gap: 10px;
	padding: 12px 18px; border-radius: 999px;
	background: var(--er-ink); color: #fff; font-weight: 700; font-size: .92rem;
	box-shadow: 0 20px 40px -20px rgba(17, 18, 20, .6);
	opacity: 0; transition: opacity .25s var(--er-ease), transform .25s var(--er-ease);
}
.er-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.er-toast .er-icon { color: #4ade80; }

/* Dar masaüstü: teklif kartı sığmıyorsa altta küçük çubuk */
@media (max-width: 1100px) and (min-width: 768px) {
	.er-side { display: none; }
	.er-mcta { display: flex; }
}

/* Tablet */
@media (max-width: 1023px) {
	.er-back { width: 44px; height: 44px; padding: 0; justify-content: center; left: 16px; top: 16px; }
	.er-back span { display: none; }
	.er-back .er-icon { color: var(--er-ink); }
}

/* ==========================================================================
   Mobil (<768): tam ekran, başlıksız
   ========================================================================== */
@media (max-width: 767px) {
	.er-viewer { background: #000; --reel-gap: 0px; --reel-top: 0px; }
	.er-back, .er-nav, .er-side, .er-ambient { display: none; }
	.er-feed { padding-bottom: 0; }
	.er-slide { height: 100%; padding-top: 0; }
	.er-slide__inner { width: 100%; height: 100%; }
	.er-reel { border-radius: 0; box-shadow: none; }
	.er-reel__top { padding-top: calc(12px + env(safe-area-inset-top)); }
	.er-reel__back { display: inline-flex; }
	.er-reel__content { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
	.er-mcta { display: flex; }
	.er-toast { top: calc(72px + env(safe-area-inset-top)); white-space: nowrap; }
}

.er-mcta { gap: 8px; padding: 2px 14px 0; }
.er-mcta .er-btn { width: auto; flex: 1; min-height: 44px; }
.er-mcta .er-btn--icon { flex: none; width: 44px; padding: 0; }
.er-mcta .er-btn--ghost { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .24); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }

@media (prefers-reduced-motion: reduce) {
	.esta-reels__track, .er-feed { scroll-behavior: auto; }
	.reel-card__thumb img, .er-viewer, .er-toast { transition: none; }
}
