/**
 * Lens Section Styles
 * Professional styling for lens categories section
 * Version: 2.2.0 - Optimized & Secured
 * CSP-Safe: No inline styles, external resources validated
 */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */

:root {
    --lens-section-bg: linear-gradient(135deg, rgba(15, 15, 35, 0.95) 0%, rgba(26, 26, 53, 0.9) 50%, rgba(15, 15, 35, 0.95) 100%);
    --lens-card-bg: rgba(30, 41, 59, 0.9);
    --lens-card-border: rgba(71, 85, 105, 0.4);
    --lens-card-border-hover: rgba(255, 107, 107, 0.6);
    --lens-card-radius: 20px;
    --lens-card-padding: 30px;
    --lens-card-min-height: 360px;
    --lens-transition-duration: 0.4s;
    --lens-transition-ease: cubic-bezier(0.23, 1, 0.32, 1);
    --lens-grid-gap: 24px;
    --lens-icon-size: 2.5rem;
    --lens-primary-color: #48dbfb;
    --lens-accent-color: #feca57;
    --lens-text-primary: #f1f5f9;
    --lens-text-secondary: #94a3b8;
    --lens-color-prime: #3b82f6;
    --lens-color-zoom: #8b5cf6;
    --lens-color-macro: #10b981;
    --lens-color-telephoto: #f59e0b;
    --lens-color-wide: #ef4444;
    --lens-color-specialty: #ec4899;
    --lens-focus-outline: 2px solid;
    --lens-focus-offset: 2px;
}

/* ============================================
   MAIN SECTION
   ============================================ */

.lens-section {
    position: relative;
    padding: 0;
    background: rgba(15, 15, 35, 0.95); /* fallback */
    background: var(--lens-section-bg);
    overflow: hidden;
    min-height: 600px;
    contain: layout style;
    content-visibility: auto;
}

/* ============================================
   BACKGROUND ELEMENTS
   ============================================ */

.lens-background {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.lens-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 40% 40%, rgba(72, 219, 251, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 107, 107, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.lens-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, rgba(255, 107, 107, 0.02) 0%, rgba(254, 202, 87, 0.03) 25%, rgba(72, 219, 251, 0.02) 50%, rgba(255, 159, 243, 0.03) 75%, rgba(255, 107, 107, 0.02) 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    pointer-events: none;
}

/* ============================================
   HEADER
   ============================================ */

.lens-header {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 60px auto;
    padding: 0 20px;
}

.lens-title {
    font-size: clamp(2.4rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 8s ease infinite;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
    letter-spacing: -0.5px;
}

.lens-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: #cbd5e0;
    margin-bottom: 30px;
    font-weight: 400;
    line-height: 1.6;
}

.header-accent-line {
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
    margin: 0 auto;
    border-radius: 2px;
    animation: pulseGlow 2s ease-in-out infinite alternate;
}

/* ============================================
   GRID LAYOUT
   ============================================ */

.lens-grid {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px; /* fallback */
    gap: var(--lens-grid-gap);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
}

/* ============================================
   LENS CARDS
   ============================================ */

.lens-card {
    position: relative;
    background: rgba(30, 41, 59, 0.9); /* fallback */
    background: var(--lens-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(71, 85, 105, 0.4); /* fallback */
    border: 1px solid var(--lens-card-border);
    border-radius: 20px; /* fallback */
    border-radius: var(--lens-card-radius);
    padding: 30px; /* fallback */
    padding: var(--lens-card-padding);
    text-decoration: none;
    color: #ffffff;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1); /* fallback */
    transition: all var(--lens-transition-duration) var(--lens-transition-ease);
    overflow: visible;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-height: 360px; /* fallback */
    min-height: var(--lens-card-min-height);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    contain: layout style;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* SECURITY: Block injected inline styles */
.lens-card[style*="transform"],
.lens-card[style*="transition"],
.lens-card[style*="animation"] {
    animation: none !important;
}

.lens-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease; /* fallback */
    transition: opacity var(--lens-transition-duration) ease;
    z-index: 1;
    pointer-events: none;
}

.lens-card:hover {
    transform: translate3d(0, -12px, 0) scale(1.01);
    border-color: rgba(255, 107, 107, 0.6); /* fallback */
    border-color: var(--lens-card-border-hover);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 8px 30px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.lens-card:hover::before {
    opacity: 1;
}

.lens-card:focus-visible {
    outline: 2px solid #48dbfb; /* fallback */
    outline: var(--lens-focus-outline) var(--lens-primary-color);
    outline-offset: 2px; /* fallback */
    outline-offset: var(--lens-focus-offset);
    z-index: 11;
}

/* ============================================
   CARD BACKGROUND EFFECTS
   ============================================ */

.lens-card-background {
    position: absolute;
    bottom: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    opacity: 0.1;
    transition: all 0.4s ease; /* fallback */
    transition: all var(--lens-transition-duration) ease;
    z-index: 1;
    pointer-events: none;
}

.lens-card[data-category="prime"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-prime) 0%, transparent 70%);
}

.lens-card[data-category="zoom"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-zoom) 0%, transparent 70%);
}

.lens-card[data-category="macro"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-macro) 0%, transparent 70%);
}

