/* 
 * Privacy-Friendly Video Embed CSS
 * A lite, GDPR-compliant version of video embed with faster load times
 * Features: Cookie consent support, aspect ratio preservation, accessibility
 */

lite-video {
    background-color: #000;
    position: relative;
    display: block;
    contain: content;
    background-position: center center;
    background-size: cover;
    cursor: pointer;
    max-width: 720px;
    margin: 1rem auto;
    border-radius: var(--border-radius, 8px);
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

lite-video:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

/* gradient */
lite-video::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);
    background-position: top;
    background-repeat: repeat-x;
    height: 60px;
    padding-bottom: 50px;
    width: 100%;
    transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
}

/* responsive iframe with a 16:9 aspect ratio
    thanks https://css-tricks.com/responsive-iframes/
*/
lite-video::after {
    content: "";
    display: block;
    padding-bottom: calc(100% / (16 / 9));
}

lite-video > iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border: 0;
}

/* play button */
lite-video > .lty-playbtn {
    width: 80px;
    height: 80px;
    position: absolute;
    cursor: pointer;
    transform: translate3d(-50%, -50%, 0);
    top: 50%;
    left: 50%;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
    border: none;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

lite-video > .lty-playbtn::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

lite-video:hover > .lty-playbtn,
lite-video .lty-playbtn:focus {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translate3d(-50%, -50%, 0) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

lite-video .lty-playbtn:focus {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

/* Post-click styles */
lite-video.lyt-activated {
    cursor: unset;
}

lite-video.lyt-activated::before,
lite-video.lyt-activated > .lty-playbtn {
    opacity: 0;
    pointer-events: none;
}

.lty-visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Cookie Consent Message Styling */
.lty-consent-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    z-index: 10;
}

.lty-consent-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.lty-consent-content i {
    font-size: 3rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.lty-consent-content h4 {
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.lty-consent-content p {
    color: #6b7280;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.lty-consent-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.lty-consent-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.lty-consent-btn:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Custom styling for our blog */
lite-video {
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    transition: var(--transition, all 0.3s ease);
}

lite-video:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Aspect ratio preservation */
lite-video.lty-ratio-16-9::after {
    padding-bottom: 56.25%; /* 16:9 */
}

lite-video.lty-ratio-4-3::after {
    padding-bottom: 75%; /* 4:3 */
}

lite-video.lty-ratio-1-1::after {
    padding-bottom: 100%; /* 1:1 */
}

/* Video container styling */
.video-container {
    margin: 2rem 0;
    text-align: center;
}

.video-container h4 {
    margin-bottom: 1rem;
    color: var(--dark-color);
    font-size: 1.25rem;
}

.video-description {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    font-style: italic;
    color: var(--text-light);
    border-left: 4px solid var(--primary-color);
}

/* Responsive design */
@media (max-width: 768px) {
    lite-video {
        max-width: 100%;
        margin: 1rem 0;
        border-radius: 4px;
    }
    
    .video-container h4 {
        font-size: 1.1rem;
    }
    
    lite-video > .lty-playbtn {
        width: 60px;
        height: 60px;
    }
    
    .lty-consent-content {
        padding: 1.5rem;
    }
    
    .lty-consent-content i {
        font-size: 2.5rem;
    }
    
    .lty-consent-content h4 {
        font-size: 1.1rem;
    }
    
    .lty-consent-content p {
        font-size: 0.9rem;
    }
}

/* Accessibility improvements */
lite-video:focus-within {
    outline: 2px solid #2563eb;
    outline-offset: 4px;
}

/* Loading state */
lite-video[loading] {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Privacy indicator badge */
lite-video::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);
    background-position: top;
    background-repeat: repeat-x;
    height: 60px;
    padding-bottom: 50px;
    width: 100%;
    transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
    pointer-events: none;
}

lite-video[data-privacy="enhanced"]::after {
    content: '🔒 Privacy Enhanced';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    z-index: 2;
}
/* TikTok Video Embed Styles */
.tiktok-video-wrapper {
    position: relative;
    width: 100%;
    max-width: 325px;
    margin: 1rem auto;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.tiktok-video-wrapper:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.tiktok-video-placeholder {
    position: relative;
    width: 100%;
    padding-bottom: 177.78%; /* 9:16 aspect ratio for vertical TikTok videos */
    background-color: #000;
    cursor: pointer;
    overflow: hidden;
}

.tiktok-video-thumb,
.tiktok-video-default-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tiktok-video-default-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fe2c55 0%, #00f2ea 100%);
}

.tiktok-video-default-thumb i {
    font-size: 4rem;
    color: white;
}

.tiktok-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.7);
    border: none;
    cursor: pointer;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tiktok-play-btn::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

.tiktok-play-btn svg {
    display: none;
}

.tiktok-video-wrapper:hover .tiktok-play-btn {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.tiktok-play-btn:focus {
    outline: 2px solid #fe2c55;
    outline-offset: 4px;
}

.tiktok-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Loading state for TikTok videos */
.tiktok-video-wrapper[loading] {
    background: linear-gradient(90deg, #000 25%, #1a1a1a 50%, #000 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@media (max-width: 768px) {
    .tiktok-video-wrapper {
        max-width: 280px;
    }
    
    .tiktok-play-btn {
        width: 60px;
        height: 60px;
    }
    
    .tiktok-play-btn::before {
        border-width: 10px 0 10px 16px;
    }
    
    .tiktok-video-default-thumb i {
        font-size: 3rem;
    }
}

/* ============================================================
   Lite TikTok Embed Component
   ============================================================ */

lite-tiktok {
    background-color: #000;
    position: relative;
    display: block;
    contain: content;
    background-position: center center;
    background-size: cover;
    cursor: pointer;
    max-width: 720px;
}

/* gradient */
lite-tiktok::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==);
    background-position: top;
    background-repeat: repeat-x;
    height: 60px;
    padding-bottom: 50px;
    width: 100%;
    transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
}

/* responsive iframe with a 16:9 aspect ratio
    thanks https://css-tricks.com/responsive-iframes/
*/
lite-tiktok::after {
    content: "";
    display: block;
    padding-bottom: calc(100% / (16 / 9));
}
lite-tiktok > iframe {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border: 0;
}

/* play button */
lite-tiktok > .ltk-playbtn {
    display: flex;
    width: 80px;
    height: 80px;
    position: absolute;
    cursor: pointer;
    transform: translate3d(-50%, -50%, 0);
    top: 50%;
    left: 50%;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0, 0, 0.2, 1);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

lite-tiktok > .ltk-playbtn::before {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 12px 0 12px 20px;
    border-color: transparent transparent transparent #fff;
    margin-left: 4px;
}

lite-tiktok:hover > .ltk-playbtn,
lite-tiktok .ltk-playbtn:focus {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translate3d(-50%, -50%, 0) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Post-click styles */
lite-tiktok.ltk-activated {
    cursor: unset;
}

lite-tiktok.ltk-activated::before,
lite-tiktok.ltk-activated > .ltk-playbtn {
    opacity: 0;
    pointer-events: none;
}

.ltk-visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}
