/* ==========================================================================
   Story Pin Block - GSAP Powered Pinned Cards
   Enhanced with GPU optimizations and accessibility
   ========================================================================== */

/* Main Wrapper */
.blz-storypin-wrapper {
    position: relative;
    width: 100%;
    height: 700px;
    overflow: hidden;
}


.story-pin-block{
   height:100vh;             /* full viewport */
   max-height:100vh;         /* guard against overflow */
}

.blz-storypin-wrapper.alignfull {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

/* Background Layer - Separated for clean stacking */
.storypin-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

/* Fixed Background Elements */
.storypin-bgcolor {
    width: 100%;
    height: 100%;
    position: relative;
}

.storypin-bgvideo,
.storypin-bgimage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Decorative Elements */
.storypin-deco {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 1;
}

.storypin-deco-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -150px;
}

.storypin-deco-2 {
    width: 200px;
    height: 200px;
    bottom: -100px;
    right: -100px;
}

/* Cards Stage */
.storypin-stage {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 3rem;
    z-index: 2;
}

/* Individual Panel - GPU Optimized */
.storypin-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    will-change: transform, opacity; /* GPU hint */
}

/* Panel Alignment */
.storypin-align-left {
    justify-content: flex-start;
}

.storypin-align-center {
    justify-content: center;
}

.storypin-align-right {
    justify-content: flex-end;
}

/* Content Box */
.storypin-box {
    background: white;
    padding: 3rem;
    border-radius: 1rem;
    width: 500px;
    min-width: 500px;
    max-width: 500px;
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.2), 0 15px 40px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