.lens-card[data-category="telephoto"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-telephoto) 0%, transparent 70%);
}

.lens-card[data-category="wide-angle"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-wide) 0%, transparent 70%);
}

.lens-card[data-category="specialty"] .lens-card-background {
    background: radial-gradient(circle, var(--lens-color-specialty) 0%, transparent 70%);
}

.lens-card:hover .lens-card-background {
    opacity: 0.2;
    width: 150px;
    height: 150px;
    bottom: -40px;
    right: -40px;
}

/* ============================================
   ICON CONTAINER
   ============================================ */

.lens-icon-container {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    z-index: 2;
}

.lens-icon {
    font-size: 2.5rem; /* fallback */
    font-size: var(--lens-icon-size);
    z-index: 2;
    position: relative;
    transition: transform 0.3s ease;
    color: #48dbfb; /* fallback */
    color: var(--lens-primary-color);
    pointer-events: none;
}

.lens-card:hover .lens-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 5px 15px rgba(72, 219, 251, 0.4));
}

/* ============================================
   CARD CONTENT
   ============================================ */

.lens-card-title {
    position: relative;
    z-index: 2;
    font-size: 1.4rem;
    font-weight: 700;
    color: #f1f5f9; /* fallback */
    color: var(--lens-text-primary);
    margin-bottom: 12px;
    line-height: 1.3;
    transition: color 0.3s ease;
    pointer-events: none;
}

.lens-card:hover .lens-card-title {
    color: #feca57; /* fallback */
    color: var(--lens-accent-color);
    text-shadow: 0 0 20px rgba(254, 202, 87, 0.5);
}

.lens-card-description {
    position: relative;
    z-index: 2;
    color: #94a3b8; /* fallback */
    color: var(--lens-text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
    pointer-events: none;
}

/* ============================================
   FEATURES
   ============================================ */

.lens-features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.lens-feature {
    padding: 4px 8px;
    background: rgba(72, 219, 251, 0.1);
    color: #48dbfb; /* fallback */
    color: var(--lens-primary-color);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(72, 219, 251, 0.2);
    transition: all 0.3s ease;
    pointer-events: none;
}

.lens-card:hover .lens-feature {
    background: rgba(72, 219, 251, 0.2);
    border-color: rgba(72, 219, 251, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   CTA BUTTON
   ============================================ */

.lens-cta {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    margin-top: auto;
    color: #ffffff;
    text-decoration: none;
}

.lens-cta:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(72, 219, 251, 0.3);
    color: #ffffff;
    text-decoration: none;
}

.lens-cta:focus-visible {
    outline: 2px solid #48dbfb; /* fallback */
    outline: var(--lens-focus-outline) var(--lens-primary-color);
    outline-offset: 2px; /* fallback */
    outline-offset: var(--lens-focus-offset);
}

.cta-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    transition: color 0.3s ease;
    pointer-events: none;
}

.lens-cta-arrow {
    font-size: 0.9rem;
    color: #48dbfb; /* fallback */
    color: var(--lens-primary-color);
    transition: transform 0.3s ease;
    pointer-events: none;
}

.lens-cta:hover .lens-cta-arrow {
    transform: translateX(5px);
}

/* ============================================
   PREVENT FLASH OF UNSTYLED CONTENT (FOUC)
   ============================================ */

.lens-section .lens-grid {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    animation: fadeInLensFallback 0.5s ease-in-out 2s forwards;
}

.lens-section.lens-slideshow-enabled .lens-grid {
    opacity: 1;
    animation: none;
}

@keyframes fadeInLensFallback {
    to { opacity: 1; }
}

.lens-section .lens-carousel-track {
    opacity: 1 !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
    }
    to {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.8), 0 0 30px rgba(254, 202, 87, 0.4);
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .lens-card,
    .lens-icon,
    .lens-feature,
    .lens-cta,
    .lens-cta-arrow,
    .lens-card-background,
    .lens-card::before,
    .lens-title,
    .lens-gradient-overlay,
    .header-accent-line {
        transition: none !important;
        animation: none !important;
    }
    
    .lens-card:hover,
    .lens-card:hover .lens-icon {
        transform: none;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .lens-card,
    .lens-feature {
        border: 2px solid currentColor;
    }
    
    .lens-card:focus-visible {
        outline-width: 3px;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --lens-card-bg: rgba(20, 31, 49, 0.95);
        --lens-card-border: rgba(71, 85, 105, 0.5);
    }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .lens-section {
        padding: 0;
    }
    
    .lens-header {
        margin: 40px auto;
    }
    
    .lens-grid {
        padding: 0 20px 40px 20px;
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .lens-card {
        min-height: 320px;
        padding: 24px 20px;
    }
    
    .lens-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .lens-header {
        margin: 30px auto;
    }
    
    .lens-grid {
        padding: 0 15px 30px 15px;
    }
    
    .lens-card-title {
        font-size: 1.25rem;
    }
    
    .lens-card-description {
        font-size: 0.9rem;
    }
    
    .lens-cta {
        padding: 12px 20px;
        font-size: 0.85rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .lens-background,
    .lens-particles,
    .lens-gradient-overlay {
        display: none !important;
    }
    
    .lens-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    .lens-card:hover {
        transform: none;
    }
}
