/**
 * Internal Links Booster - US Version 2026
 * Version: 3.1.0
 * Design: Mobile-First, Premium 2026
 * Colors: Warm Brown/Chocolate with White/Orange
 */

/* =====================================
   CSS VARIABLES - MODERN 2026
   ===================================== */

:root {
    --ilb-bg-dark: #3d2e24;
    --ilb-bg-darker: #2d2118;
    --ilb-accent-orange: #ff8c5a;
    --ilb-orange-hover: #ff6b35;
    --ilb-text-white: #ffffff;
    --ilb-text-cream: #f5e6d3;
    --ilb-border-light: rgba(255, 140, 90, 0.2);
    --ilb-shadow: rgba(0, 0, 0, 0.3);
    --ilb-radius: 14px;
    --ilb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================
   RELATED POSTS CONTAINER - MOBILE FIRST
   ===================================== */

.ilb-related-container {
    /* Elegant gradient background */
    background: linear-gradient(135deg, 
        #3d2e24 0%, 
        #2d2118 100%
    );
    
    /* Fluid spacing - mobile first */
    padding: clamp(18px, 4.5vw, 28px);
    margin: clamp(24px, 6vw, 40px) 0;
    
    /* Modern border radius */
    border-radius: var(--ilb-radius);
    border: 1px solid rgba(255, 140, 90, 0.15);
    border-left: 3px solid var(--ilb-accent-orange);
    
    /* Elegant shadow */
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 8px 24px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    
    /* Performance optimizations */
    transition: transform var(--ilb-transition), 
                box-shadow var(--ilb-transition);
    transform: translateZ(0);
    will-change: transform;
    contain: layout style paint;
    
    /* Responsive min-height */
    min-height: clamp(100px, 20vw, 140px);
}

/* Subtle hover effect */
@media (hover: hover) {
    .ilb-related-container:hover {
        transform: translateY(-2px);
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.25),
            0 12px 32px rgba(0, 0, 0, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
        border-left-color: var(--ilb-orange-hover);
    }
}

/* =====================================
   ARTICLE LINKS - 2026 DESIGN
   ===================================== */

.ilb-article-link {
    /* Modern flex layout */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(12px, 3vw, 20px);
    
    /* Fluid spacing */
    padding: clamp(16px, 4vw, 22px) clamp(18px, 4.5vw, 26px);
    margin: clamp(10px, 2.5vw, 14px) 0;
    
    /* Transparent background with elegant border */
    background: transparent;
    
    /* Elegant border */
    border: 1.5px solid rgba(255, 140, 90, 0.2);
    border-radius: clamp(10px, 2.5vw, 12px);
    
    /* Optimal typography */
    color: var(--ilb-text-white);
    font-weight: 600;
    font-size: clamp(15px, 3.8vw, 17px);
    line-height: 1.5;
    letter-spacing: -0.01em;
    text-decoration: none;
    
    /* Smooth transitions */
    transition: 
        background var(--ilb-transition),
        border-color var(--ilb-transition),
        color var(--ilb-transition),
        transform var(--ilb-transition),
        box-shadow var(--ilb-transition);
    
    /* Performance */
    transform: translateZ(0);
    will-change: transform;
    position: relative;
    overflow: hidden;
}

/* Hover states - Vibrant orange and elegant */
.ilb-article-link:hover,
.ilb-article-link:focus {
    background: linear-gradient(135deg, 
        rgba(255, 107, 53, 0.15) 0%, 
        rgba(255, 140, 90, 0.1) 100%
    );
    border-color: var(--ilb-orange-hover);
    color: var(--ilb-text-white);
    transform: translateX(6px) scale(1.01);
    box-shadow: 
        0 4px 16px rgba(255, 107, 53, 0.25),
        inset 0 1px 0 rgba(255, 140, 90, 0.2);
    outline: none;
}

.ilb-article-link:active {
    transform: translateX(4px) scale(0.99);
}

/* Focus visible for accessibility */
.ilb-article-link:focus-visible {
    outline: 2px solid var(--ilb-orange-hover);
    outline-offset: 4px;
}

/* Shimmer effect on hover */
.ilb-article-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 140, 90, 0.1) 50%,
        transparent 100%
    );
    transition: left 0.5s ease;
}

