/* ============================================
   SCROLL-SYNCED TECH STACK VIDEO
   Shared component for Homepage + Web Dev page
   ============================================ */

/*
 * FIX: overflow-x: hidden on html/body breaks position: sticky.
 * Using overflow-x: clip instead — same visual effect but doesn't
 * create a new scroll container, so sticky still works.
 */
html,
body {
    overflow-x: clip !important;
}

/* --- Main Section Container --- */
.ts-scroll-video {
    position: relative;
    height: 500vh;
    background: #000 !important;
    color-scheme: dark;
    color: #fff !important;
}

/* Lock all children to dark-mode colors regardless of site theme */
.ts-scroll-video,
.ts-scroll-video *,
.ts-scroll-video *::before,
.ts-scroll-video *::after {
    color-scheme: dark;
}

.ts-scroll-video .ts-sticky {
    background: #000 !important;
}

.ts-scroll-video .ts-header-title,
.ts-scroll-video .ts-header h2,
.ts-scroll-video h2.ts-header-title,
.ts-scroll-video .ts-header-title * {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    background: none !important;
}

.ts-scroll-video .ts-header-title .gradient-text {
    background: linear-gradient(90deg, #cf5b2e, #22d3ee) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.ts-scroll-video .ts-header-label {
    color: #cf5b2e !important;
    background: rgba(207, 91, 46, 0.15) !important;
}

@media (max-width: 768px) {
    .ts-scroll-video {
        height: 350vh;
    }
}

/* --- Sticky Video Container --- */
.ts-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* --- Video Element --- */
.ts-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Gradient Edges (cinematic framing) --- */
.ts-sticky::before,
.ts-sticky::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    z-index: 2;
    pointer-events: none;
}

.ts-sticky::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.ts-sticky::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

/* --- Section Header Overlay --- */
.ts-header {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.ts-header.visible {
    opacity: 1;
}

.ts-header-label {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: rgba(207, 91, 46, 0.15);
    border: 1px solid rgba(207, 91, 46, 0.3);
    border-radius: 100px;
    color: #cf5b2e;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.ts-header-title {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
}

.ts-header-title .gradient-text {
    background: linear-gradient(90deg, #cf5b2e, #22d3ee);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Icon Overlay Layer --- */
.ts-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* --- Individual Tech Icons (enhanced visibility) --- */
.ts-icon {
    position: absolute;
    width: 56px;
    height: 56px;
    padding: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.3), 0 0 40px rgba(207, 91, 46, 0.15);
    opacity: 0;
    transform: scale(0.5) translateY(10px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    object-fit: contain;
}

.ts-icon.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: tsIconFloat 4s ease-in-out infinite;
}

.ts-icon:nth-child(2n) {
    animation-delay: -1s;
}

.ts-icon:nth-child(3n) {
    animation-delay: -2s;
}

/* OpenAI logo is white-on-transparent — needs light bg */
.ts-icon[alt="OpenAI"] {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.4), 0 0 40px rgba(16, 163, 127, 0.3);
}

@keyframes tsIconFloat {

    0%,
    100% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1) translateY(-6px);
    }
}

/* --- Bottom Label (shot narrative) --- */
.ts-label {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
    text-align: center;
    pointer-events: none;
}

.ts-label-text {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ts-label-text.visible {
    opacity: 1;
}

/* --- Scroll Progress Bar --- */
.ts-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, #cf5b2e, #22d3ee);
    z-index: 5;
    transition: width 0.05s linear;
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(207, 91, 46, 0.4);
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
    .ts-icon {
        width: 36px;
        height: 36px;
        padding: 7px;
    }

    .ts-header-title {
        font-size: 1.5rem;
    }

    /* Constrain icons to the center video area on mobile */
    .ts-overlay {
        top: 15%;
        bottom: 20%;
        left: 5%;
        right: 5%;
    }

    .ts-label {
        bottom: 12%;
    }

    .ts-sticky::before,
    .ts-sticky::after {
        height: 60px;
    }

    .ts-label-text {
        font-size: 0.7rem;
        padding: 0.4rem 1rem;
    }
}