/* 
  Instagram Gallery Widget Styles
  Created: 2025-07-09
  Updated: 2025-07-09 - Enhanced grid layout for 8 posts/reels with improved responsive design
  Features: Polaroid-style cards with hover animations and responsive grid layout
*/

/* Instagram Gallery Section */
.instagram-section {
    background: linear-gradient(135deg, #f8fdf8 0%, #e8f5e8 100%);
    position: relative;
    overflow: hidden;
}

.instagram-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="golf-pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23d4f4d4" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23golf-pattern)"/></svg>');
    opacity: 0.5;
    pointer-events: none;
}

.instagram-container {
    position: relative;
    z-index: 1;
}

.instagram-header {
    text-align: center;
    margin-bottom: 3rem;
}

.instagram-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d5016;
    margin-bottom: 1rem;
    font-family: 'Georgia', serif;
}

.instagram-subtitle {
    font-size: 1.2rem;
    color: #5a7c42;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.instagram-handle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(188, 24, 136, 0.3);
}

.instagram-handle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(188, 24, 136, 0.4);
    color: white;
    text-decoration: none;
}

.instagram-icon {
    width: 20px;
    height: 20px;
}

/* Instagram Grid */
.instagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Ensure proper layout for 8 items */
@media (min-width: 1200px) {
    .instagram-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 900px) and (max-width: 1199px) {
    .instagram-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 600px) and (max-width: 899px) {
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Polaroid Card Styles */
.instagram-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    transform: rotate(0deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.instagram-card:nth-child(odd) {
    transform: rotate(-1deg);
}

.instagram-card:nth-child(even) {
    transform: rotate(1deg);
}

.instagram-card:nth-child(3n) {
    transform: rotate(-0.5deg);
}

.instagram-card:hover {
    transform: rotate(0deg) translateY(-10px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* Instagram Image */
.instagram-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 1rem;
    background: #f0f0f0;
}

.instagram-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.instagram-card:hover .instagram-image {
    transform: scale(1.05);
}

/* Instagram Badge */
.instagram-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.instagram-badge-icon {
    width: 12px;
    height: 12px;
}

/* Special styling for reels */
.instagram-card[aria-label*="Reel"] .instagram-badge {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    animation: pulse 2s infinite;
}

.instagram-card[aria-label*="Reel"] .instagram-badge::after {
    content: "▶";
    margin-left: 2px;
    font-size: 8px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.instagram-badge-icon {
    width: 12px;
    height: 12px;
}

/* Caption Area */
.instagram-caption {
    font-family: 'Caveat', cursive, 'Comic Sans MS', cursive;
    font-size: 1rem;
    color: #333;
    line-height: 1.4;
    min-height: 3rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.instagram-date {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    text-align: right;
    font-family: 'Georgia', serif;
}

/* Loading States */
.instagram-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    font-size: 1.1rem;
    color: #5a7c42;
}

.instagram-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8f5e8;
    border-top: 3px solid #5a7c42;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.instagram-error {
    text-align: center;
    padding: 2rem;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
    margin: 2rem auto;
    max-width: 500px;
}

.instagram-error h3 {
    margin-bottom: 1rem;
    color: #856404;
}

.instagram-error p {
    margin-bottom: 1rem;
}

.instagram-error a {
    color: #5a7c42;
    text-decoration: none;
    font-weight: 600;
}

.instagram-error a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .instagram-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .instagram-title {
        font-size: 2rem;
    }
    
    .instagram-subtitle {
        font-size: 1rem;
    }
    
    .instagram-card {
        transform: rotate(0deg) !important;
    }
    
    .instagram-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
}

@media (max-width: 480px) {
    .instagram-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .instagram-title {
        font-size: 1.75rem;
    }
    
    .instagram-handle {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .instagram-card,
    .instagram-image,
    .instagram-badge,
    .instagram-handle {
        transition: none;
    }
    
    .instagram-card:hover {
        transform: none;
    }
    
    .instagram-spinner {
        animation: none;
    }
}

/* Focus states for keyboard navigation */
.instagram-card:focus {
    outline: 3px solid #5a7c42;
    outline-offset: 2px;
}

.instagram-handle:focus {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
}