.ilb-article-link:hover::before {
    left: 100%;
}

/* =====================================
   ARTICLE TITLE
   ===================================== */

.ilb-article-title {
    flex: 1;
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative;
    z-index: 1;
    
    /* Mobile reading optimization */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* =====================================
   ARROW ICON - 2026 ANIMATION
   ===================================== */

.ilb-link-icon {
    /* Fluid sizing */
    font-size: clamp(22px, 5.5vw, 26px);
    color: var(--ilb-accent-orange);
    
    /* Perfect centering */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* Fixed dimensions to prevent CLS */
    width: clamp(26px, 6.5vw, 32px);
    height: clamp(26px, 6.5vw, 32px);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    
    /* Smooth bounce transition */
    transition: transform var(--ilb-transition), color var(--ilb-transition);
    will-change: transform;
}

.ilb-article-link:hover .ilb-link-icon {
    color: var(--ilb-orange-hover);
    transform: translateX(6px) scale(1.15);
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.4));
    animation: ilb-bounce 0.6s ease-in-out;
}

@keyframes ilb-bounce {
    0%, 100% { transform: translateX(6px) scale(1.15); }
    50% { transform: translateX(8px) scale(1.2); }
}

/* =====================================
   RESPONSIVE DESIGN - 2026 BREAKPOINTS
   ===================================== */

/* Small mobile (320px-480px) */
@media (max-width: 480px) {
    .ilb-related-container {
        padding: 16px;
        margin: 20px 0;
        border-radius: 12px;
        border-left-width: 3px;
    }
    
    .ilb-article-link {
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 8px;
        border-width: 1.5px;
    }
    
    .ilb-link-icon {
        font-size: 20px;
    }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .ilb-related-container {
        padding: 28px 32px;
        margin: 48px 0;
        border-left-width: 4px;
    }
    
    .ilb-article-link {
        padding: 20px 28px;
        border-width: 2px;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .ilb-related-container {
        padding: 32px 36px;
    }
    
    .ilb-article-link {
        padding: 22px 30px;
        font-size: 17px;
    }
    
    /* More pronounced hover on desktop */
    .ilb-article-link:hover {
        transform: translateX(8px) scale(1.02);
    }
}

/* =====================================
   MODERN ACCESSIBILITY
   ===================================== */

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .ilb-article-link::before {
        display: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ilb-article-link {
        border: 3px solid currentColor;
    }
    
    .ilb-related-container {
        border: 2px solid currentColor;
    }
}

/* Optimized dark mode */
@media (prefers-color-scheme: dark) {
    .ilb-related-container {
        background: linear-gradient(135deg, 
            #2a1f18 0%, 
            #1a120d 100%
        );
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.4),
            0 8px 24px rgba(0, 0, 0, 0.3);
    }
}

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

@media print {
    .ilb-related-container {
        box-shadow: none;
        border: 2px solid #333 !important;
        break-inside: avoid;
        background: white !important;
    }
    
    .ilb-article-link {
        background: white !important;
        color: #333 !important;
        border: 1px solid #666 !important;
    }
    
    .ilb-link-icon {
        display: none;
    }
}

/* =====================================
   LOADING SKELETON - MODERN
   ===================================== */

.ilb-related-container.ilb-loading {
    background: linear-gradient(
        90deg,
        #3d2e24 0%,
        #4a3a2e 50%,
        #3d2e24 100%
    );
    background-size: 200% 100%;
    animation: ilb-skeleton-shimmer 2s ease-in-out infinite;
}

@keyframes ilb-skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================
   UTILITY CLASSES
   ===================================== */

.ilb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Container queries (2026 feature) */
@supports (container-type: inline-size) {
    .ilb-related-container {
        container-type: inline-size;
        container-name: ilb-container;
    }
    
    @container ilb-container (max-width: 400px) {
        .ilb-article-link {
            padding: 14px 16px;
            font-size: 14px;
        }
    }
}

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

/* GPU acceleration */
.ilb-related-container,
.ilb-article-link {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Content visibility (improves LCP) */
.ilb-related-container {
    content-visibility: auto;
    contain-intrinsic-size: 0 140px;
}

/* Aspect ratio to prevent CLS */
.ilb-link-icon {
    aspect-ratio: 1;
}
