.youtube-shorts {
    width: 100%;
    min-width: 0;
}

.youtube-shorts__heading {
    margin: 0 0 1.5rem;
}

.youtube-shorts__grid {
    display: grid;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

/* Full width if only 1 ELement */
.youtube-shorts__grid:has(> :only-child) {
    grid-template-columns: minmax(0, 1fr);
}

/* More than 1 element  */
.youtube-shorts__grid:has(> :nth-child(2)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.youtube-shorts__card {
    position: relative;
    min-width: 0;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    isolation: isolate;
    background: #161f3d;
}

/* Keep the existing TYPO3 video/consent structure, but give Shorts their
   portrait ratio. The !important is needed because main.css contains a
   square fallback for very small regular video elements. */
.youtube-shorts__video,
.youtube-shorts__video .video-embed {
    position: absolute !important;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    aspect-ratio: 9 / 16 !important;
    margin: 0 !important;
}

.youtube-shorts__video {
    z-index: 2;
}

.youtube-shorts__video .video-embed {
    overflow: hidden !important;
    border-radius: 0;
}

.youtube-shorts__video .cookie-consent-replacement .container {
    background-color: transparent !important;
}

.youtube-shorts__video .cookie-consent-replacement .row {
    background-color: rgba(22, 31, 61, 0.68) !important;
}

.youtube-shorts__play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    width: clamp(3.25rem, 18%, 5.5rem);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* The consent replacement owns the center of the card. Keep the Shorts play
   marker below its accept button while that replacement is visible. */
.youtube-shorts__video:has(.cookie-consent-replacement) ~ .youtube-shorts__play {
    top: 76%;
}

.youtube-shorts__play svg {
    display: block;
    width: 100%;
    height: 100%;
}

.youtube-shorts__play svg > path:first-child {
    fill: #ff0033;
}

.youtube-shorts__play-triangle {
    fill: #fff;
}

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

.youtube-shorts  figure.video .video-embed .cookie-consent-replacement button {
	z-index: 2;
	position: relative;
	display: inline-block;
	width: 100%;
	margin-top: 120px;
	background-color: var(--primary-color);
	border: 2px solid var(--primary-color);
	border-radius: 25px !important;
	font-family: 'Poppins', 'Roboto', Arial, Helvetica, sans-serif;
	font-weight: 550;
	transition: all 0.3s ease-in-out 0s;
}

@media (max-width: 767px) {
    .youtube-shorts__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .youtube-shorts__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }
}