/* Typography */
.storypin-label {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.storypin-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: #000;
    margin: 0 0 1.5rem 0;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.storypin-text {
    font-size: 1.375rem;
    line-height: 1.6;
    color: #666;
    margin-bottom: 2rem;
}

.storypin-text p {
    margin: 0 0 1rem 0;
}

.storypin-text p:last-child {
    margin-bottom: 0;
}

/* Arrow */
.storypin-arrow {
    display: flex;
    justify-content: flex-end;
}

.storypin-align-center .storypin-arrow {
    justify-content: center;
}

.storypin-arrow svg {
    width: 48px;
    height: 48px;
    color: #000;
    transition: all 0.3s ease;
    cursor: pointer;
}

.storypin-arrow svg:hover {
    color: #FF006E;
    transform: translateX(5px);
}

/* Blob Shape - GPU Optimized */
.storypin-blob {
    position: absolute;
    width: 400px;
    height: 400px;
    color: var(--blob-color, #FF69B4);
    opacity: 0;
    z-index: 1;
    will-change: transform, opacity; /* GPU hint */
    transform-origin: center; /* Prevent pixel jump */
}

.storypin-blob svg {
    width: 100%;
    height: 100%;
}

/* Blob Positions based on alignment */
.storypin-align-right .storypin-blob {
    top: 10%;
    right: -15%;
}

.storypin-align-left .storypin-blob {
    top: 10%;
    left: -15%;
}

.storypin-align-center .storypin-blob {
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .storypin-panel,
    .storypin-blob,
    .storypin-deco {
        animation: none !important;
        transform: none !important;
        transition: none !important;
    }
    
    /* Show all panels in reduced motion mode */
    .storypin-panel {
        position: relative;
        opacity: 1;
        visibility: visible;
        margin-bottom: 2rem;
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .storypin-text {
        font-size: 1.25rem;
    }
}

@media (max-width: 1024px) {
    .storypin-stage {
        padding: 0 2rem;
    }
    
    .storypin-box {
        padding: 2.5rem;
        width: 450px;
        min-width: 450px;
        max-width: 450px;
    }
    
    .storypin-title {
        font-size: 2rem;
    }
    
    .storypin-text {
        font-size: 1.125rem;
    }
    
    .storypin-blob {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 768px) {
    .blz-storypin-wrapper {
        height: 600px;
    }
    
    .storypin-stage {
        padding: 0 1.5rem;
    }
    
    .storypin-panel {
        justify-content: center !important;
    }
    
    .storypin-box {
        padding: 2rem;
        text-align: center;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }
    
    .storypin-label {
        font-size: 0.75rem;
    }
    
    .storypin-title {
        font-size: 1.75rem;
    }
    
    .storypin-text {
        font-size: 1rem;
    }
    
    .storypin-arrow {
        justify-content: center;
    }
    
    /* Hide blobs on mobile for performance */
    .storypin-blob,
    .storypin-deco {
        display: none;
    }
}

/* ==========================================================================
   Grid Mode Styles - Story Mosaic Card Style
   ========================================================================== */

.storypin-grid-mode {
    height: 100vh !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    perspective: 1200px;
    perspective-origin: 50% 50%;
}

.storypin-grid-mode .storypin-stage {
    position: relative; /* Important for ball positioning */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 1rem 1.5rem; /* Reduced row gap, kept column gap */
    height: auto;
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 3rem 2rem; /* Added top padding to avoid header overlap */
    align-items: center;
    justify-content: center;
    align-content: center;
    min-height: calc(100vh - 100px); /* Adjusted for top padding */
    transform-style: preserve-3d;
}

.storypin-grid-mode .storypin-panel {
    position: relative !important;
    height: auto !important;
    display: flex;
    align-items: stretch;
    justify-content: center !important; /* Override alignment classes */
    padding: 0;
}

/* Override panel alignment in grid mode */
.storypin-grid-mode .storypin-align-left,
.storypin-grid-mode .storypin-align-center,
.storypin-grid-mode .storypin-align-right {
    justify-content: center !important;
}

/* Ensure proper grid layout for exactly 4 panels */
.storypin-grid-mode .storypin-panel:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}

.storypin-grid-mode .storypin-panel:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}

.storypin-grid-mode .storypin-panel:nth-child(3) {
    grid-column: 1;
    grid-row: 2;
}

.storypin-grid-mode .storypin-panel:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
}

/* Base card styles for all hover effects */
.storypin-grid-mode .storypin-box {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    width: 100%;
    max-width: none;
    min-width: auto;
    margin: 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

/* Basic hover for all effects */
.storypin-grid-mode .storypin-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Typography matching Story Mosaic */
.storypin-grid-mode .storypin-label {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 0.75rem;
    display: block;
}

.storypin-grid-mode .storypin-title {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: #52ddc4;
    margin-bottom: 1.25rem;
}

.storypin-grid-mode .storypin-text {
    font-size: 1.125rem;
    line-height: 1.6;
    color: #333;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.storypin-grid-mode .storypin-text p {
    margin-bottom: 1rem;
}

.storypin-grid-mode .storypin-text p:last-child {
    margin-bottom: 0;
}

/* Arrow link styling to match Story Mosaic */
.storypin-grid-mode .storypin-arrow {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.storypin-grid-mode .storypin-arrow-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #52ddc4;
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.3s ease;
}

.storypin-grid-mode .storypin-arrow-link:hover {
    gap: 0.75rem;
}

.storypin-grid-mode .storypin-arrow svg {
    width: 40px;
    height: 40px;
    color: #52ddc4;
}

/* Animated gradient borders for cards */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Floating particles effect */
@keyframes float-particle {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateY(-10px) translateX(5px) scale(1);
        opacity: 1;
    }
    90% {
        transform: translateY(-100px) translateX(-5px) scale(0.5);
        opacity: 0;
    }
}

/* Add animated border gradient on hover */
.storypin-grid-mode .storypin-box {
    position: relative;
    background-clip: padding-box;
}

.storypin-grid-mode .storypin-box.has-gradient-border::before {
    background: linear-gradient(45deg, #52ddc4, #4ecdc4, #3eb8a8, #52ddc4);
    background-size: 400% 400%;
    animation: gradient-shift 3s ease infinite;
}

/* Floating particles on panels */
.storypin-grid-mode .storypin-panel::before,
.storypin-grid-mode .storypin-panel::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #52ddc4 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.storypin-grid-mode .storypin-panel::before {
    top: 20%;
    left: 10%;
    animation: float-particle 6s ease-in-out infinite;
}

.storypin-grid-mode .storypin-panel::after {
    top: 30%;
    right: 10%;
    animation: float-particle 6s ease-in-out infinite 3s;
}

/* Hide blobs in grid mode for cleaner card appearance */
.storypin-grid-mode .storypin-blob {
    display: none;
}

/* ==========================================================================
   GSAP Hover Effects Base Styles
   ========================================================================== */

/* Clean base hover for all effects */
.storypin-grid-mode .storypin-box {
    cursor: pointer;
}

/* No Effect - Clean minimal hover */
.hover-effect-none .storypin-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* 2. Holographic Foil Effect */
.hover-effect-holographic .storypin-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        transparent 25%,
        rgba(255, 255, 255, 0.2) 25%,
        rgba(255, 255, 255, 0.2) 28%,
        rgba(255, 0, 255, 0.2) 35%,
        rgba(0, 255, 255, 0.2) 42%,
        rgba(255, 255, 0, 0.2) 50%,
        rgba(255, 0, 255, 0.2) 58%,
        rgba(0, 255, 255, 0.2) 65%,
        transparent 72%
    );
    background-size: 50px 50px;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hover-effect-holographic .storypin-box:hover::before {
    opacity: 1;
    animation: holographic-shift 3s linear infinite;
}

