/* ============================================
   STICKY GLASS TITLE EFFECT
   ============================================
   
   Premium glass morphism effect for page titles
   that becomes sticky on scroll with smooth animations
   
   Usage: Add .sticky-title-wrapper to your hero section
*/

/* Sticky Title Container */
.sticky-title-wrapper {
    position: relative;
    z-index: 998;
}

/* Sticky Glass Bar */
.page-title-sticky {
    position: sticky;
    top: 80px; /* Below navbar */
    z-index: 998; /* Below navbar (1000) but above content */
    
    /* Dark Gradient Glass Effect */
    background: linear-gradient(
        135deg,
        rgba(10, 22, 40, 0.95) 0%,      /* Dark navy base */
        rgba(26, 41, 66, 0.90) 50%,      /* Mid navy */
        rgba(13, 148, 136, 0.15) 100%    /* Teal accent hint */
    );
    
    /* Glass Morphism - The Magic! */
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    /* Elegant Border with Glow */
    border-bottom: 1px solid rgba(20, 184, 166, 0.3);
    
    /* Premium Multi-Layer Shadow */
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),           /* Main shadow */
        0 0 0 1px rgba(255, 255, 255, 0.05),     /* Subtle outline */
        inset 0 1px 0 rgba(255, 255, 255, 0.1);  /* Inner highlight */
    
    /* Smooth Transitions - Elegant Easing */
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
    
    /* Layout */
    padding: 20px 0;
    margin: 0;
    
    /* Initially Hidden - Will Slide In */
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

/* Active State - Visible When Scrolling */
.page-title-sticky.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s; /* No delay when showing */
}

/* Hover Enhancement - Subtle Glow */
.page-title-sticky.active:hover {
    border-bottom-color: rgba(20, 184, 166, 0.5);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Title Content Container */
.sticky-title-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* Main Title */
.sticky-title-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    
    /* Smooth transitions */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s;
}

/* Title visible when parent is active */
.page-title-sticky.active .sticky-title-content h1 {
    opacity: 1;
    transform: translateY(0);
}

/* Subtitle (Optional) */
.sticky-title-content .subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    margin: 5px 0 0 0;
}

/* Badge/Tag (Optional) */
.sticky-title-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(20, 184, 166, 0.2);
    border: 1px solid rgba(20, 184, 166, 0.4);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #14B8A6;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    
    /* Smooth transitions */
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease 0.3s, transform 0.5s ease 0.3s;
}

/* Badge visible when parent is active */
.page-title-sticky.active .sticky-title-badge {
    opacity: 1;
    transform: translateX(0);
}

/* Icon in Badge */
.sticky-title-badge i {
    font-size: 1rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Shimmer Effect on Load (Optional Enhancement) */
.page-title-sticky.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    animation: shimmer 4s ease-in-out 1s infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

/* Show shimmer only after main animation completes */
.page-title-sticky.active::before {
    opacity: 1;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 200%;
    }
}

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

/* Tablet & Below */
@media (max-width: 1024px) {
    .page-title-sticky {
        top: 70px; /* Slightly lower navbar */
        padding: 18px 0;
    }
    
    .sticky-title-content h1 {
        font-size: clamp(1.3rem, 4vw, 1.8rem);
    }
    
    .sticky-title-badge {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .page-title-sticky {
        top: 70px; /* Mobile navbar height (increased for better visibility) */
        padding: 15px 0;
        z-index: 998; /* Ensure below navbar */
        
        /* Lighter blur for better mobile performance */
        backdrop-filter: blur(15px) saturate(150%);
        -webkit-backdrop-filter: blur(15px) saturate(150%);
    }
    
    .sticky-title-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sticky-title-content h1 {
        font-size: clamp(1.2rem, 5vw, 1.5rem);
        line-height: 1.4;
    }
    
    .sticky-title-badge {
        padding: 6px 12px;
        font-size: 0.8rem;
        align-self: flex-start;
    }
    
    /* Disable shimmer on mobile for performance */
    .page-title-sticky.active::before {
        display: none;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .page-title-sticky {
        top: 70px; /* Consistent with mobile */
        padding: 12px 0;
        z-index: 998;
    }
    
    .sticky-title-content h1 {
        font-size: 1.1rem;
    }
    
    .sticky-title-badge {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* GPU Acceleration */
.page-title-sticky {
    will-change: transform, opacity;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .page-title-sticky,
    .sticky-title-content h1,
    .sticky-title-badge {
        animation: none;
        transition: none;
    }
    
    .page-title-sticky.active::before {
        display: none;
    }
}

/* ============================================
   DARK MODE SUPPORT (If needed later)
   ============================================ */

@media (prefers-color-scheme: light) {
    /* Can add light mode variant if needed */
    /* Currently optimized for dark theme */
}

/* ============================================
   BROWSER COMPATIBILITY FALLBACKS
   ============================================ */

/* For browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(20px)) {
    .page-title-sticky {
        background: rgba(10, 22, 40, 0.98); /* More opaque fallback */
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .page-title-sticky {
        position: static;
        background: none;
        backdrop-filter: none;
        border: none;
        box-shadow: none;
        opacity: 1 !important;
        transform: none !important;
    }
}
