.youtube-channel-gallery {
    --ycg-columns: 3;
    --ycg-description-lines: 3;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}

.youtube-channel-gallery *,
.youtube-channel-gallery *::before,
.youtube-channel-gallery *::after {
    box-sizing: inherit;
}

.ycg-grid {
    display: grid;
    grid-template-columns: repeat(var(--ycg-columns), minmax(0, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.ycg-sections {
    width: 100%;
}

.ycg-section {
    padding: 0 0 1.75rem;
    margin: 0 0 1.75rem;
    border-bottom: 1px solid #d7d7d7;
}

.ycg-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ycg-section-title {
    margin: 0;
    color: #0f0f0f;
    font-size: clamp(1.25rem, 2vw, 1.55rem);
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ycg-play-all {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    color: #161616;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    background: transparent;
    border: 0;
    border-radius: 0.3rem;
}

.ycg-play-all:hover {
    background: #eee;
}

.ycg-row-shell {
    position: relative;
    min-width: 0;
}

.ycg-row {
    display: grid;
    grid-auto-flow: column;
    gap: 1rem;
    width: 100%;
    padding: 0.15rem 0.1rem 0.65rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scroll-snap-type: inline mandatory;
    scrollbar-width: thin;
}

.ycg-columns-2 .ycg-row {
    grid-auto-columns: calc((100% - 1rem) / 2);
}

.ycg-columns-3 .ycg-row {
    grid-auto-columns: calc((100% - 2rem) / 3);
}

.ycg-columns-4 .ycg-row {
    grid-auto-columns: calc((100% - 3rem) / 4);
}

.ycg-card--row {
    overflow: visible;
    scroll-snap-align: start;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.ycg-card--row:hover {
    transform: none;
    box-shadow: none;
}

.ycg-card--row .ycg-media,
.ycg-card--row .ycg-iframe {
    overflow: hidden;
    border-radius: 0.65rem;
}

.ycg-card--row .ycg-content {
    padding: 0.7rem 0.15rem 0;
}

.ycg-card--row .ycg-title-link {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ycg-scroll-button {
    position: absolute;
    z-index: 3;
    top: clamp(3.2rem, 7vw, 6rem);
    display: grid;
    width: 2.7rem;
    height: 2.7rem;
    place-items: center;
    padding: 0;
    cursor: pointer;
    color: #111;
    font-size: 2rem;
    line-height: 1;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    box-shadow: 0 0.15rem 0.55rem rgba(0, 0, 0, 0.22);
}

.ycg-scroll-button:hover {
    background: #f2f2f2;
}

.ycg-scroll-button--previous {
    left: 0;
    transform: translate(-35%, -50%);
}

.ycg-scroll-button--next {
    right: 0;
    transform: translate(35%, -50%);
}

.ycg-card {
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #d8dee4;
    border-radius: 0.75rem;
    box-shadow: 0 0.2rem 0.7rem rgba(0, 0, 0, 0.09);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.ycg-card:hover {
    transform: translateY(-0.15rem);
    box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.14);
}

.ycg-media,
.ycg-iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

.ycg-media {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 0;
    cursor: pointer;
    background: #111;
}

.ycg-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 180ms ease, transform 180ms ease;
}

.ycg-media:hover .ycg-thumbnail,
.ycg-media:focus-visible .ycg-thumbnail {
    opacity: 0.86;
    transform: scale(1.02);
}

.ycg-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 4rem;
    height: 2.8rem;
    place-items: center;
    transform: translate(-50%, -50%);
    pointer-events: none;
    border-radius: 0.75rem;
    background: #e00000;
    box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.35);
}

.ycg-play-triangle {
    width: 0;
    height: 0;
    margin-left: 0.2rem;
    border-top: 0.55rem solid transparent;
    border-bottom: 0.55rem solid transparent;
    border-left: 0.9rem solid #fff;
}

.ycg-media:focus-visible,
.ycg-title-link:focus-visible,
.ycg-play-all:focus-visible,
.ycg-scroll-button:focus-visible,
.ycg-channel-link:focus-visible {
    outline: 0.2rem solid #005fcc;
    outline-offset: 0.18rem;
}

.ycg-content {
    padding: 1rem;
}

.ycg-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.4;
}

.ycg-title-link {
    display: inline;
    margin: 0;
    padding: 0;
    color: #18212b;
    font: inherit;
    font-weight: 700;
    text-align: left;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.ycg-title-link:hover {
    color: #b00000;
    text-decoration: underline;
}

.ycg-date {
    display: block;
    margin-top: 0.55rem;
    color: #4b5563;
    font-size: 0.875rem;
}

.ycg-description {
    display: -webkit-box;
    margin: 0.7rem 0 0;
    overflow: hidden;
    color: #303943;
    line-height: 1.55;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--ycg-description-lines);
}

.ycg-message {
    margin: 0;
    padding: 0.9rem 1rem;
    color: #233143;
    background: #eef3f8;
    border-left: 0.3rem solid #4b6b88;
    border-radius: 0.3rem;
}

.ycg-message--error {
    color: #651515;
    background: #fff0f0;
    border-left-color: #b42318;
}

.ycg-message--warning {
    margin-bottom: 1rem;
    color: #614000;
    background: #fff8e6;
    border-left-color: #a96800;
}

.ycg-technical-error {
    display: block;
    margin-top: 0.35rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

.ycg-channel-link-wrap {
    margin-top: 1.5rem;
    text-align: center;
}

.ycg-channel-link {
    display: inline-block;
    max-width: 100%;
    padding: 0.75rem 1.1rem;
    color: #fff !important;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-decoration: none;
    background: #f0c054;
    border-radius: 0.4rem;
}

.ycg-channel-link:hover {
    color: #fff;
    background: rgba(212, 138, 72, 0.8);
}

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

    .youtube-channel-gallery .ycg-row {
        grid-auto-columns: calc((100% - 1rem) / 2);
    }
}

@media (max-width: 599.98px) {
    .ycg-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .youtube-channel-gallery .ycg-row {
        grid-auto-columns: 86%;
    }

    .ycg-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .ycg-scroll-button {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ycg-card,
    .ycg-thumbnail {
        transition: none;
    }
}