@keyframes holographic-shift {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

/* 3. Gold Foil Effect */
.hover-effect-gold-foil .storypin-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(255, 215, 0, 0.3) 0%,
        rgba(255, 165, 0, 0.2) 20%,
        rgba(184, 134, 11, 0.15) 40%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hover-effect-gold-foil .storypin-box:hover::before {
    opacity: 1;
}

.hover-effect-gold-foil .storypin-box:hover {
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.15);
}

/* 4. Silver Foil Effect */
.hover-effect-silver-foil .storypin-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(192, 192, 192, 0.4) 0%,
        rgba(229, 229, 229, 0.3) 20%,
        rgba(160, 160, 160, 0.2) 40%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hover-effect-silver-foil .storypin-box:hover::before {
    opacity: 1;
}

.hover-effect-silver-foil .storypin-box:hover {
    border-color: rgba(192, 192, 192, 0.3);
    box-shadow: 0 8px 32px rgba(192, 192, 192, 0.2);
}

/* 5. Oil Slick / Prismatic Effect */
.hover-effect-oil-slick .storypin-box::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        #ff0080,
        #00ff88,
        #0080ff,
        #ff0080,
        #ffff00,
        #ff0080
    );
    opacity: 0;
    filter: blur(30px);
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: -1;
}

.hover-effect-oil-slick .storypin-box:hover::before {
    opacity: 0.3;
    animation: oil-flow 4s linear infinite;
}

@keyframes oil-flow {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 6. Chrome Mirror Effect */
.hover-effect-chrome .storypin-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(255, 255, 255, 0.8) 45%,
        rgba(255, 255, 255, 0.8) 55%,
        transparent 100%
    );
    transform: translateX(-100%) translateY(-100%);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 1;
}

.hover-effect-chrome .storypin-box:hover::before {
    transform: translateX(100%) translateY(100%);
}

.hover-effect-chrome .storypin-box:hover {
    background: linear-gradient(
        135deg,
        #ffffff 0%,
        #e0e0e0 25%,
        #ffffff 50%,
        #e0e0e0 75%,
        #ffffff 100%
    );
}

/* 7. Aurora / Northern Lights Effect */
.hover-effect-aurora .storypin-box::before {
    content: '';
    position: absolute;
    inset: -20px;
    background: linear-gradient(
        45deg,
        rgba(0, 255, 170, 0.3),
        rgba(0, 170, 255, 0.3),
        rgba(170, 0, 255, 0.3),
        rgba(255, 0, 170, 0.3)
    );
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: -1;
}

.hover-effect-aurora .storypin-box:hover::before {
    opacity: 1;
    animation: aurora-wave 6s ease-in-out infinite;
}

@keyframes aurora-wave {
    0%, 100% { 
        transform: translateY(0) scale(1);
        filter: blur(20px) hue-rotate(0deg);
    }
    50% { 
        transform: translateY(-10px) scale(1.05);
        filter: blur(25px) hue-rotate(60deg);
    }
}

