/* =========================================================
   COMMENT WALL

   Background layer of YouTube comment cards, injected into
   any element with the CSS ID "comment-bg".

   See /inc/comment-wall.php and /assets/js/comment-wall.js
   ========================================================= */

#comment-bg {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 720px;
}

#comment-bg > *:not(.cbx-layer):not(.comment-bg-layer) {
    position: relative;
    z-index: 5;
}

#comment-bg > .cbx-layer.cbx-layer {
    --cb-font: 12.5px;
    --cb-avatar: 38px;
    --cb-handle: 10.5px;
    --cb-meta: 9.5px;
    --cb-pad-y: 15px;
    --cb-pad-x: 16px;
    --cb-radius: 13px;
    --cb-lines: 6;
    --cb-opacity: 0.68;
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    background:
        radial-gradient(
            ellipse at 50% 47%,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.94) 24%,
            rgba(248, 252, 255, 0.88) 48%,
            rgba(235, 246, 253, 0.92) 76%,
            rgba(226, 241, 251, 0.96) 100%
        );
}

#comment-bg .cbx-stage {
    position: absolute;
    inset: 0;
}

#comment-bg .cbx-stage::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 44% 50% at 50% 47%,
            rgba(255, 255, 255, 0.86) 0%,
            rgba(255, 255, 255, 0.6) 44%,
            rgba(255, 255, 255, 0.18) 70%,
            rgba(255, 255, 255, 0) 84%
        );
}

#comment-bg .cbx-measure {
    position: absolute;
    top: 0;
    left: -99999px;
    width: 0;
    height: 0;
    visibility: hidden;
    pointer-events: none;
}

#comment-bg .cbx-card {
    --cb-w: 260px;
    --cb-x: 0px;
    --cb-y: 0px;
    --cb-r: 0deg;
    --cb-o: var(--cb-opacity);
    --cb-delay: 0ms;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--cb-avatar) minmax(0, 1fr) 15px;
    grid-template-areas:
        "avatar handle youtube"
        "avatar message message"
        ".      actions actions";
    column-gap: 11px;
    row-gap: 5px;
    width: var(--cb-w);
    padding: var(--cb-pad-y) var(--cb-pad-x) calc(var(--cb-pad-y) - 2px);
    box-sizing: border-box;
    border: 1px solid rgba(227, 239, 248, 0.8);
    border-radius: var(--cb-radius);
    background: rgba(255, 255, 255, 0.86);
    box-shadow:
        0 14px 34px rgba(52, 91, 122, 0.055),
        0 3px 9px rgba(52, 91, 122, 0.025);
    color: #294968;
    font-family: inherit;
    font-size: var(--cb-font);
    line-height: 1.45;
    text-align: left;
    opacity: 0;
    transform: translate3d(var(--cb-x), var(--cb-y), 0) rotate(var(--cb-r));
    transform-origin: center;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#comment-bg .cbx-layer[data-reveal="true"] .cbx-card[data-placed="true"] {
    opacity: var(--cb-o);
    animation:
        cbx-in 700ms cubic-bezier(0.22, 1.04, 0.36, 1)
        var(--cb-delay) both;
}

@keyframes cbx-in {
    from {
        opacity: 0;
        transform:
            translate3d(var(--cb-x), calc(var(--cb-y) + 26px), 0)
            rotate(calc(var(--cb-r) * 2.4))
            scale(0.9);
    }

    to {
        opacity: var(--cb-o);
        transform:
            translate3d(var(--cb-x), var(--cb-y), 0)
            rotate(var(--cb-r))
            scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    #comment-bg .cbx-layer[data-reveal="true"] .cbx-card[data-placed="true"] {
        animation: none;
        opacity: var(--cb-o);
    }
}

#comment-bg .cbx-avatar {
    grid-area: avatar;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cb-avatar);
    height: var(--cb-avatar);
    border-radius: 50%;
    background:
        linear-gradient(
            135deg,
            var(--cb-avatar-a, #a5c2e8) 0%,
            var(--cb-avatar-b, #759dd3) 100%
        );
    color: #fff;
    font-size: calc(var(--cb-avatar) * 0.5);
    font-weight: 500;
    line-height: 1;
}

#comment-bg .cbx-handle {
    grid-area: handle;
    align-self: center;
    min-width: 0;
    overflow: hidden;
    color: #31516f;
    font-size: var(--cb-handle);
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#comment-bg .cbx-message {
    grid-area: message;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--cb-lines);
    margin: 0;
    overflow: hidden;
    color: #294b6c;
    font-size: inherit;
    font-weight: 500;
    line-height: 1.46;
}

#comment-bg .cbx-youtube {
    grid-area: youtube;
    position: relative;
    justify-self: end;
    width: 15px;
    height: 11px;
    margin-top: 2px;
    border-radius: 3px;
    background: #ff625e;
}

#comment-bg .cbx-youtube::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 6px;
    width: 0;
    height: 0;
    border-top: 2.5px solid transparent;
    border-bottom: 2.5px solid transparent;
    border-left: 4px solid #fff;
}

#comment-bg .cbx-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 5px;
    color: #82a1bf;
    font-size: var(--cb-meta);
    line-height: 1;
}

#comment-bg .cbx-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#comment-bg .cbx-action svg {
    display: block;
    width: calc(var(--cb-meta) * 1.45);
    height: calc(var(--cb-meta) * 1.45);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#comment-bg .cbx-action--down svg {
    transform: rotate(180deg);
}

#comment-bg .cbx-reply {
    font-size: var(--cb-meta);
    font-weight: 500;
}
