PageSpeed Optimization to reduce TBT by ~2000ms: - Add YoutubeFacade module following Clean Architecture - Replace YouTube iframes with thumbnail + play button - Load real iframe only on user click (lazy-load) - Reduces initial page blocking time significantly Files added: - Public/YoutubeFacade/Infrastructure/Wordpress/YoutubeFacadeHooksRegistrar.php - Public/YoutubeFacade/Infrastructure/Services/YoutubeFacadeContentFilter.php - Public/YoutubeFacade/Infrastructure/Ui/YoutubeFacadeRenderer.php - Public/YoutubeFacade/Infrastructure/Ui/Assets/Css/youtube-facade.css - Public/YoutubeFacade/Infrastructure/Ui/Assets/Js/youtube-facade.js 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
113 lines
2.2 KiB
CSS
113 lines
2.2 KiB
CSS
/**
|
|
* YouTube Facade Styles
|
|
*
|
|
* PageSpeed Optimization Phase 2.4:
|
|
* Styles for the YouTube facade pattern (thumbnail + play button)
|
|
*
|
|
* @package ROITheme
|
|
* @since 1.0.6
|
|
*/
|
|
|
|
/* ========================================
|
|
FACADE CONTAINER
|
|
Inherits video-wrapper base styles
|
|
======================================== */
|
|
|
|
.youtube-facade {
|
|
position: relative;
|
|
cursor: pointer;
|
|
aspect-ratio: 16 / 9;
|
|
background-color: #000;
|
|
}
|
|
|
|
/* ========================================
|
|
THUMBNAIL
|
|
======================================== */
|
|
|
|
.youtube-facade__thumbnail {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
/* ========================================
|
|
PLAY BUTTON
|
|
======================================== */
|
|
|
|
.youtube-facade__play {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
transform: translate(-50%, -50%);
|
|
border: none;
|
|
background: transparent;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
z-index: 1;
|
|
transition: transform 0.2s ease, filter 0.2s ease;
|
|
}
|
|
|
|
.youtube-facade__play:hover {
|
|
transform: translate(-50%, -50%) scale(1.1);
|
|
}
|
|
|
|
.youtube-facade__play:hover .youtube-facade__play-bg {
|
|
fill: #f00;
|
|
fill-opacity: 1;
|
|
}
|
|
|
|
.youtube-facade__play:focus {
|
|
outline: none;
|
|
}
|
|
|
|
.youtube-facade__play:focus-visible {
|
|
outline: 2px solid #fff;
|
|
outline-offset: 4px;
|
|
}
|
|
|
|
/* ========================================
|
|
IFRAME (after activation)
|
|
======================================== */
|
|
|
|
.youtube-facade iframe {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
border: none;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
/* ========================================
|
|
LOADING STATE
|
|
======================================== */
|
|
|
|
.youtube-facade--loading .youtube-facade__play {
|
|
display: none;
|
|
}
|
|
|
|
.youtube-facade--loading::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
width: 48px;
|
|
height: 48px;
|
|
margin: -24px 0 0 -24px;
|
|
border: 4px solid rgba(255, 255, 255, 0.3);
|
|
border-top-color: #fff;
|
|
border-radius: 50%;
|
|
animation: youtube-facade-spin 0.8s linear infinite;
|
|
}
|
|
|
|
@keyframes youtube-facade-spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|