/* 8. Neon Glow Effect */
.hover-effect-neon .storypin-box {
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.hover-effect-neon .storypin-box:hover {
    border-color: #52ddc4;
    box-shadow: 
        0 0 10px #52ddc4,
        0 0 20px #52ddc4,
        0 0 30px #52ddc4,
        0 0 40px #52ddc4,
        inset 0 0 15px rgba(82, 221, 196, 0.1);
    animation: neon-pulse 1.5s ease-in-out infinite;
}

@keyframes neon-pulse {
    0%, 100% { 
        box-shadow: 
            0 0 10px #52ddc4,
            0 0 20px #52ddc4,
            0 0 30px #52ddc4,
            0 0 40px #52ddc4,
            inset 0 0 15px rgba(82, 221, 196, 0.1);
    }
    50% { 
        box-shadow: 
            0 0 15px #52ddc4,
            0 0 30px #52ddc4,
            0 0 45px #52ddc4,
            0 0 60px #52ddc4,
            inset 0 0 20px rgba(82, 221, 196, 0.15);
    }
}

/* 9. Diamond Refraction Effect */
.hover-effect-diamond .storypin-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: conic-gradient(
        from 45deg at 50% 50%,
        transparent,
        rgba(255, 0, 255, 0.2),
        transparent,
        rgba(0, 255, 255, 0.2),
        transparent,
        rgba(255, 255, 0, 0.2),
        transparent,
        rgba(255, 0, 255, 0.2)
    );
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    opacity: 0;
    transition: all 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hover-effect-diamond .storypin-box:hover::before {
    opacity: 1;
    transform: rotate(45deg) scale(1.2);
}

.hover-effect-diamond .storypin-box:hover {
    box-shadow: 
        0 8px 32px rgba(255, 0, 255, 0.1),
        0 8px 32px rgba(0, 255, 255, 0.1);
}

/* 10. Liquid Metal Effect */
.hover-effect-liquid-metal .storypin-box::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(192, 192, 192, 0.6) 0%,
        rgba(128, 128, 128, 0.4) 30%,
        transparent 70%
    );
    filter: blur(10px) contrast(2);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hover-effect-liquid-metal .storypin-box:hover::before {
    opacity: 1;
}

.hover-effect-liquid-metal .storypin-box:hover {
    background: linear-gradient(
        135deg,
        rgba(240, 240, 240, 0.98),
        rgba(200, 200, 200, 0.95)
    );
    box-shadow: 
        0 8px 32px rgba(128, 128, 128, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

/* Grid Mode Responsive */
@media (max-width: 1200px) {
    .storypin-grid-mode .storypin-stage {
        gap: 0.75rem 1.25rem;
        padding: 2rem;
    }
    
    .storypin-grid-mode .storypin-box {
        padding: 2rem;
        min-height: 240px;
    }
    
    .storypin-grid-mode .storypin-title {
        font-size: 1.75rem;
    }
    
    .storypin-grid-mode .storypin-text {
        font-size: 1rem;
    }
}

@media (max-width: 968px) {
    .storypin-grid-mode .storypin-stage {
        grid-template-columns: 1fr;
        grid-template-rows: repeat(4, auto);
        gap: 1rem;
        padding: 2rem 1.5rem;
        height: auto;
        min-height: 100vh;
        align-content: center;
    }
    
    /* Stack panels vertically on mobile */
    .storypin-grid-mode .storypin-panel:nth-child(1),
    .storypin-grid-mode .storypin-panel:nth-child(2),
    .storypin-grid-mode .storypin-panel:nth-child(3),
    .storypin-grid-mode .storypin-panel:nth-child(4) {
        grid-column: 1;
        grid-row: auto;
    }
    
    .storypin-grid-mode .storypin-box {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .storypin-grid-mode .storypin-stage {
        padding: 1.5rem 1rem;
        gap: 1rem;
    }
    
    .storypin-grid-mode .storypin-box {
        padding: 1.5rem;
        min-height: auto;
    }
    
    .storypin-grid-mode .storypin-label {
        font-size: 0.75rem;
    }
    
    .storypin-grid-mode .storypin-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .storypin-grid-mode .storypin-text {
        font-size: 0.9375rem;
        margin-bottom: 1rem;
    }
    
    .storypin-grid-mode .storypin-arrow svg {
        width: 32px;
        height: 32px;
    }
}