/* =============================================
   ÖZKUY INSTAGRAM SYSTEM — v2.0
   iOS Safari uyumlu, GPU optimize
   ============================================= */

/* === WRAPPER === */
.ozki-instagram-wrapper {
    position: relative;
    width: 100%;
    /* JS tarafından dinamik olarak ayarlanır */
    background: #000;
    /* overflow: visible — iOS sticky için zorunlu */
    overflow: visible;
    -webkit-transform: translateZ(0); /* iOS stacking context */
    transform: translateZ(0);
}

/* === SECTION — iOS Safari sticky fix === */
.ozki-instagram-section {
    position: -webkit-sticky; /* iOS Safari zorunlu prefix */
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* KRITIK: overflow:hidden sticky'yi iOS'ta kırar — kullanma */
    overflow: visible;
    padding: 0;
    box-sizing: border-box;
    z-index: 10;
    /* iOS paint flicker önleme */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* === AMBIENT === */
.ozki-instagram-ambient {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
    overflow: hidden; /* ambient kendi içinde overflow:hidden kullanabilir */
}
.ozki-instagram-ambient::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* === HEADER === */
.ozki-instagram-header {
    position: absolute;
    top: max(40px, 8vh);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 20;
    white-space: nowrap;
    /* iOS tap highlight kaldır */
    -webkit-tap-highlight-color: transparent;
}

.ozki-instagram-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 100px;
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    margin-bottom: 16px;
}
.ozki-instagram-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.ozki-instagram-title {
    font-family: 'Chillax', -apple-system, sans-serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0;
}
.ozki-instagram-title em {
    font-style: normal;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.5) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === COUNTER === */
.ozki-instagram-counter {
    position: absolute;
    left: clamp(20px, 5vw, 60px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.ozki-instagram-counter__current {
    font-family: 'Chillax', -apple-system, sans-serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 300;
    color: #fff;
    font-variant-numeric: tabular-nums;
    /* Sayı değişim animasyonu */
    transition: opacity 0.2s ease;
}

.ozki-instagram-counter__current.is-changing {
    opacity: 0.3;
}

.ozki-instagram-counter__divider {
    width: 32px;
    height: 1px;
    background: rgba(255,255,255,0.2);
    margin: 12px 0;
}

.ozki-instagram-counter__total {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.6);
    font-variant-numeric: tabular-nums;
}

/* === STAGE — perspective sadece burada === */
.ozki-instagram-stage {
    position: relative;
    width: 320px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    /* perspective burada, transform-style child'da yok — iOS uyumlu */
    perspective: 1000px;
    perspective-origin: 50% 50%;
    /* Dokunma için pointer events açık */
    touch-action: pan-y; /* yatay swipe'ı engelle, dikey scroll'a izin ver */
}

/* === CARD === */
.ozki-instagram-card {
    position: absolute;
    width: 280px;
    height: 420px;
    border-radius: 24px;
    /* overflow:hidden — iOS'ta border-radius için gerekli */
    overflow: hidden;
    /* GPU layer — iOS'ta ayrı compositing layer */
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    will-change: transform, opacity;
    /* transform-style: flat — iOS'ta preserve-3d sorunlu */
    transform-style: flat;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* Transition — cubic-bezier iOS'ta destekleniyor */
    transition:
        transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        opacity 0.4s ease,
        box-shadow 0.4s ease;
    isolation: isolate;
    box-shadow: 0 10px 30px -10px rgba(255,255,255,0.08);
    background-color: #111;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: default;
    -webkit-tap-highlight-color: transparent;
}

.ozki-instagram-card.is-active {
    box-shadow:
        0 25px 60px -15px rgba(0,0,0,0.8),
        0 0 0 1px rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.18);
}

/* Aktif olmayan kartlar — pointer events kapat */
.ozki-instagram-card:not(.is-active) {
    pointer-events: none;
}

.ozki-instagram-card__inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.ozki-instagram-card__glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0.08) 0%,
        transparent 40%
    );
    z-index: 2;
    pointer-events: none;
}

.ozki-instagram-card__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    /* iOS'ta video/img için */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.ozki-instagram-card__bottom-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 160px;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.75) 0%,
        rgba(0,0,0,0.2) 60%,
        transparent 100%
    );
    z-index: 3;
    pointer-events: none;
}

/* === CARD HEADER === */
.ozki-instagram-card__header {
    position: absolute;
    top: 0; left: 0; width: 100%;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
    cursor: pointer;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.4) 0%,
        transparent 100%
    );
    -webkit-tap-highlight-color: transparent;
}

.ozki-instagram-card__user-avatar-container {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ozki-instagram-card__story-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(
        45deg,
        #f09433 0%,
        #e6683c 25%,
        #dc2743 50%,
        #cc2366 75%,
        #bc1888 100%
    );
    padding: 1px;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.ozki-instagram-card__user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: #000;
}

.ozki-instagram-card__user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ozki-instagram-card__user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.ozki-instagram-card__username-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ozki-instagram-card__username {
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.ozki-instagram-card__location {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.75);
    line-height: 1.2;
}

/* === CARD ACTIONS === */
.ozki-instagram-card__actions {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 15;
}

.ozki-instagram-card__action {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    color: #fff;
    padding: 0;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ozki-instagram-card__action svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

@media (hover: hover) {
    .ozki-instagram-card__action:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
}

/* === PROFILE LINK === */
.ozki-instagram-profile-link {
    position: absolute;
    bottom: max(20px, 4vh);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    color: rgba(255,255,255,0.4);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.3s ease, letter-spacing 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.05em;
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .ozki-instagram-profile-link:hover {
        color: #fff;
        letter-spacing: 0.08em;
    }
}

/* === SCROLL PROGRESS DOTS (opsiyonel navigasyon) === */
.ozki-instagram-dots {
    position: absolute;
    right: clamp(16px, 4vw, 40px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ozki-instagram-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    transition: background 0.3s ease, height 0.3s ease;
}

.ozki-instagram-dot.is-active {
    background: #fff;
    height: 20px;
    border-radius: 2px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Desktop */
@media (min-width: 769px) {
    .ozki-instagram-stage {
        width: 400px;
        height: 620px;
    }
    .ozki-instagram-card {
        width: 360px;
        height: 540px;
    }
}

/* Tablet */
@media (max-width: 768px) {
    .ozki-instagram-counter {
        left: 15px;
    }

    .ozki-instagram-stage {
        height: 55dvh;
        width: 85vw;
        max-width: 340px;
    }

    .ozki-instagram-card {
        width: min(75vw, 280px);
        height: min(55dvh, 420px);
        /* Mobilde daha hızlı transition */
        transition:
            transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94),
            opacity 0.35s ease;
    }
}

/* Küçük telefon */
@media (max-width: 375px) {
    .ozki-instagram-header {
        top: 24px;
    }

    .ozki-instagram-title {
        font-size: 1.5rem;
    }

    .ozki-instagram-card {
        width: 78vw;
        height: 52dvh;
    }
}

/* iOS safe area */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .ozki-instagram-profile-link {
        bottom: max(calc(env(safe-area-inset-bottom) + 16px), 4vh);
    }
}
