/* KWC Custom Gallery Styles */

.kwc-year-review-gallery-container {
    font-family: 'Be Vietnam Pro', sans-serif;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.kwc-year-review-gallery-container * {
    box-sizing: border-box;
}

.kwc-gallery-header {
            text-align: center;
            margin-bottom: 25px;
            padding: 15px;
        }

        .kwc-gallery-title {
            font-family: 'Be Vietnam Pro', sans-serif !important;
            font-size: var(--wp--preset--font-size--xx-large) !important;
            color: #392082 !important;
            margin: 0 0 8px 0 !important;
            font-weight: 700 !important;
            line-height: 1.2 !important;
        }

        .kwc-gallery-subtitle {
            font-size: 1rem !important;
            color: #666 !important;
            margin: 0 !important;
            line-height: 1.6 !important;
        }

        .kwc-gallery-main {
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(57, 32, 130, 0.1);
            overflow: hidden;
        }

        .kwc-gallery-image-container {
            position: relative;
            width: 100%;
            height: 0;
            padding-bottom: 52%; /* Taller to show full images */
            background: #f0f0f0;
            overflow: hidden;
        }

        .kwc-gallery-image {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
            height: 100%;
            object-fit: contain;
            object-position: center;
            opacity: 0;
            transition: opacity 0.5s ease-in-out;
            cursor: pointer;
            pointer-events: none;
        }

        .kwc-gallery-image.active {
            opacity: 1;
            pointer-events: auto;
        }

        .kwc-gallery-image::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.15) 100%);
            pointer-events: none;
        }

        .kwc-gallery-image-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.15) 100%);
            pointer-events: none;
            z-index: 1;
        }

        .kwc-gallery-caption {
            padding: 15px 20px 20px 20px;
            background: white;
        }

        .kwc-caption-title {
            font-family: 'Be Vietnam Pro', sans-serif !important;
            font-size: var(--wp--preset--font-size--xx-large) !important;
            color: #392082 !important;
            margin-top: 0 !important;
            margin-bottom: 12px !important;
            font-weight: 600 !important;
            line-height: 1.3 !important;
        }

        .kwc-gallery-caption p {
            font-size: 1rem;
            color: #555;
            margin-bottom: 15px;
            line-height: 1.6;
        }

        .kwc-read-more-link {
            display: inline-block;
            padding: 12px 28px;
            background: #392082;
            color: white !important;
            text-decoration: none !important;
            border-radius: 6px;
            font-weight: 600;
            transition: all 0.3s ease;
            font-size: 1rem;
        }

        .kwc-read-more-link:hover,
        .kwc-read-more-link:focus {
            background: #5c3bad;
            color: white !important;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(57, 32, 130, 0.3);
        }

        .kwc-gallery-controls {
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            transform: translateY(-50%);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            pointer-events: none;
            z-index: 2;
        }

        .kwc-control-button {
            background: rgba(57, 32, 130, 0.9);
            color: white;
            border: none;
            border-radius: 50%;
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1.5rem;
            pointer-events: auto;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .kwc-control-button:hover:not(:disabled),
        .kwc-control-button:focus:not(:disabled) {
            background: #5c3bad;
            transform: scale(1.15);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
        }

        .kwc-control-button:disabled {
            background: rgba(204, 204, 204, 0.6);
            cursor: not-allowed;
            opacity: 0.5;
        }

        .kwc-gallery-counter {
            font-family: 'Be Vietnam Pro', sans-serif;
            font-size: 1rem;
            font-weight: 600;
            color: #392082;
            text-align: center;
            padding: 10px;
            margin: 12px auto;
            max-width: 150px;
        }

        .kwc-thumbnail-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 15px;
            padding: 20px;
            background: transparent;
            border-radius: 12px;
        }

        .kwc-thumbnail {
            position: relative;
            width: 100%;
            padding-bottom: 100%;
            border-radius: 8px;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 3px solid transparent;
        }

        .kwc-thumbnail:hover,
        .kwc-thumbnail:focus {
            transform: translateY(-4px);
            box-shadow: 0 6px 16px rgba(57, 32, 130, 0.2);
        }

        .kwc-thumbnail.active {
            border-color: #66ecdf;
            box-shadow: 0 0 0 2px #392082;
        }

        .kwc-thumbnail img {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .kwc-thumbnail-label {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(57, 32, 130, 0.9);
            color: white;
            padding: 8px;
            font-size: 0.85rem;
            text-align: center;
            font-weight: 600;
        }

        /* Loading state */
        .loading {
            display: flex;
            align-items: center;
            justify-content: center;
            min-height: 400px;
        }

        .loading::after {
            content: "";
            width: 50px;
            height: 50px;
            border: 5px solid #f3f3f3;
            border-top: 5px solid #392082;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

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

        /* Responsive design */
        @media (max-width: 768px) {
            .kwc-gallery-title {
                font-size: var(--wp--preset--font-size--x-large) !important;
            }

            .kwc-caption-title {
                font-size: var(--wp--preset--font-size--large) !important;
            }

            .kwc-gallery-caption p {
                font-size: 0.95rem;
            }

            .kwc-gallery-caption {
                padding: 15px 20px 20px 20px;
            }

            .kwc-thumbnail-grid {
                grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
                gap: 10px;
            }

            .kwc-control-button {
                width: 50px;
                height: 50px;
                font-size: 1.3rem;
            }

            .kwc-gallery-controls {
                padding: 0 10px;
            }

            .kwc-gallery-image-container {
                padding-bottom: 56%; /* Slightly taller on mobile */
            }
        }

        @media (max-width: 480px) {
            .kwc-gallery-header h1 {
                font-size: 1.6rem;
            }

            .kwc-gallery-controls {
                gap: 15px;
            }

            .kwc-thumbnail-grid {
                grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            }
        }

        /* Accessibility improvements */
        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border-width: 0;
        }

        /* Keyboard focus indicators */
        *:focus-visible {
            outline: 3px solid #66ecdf;
            outline-offset: 2px;
        }

        /* Lightbox/Modal styles */
        .kwc-lightbox {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.95);
            z-index: 9999;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .kwc-lightbox * {
            margin-block-start: 0 !important;
            margin-block-end: 0 !important;
        }

        .kwc-lightbox.active {
            display: flex;
        }

        .kwc-lightbox-content {
            max-width: 90%;
            max-height: 90%;
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .kwc-lightbox-image-wrapper {
            position: relative;
            max-width: 100%;
            max-height: 85vh;
            border-radius: 8px;
            overflow: hidden;
        }

        .kwc-lightbox-image {
            display: block;
            max-width: 100%;
            max-height: 85vh;
            object-fit: contain;
        }

        .kwc-lightbox-close {
            position: fixed;
            top: 20px;
            right: 20px;
            background: rgba(57, 32, 130, 0.9);
            color: white;
            border: none;
            border-radius: 50%;
            width: 50px;
            height: 50px;
            font-size: 1.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
            z-index: 10001;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .kwc-lightbox-close:hover,
        .kwc-lightbox-close:focus {
            background: #5c3bad;
            transform: scale(1.1);
        }

        .kwc-lightbox-nav {
            position: fixed;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(57, 32, 130, 0.9);
            color: white;
            border: none;
            border-radius: 50%;
            width: 60px;
            height: 60px;
            font-size: 2rem;
            cursor: pointer;
            transition: all 0.3s ease;
            z-index: 10001;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .kwc-lightbox-nav:hover:not(:disabled),
        .kwc-lightbox-nav:focus:not(:disabled) {
            background: #5c3bad;
            transform: translateY(-50%) scale(1.1);
        }

        .kwc-lightbox-nav:disabled {
            background: rgba(204, 204, 204, 0.6);
            cursor: not-allowed;
            opacity: 0.5;
        }

        .kwc-lightbox-prev {
            left: 20px;
        }

        .kwc-lightbox-next {
            right: 20px;
        }

        .kwc-lightbox-caption {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.85) 50%, rgba(0, 0, 0, 0) 100%);
            padding: 60px 30px 25px 30px;
            border-radius: 0 0 8px 8px;
        }

        .kwc-lightbox-caption * {
            margin-block-start: 0 !important;
            margin-block-end: 0 !important;
        }

        .kwc-lightbox-caption .kwc-caption-title {
            color: white !important;
            font-size: var(--wp--preset--font-size--xx-large) !important;
            margin-bottom: 10px !important;
            margin-top: 0 !important;
            margin-block-start: 0 !important;
            font-weight: 600 !important;
            line-height: 1.3 !important;
        }

        .kwc-lightbox-caption p {
            color: rgba(255, 255, 255, 0.9);
            font-size: 1rem;
            line-height: 1.6;
            margin-bottom: 15px !important;
            margin-top: 0 !important;
            margin-block-start: 0 !important;
        }

        .kwc-lightbox-link {
            display: inline-block;
            padding: 10px 24px;
            background: #392082;
            color: white !important;
            text-decoration: none !important;
            border-radius: 6px;
            font-weight: 600;
            transition: all 0.3s ease;
            font-size: 0.95rem;
        }

        .kwc-lightbox-link:hover,
        .kwc-lightbox-link:focus {
            background: #5c3bad;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(92, 59, 173, 0.5);
        }

        @media (max-width: 768px) {
            .kwc-lightbox-image-wrapper {
                max-height: none;
                display: flex;
                flex-direction: column;
            }

            .kwc-lightbox-image {
                max-height: 60vh;
                border-radius: 8px 8px 0 0;
            }

            .kwc-lightbox-caption {
                position: relative;
                padding: 20px;
                background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
                border-radius: 0 0 8px 8px;
            }

            .kwc-lightbox-caption * {
                margin-block-start: 0 !important;
                margin-block-end: 0 !important;
            }

            .kwc-lightbox-caption .kwc-caption-title {
                font-size: var(--wp--preset--font-size--xx-large) !important;
                margin-top: 0 !important;
                margin-bottom: 10px !important;
            }

            .kwc-lightbox-caption p {
                font-size: 0.95rem;
                margin-top: 0 !important;
                margin-bottom: 15px !important;
            }

            .kwc-lightbox-content {
                max-width: 95%;
            }

            .kwc-lightbox-nav {
                width: 50px;
                height: 50px;
                font-size: 1.8rem;
            }

            .kwc-lightbox-prev {
                left: 10px;
            }

            .kwc-lightbox-next {
                right: 10px;
            }

            .kwc-lightbox-close {
                top: 10px;
                right: 10px;
            }
        }
