/* ==========================================================
   Nill Social Feed – Frontend
   ========================================================== */

.nill-social-feed-wrapper {
    width: 100%;
    max-width: none;
}


/* Feed grid */

.nill-social-feed {
    display: grid;
    gap: max(16px, 1.25vw);
    width: 100%;
    background: var(--nsf-feed-bg-color);
}


/* Columns */

.nill-social-feed.col-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nill-social-feed.col-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nill-social-feed.col-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nill-social-feed.col-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nill-social-feed.col-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.nill-social-feed.col-7 {
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.nill-social-feed.col-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.nill-social-feed.col-9 {
    grid-template-columns: repeat(9, minmax(0, 1fr));
}


/* ==========================================================
   Post
   ========================================================== */

.nill-social-feed .social-feed-item {
    position: relative;
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 8px;
    background: var(--nsf-post-bg-color);
}


/* ==========================================================
   Media
   ========================================================== */

.nill-social-feed .media-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: rgba(0, 0, 0, .035);
}

.nill-social-feed .media-container > img,
.nill-social-feed .album-slide img,
.nill-social-feed .album-slide video,
.nill-social-feed .nsf-video,
.nill-social-feed .nsf-video video {
    display: block;
    width: 100%;
    height: 100%;
}

.nill-social-feed .media-container img,
.nill-social-feed .media-container video {
    object-fit: cover;
}

/* ==========================================================
   Video
   ========================================================== */

.nill-social-feed .nsf-video {
    position: relative;
}

.nill-social-feed .nsf-video video {
    background: #000;
}

.nill-social-feed .nsf-video-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    pointer-events: none;
    backdrop-filter: blur(5px);
}

.nill-social-feed .nsf-video-badge__icon {
    margin-left: 2px;
    font-size: 11px;
    line-height: 1;
}


/* ==========================================================
   Albums / carousels
   ========================================================== */

.nill-social-feed .media-album,
.nill-social-feed .album-track,
.nill-social-feed .album-slide {
    position: relative;
    width: 100%;
    height: 100%;
}

.nill-social-feed .album-slide {
    display: none;
}

.nill-social-feed .album-slide.active {
    display: block;
}

.nill-social-feed .album-prev,
.nill-social-feed .album-next {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .9);
    color: #1d2327;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    line-height: 1;
    opacity: 0;
    transform: translateY(-50%);
    transition:
        opacity .2s ease,
        background-color .2s ease,
        transform .2s ease;
}

.nill-social-feed .album-prev {
    left: 10px;
}

.nill-social-feed .album-next {
    right: 10px;
}

.nill-social-feed .media-album:hover .album-prev,
.nill-social-feed .media-album:hover .album-next,
.nill-social-feed .album-prev:focus-visible,
.nill-social-feed .album-next:focus-visible {
    opacity: 1;
}

.nill-social-feed .album-prev:hover,
.nill-social-feed .album-next:hover {
    background: #fff;
}

.nill-social-feed .album-prev:focus-visible,
.nill-social-feed .album-next:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}


/* Album counter */

.nill-social-feed .nsf-album-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    pointer-events: none;
    backdrop-filter: blur(5px);
}


/* ==========================================================
   Content
   ========================================================== */

.nill-social-feed .post-content {
    padding: 16px 16px 8px;
    color: var(--nsf-text-color);
    font-size: .95em;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.nill-social-feed .post-content:empty {
    display: none;
}


/* ==========================================================
   Footer
   ========================================================== */

.nill-social-feed .post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding: 10px 16px 16px;
}

.nill-social-feed .post-date {
    display: block;
    color: var(--nsf-link-color);
    font-size: .82em;
    line-height: 1.3;
    text-decoration: none;
    transition: color .2s ease;
}

.nill-social-feed a.post-date:hover {
    color: var(--nsf-hover-color);
}


/* Platform icon */

.nill-social-feed .post-platform {
    display: block;
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    background: var(--nsf-link-color);
    transition: background-color .2s ease;

    mask-position: center;
    -webkit-mask-position: center;

    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;

    mask-size: contain;
    -webkit-mask-size: contain;
}

.nill-social-feed .post-platform:hover {
    background: var(--nsf-hover-color);
}

.nill-social-feed .post-platform.facebook {
    mask-image: url("../../includes/images/brand-facebook.svg");
    -webkit-mask-image: url("../../includes/images/brand-facebook.svg");
}

.nill-social-feed .post-platform.instagram {
    mask-image: url("../../includes/images/brand-instagram.svg");
    -webkit-mask-image: url("../../includes/images/brand-instagram.svg");
}

/* ==========================================================
   Polaroid layout
   ========================================================== */

.nill-social-feed.layout-polaroid .post-content {
    display: none;
}

.nill-social-feed.layout-polaroid .media-container {
    aspect-ratio: 3 / 4;
}

.nill-social-feed.layout-polaroid .post-footer {
    padding-top: 16px;
}


/* ==========================================================
   Credits
   ========================================================== */

.nill-social-feed-wrapper .credits {
    display: block;
    width: fit-content;
    margin: 12px 0 0 auto;
    color: var(--nsf-text-color);
    font-size: 11px;
    opacity: .6;
}


/* ==========================================================
   Load more
   ========================================================== */

.nill-social-feed-wrapper .nsf-load-more {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    min-height: 42px;
    margin: 28px auto 0;
    padding: 9px 18px;
    border: 1px solid var(--nsf-link-color);
    border-radius: 5px;
    background: transparent;
    color: var(--nsf-link-color);
    cursor: pointer;
    font: inherit;
    font-size: .9em;
    font-weight: 500;
    line-height: 1.3;
    transition:
        background-color .2s ease,
        color .2s ease,
        border-color .2s ease,
        opacity .2s ease;
}

.nill-social-feed-wrapper .nsf-load-more:hover {
    border-color: var(--nsf-hover-color);
    background: var(--nsf-hover-color);
    color: #fff;
}

.nill-social-feed-wrapper .nsf-load-more:focus-visible {
    outline: 2px solid var(--nsf-hover-color);
    outline-offset: 3px;
}

.nill-social-feed-wrapper .nsf-load-more:disabled {
    cursor: wait;
    opacity: .6;
}


/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 1200px) {
    .nill-social-feed.col-5,
    .nill-social-feed.col-6,
    .nill-social-feed.col-7,
    .nill-social-feed.col-8,
    .nill-social-feed.col-9 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}


@media (max-width: 900px) {
    .nill-social-feed.col-4,
    .nill-social-feed.col-5,
    .nill-social-feed.col-6,
    .nill-social-feed.col-7,
    .nill-social-feed.col-8,
    .nill-social-feed.col-9 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}


@media (max-width: 700px) {
    .nill-social-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /*
     * Carousel arrows must remain visible on touch devices,
     * where there is no hover state.
     */
    .nill-social-feed .album-prev,
    .nill-social-feed .album-next {
        width: 30px;
        height: 30px;
        opacity: 1;
    }
}


@media (max-width: 480px) {
    .nill-social-feed {
        grid-template-columns: 1fr !important;
    }

    .nill-social-feed .post-content {
        padding: 14px 14px 7px;
    }

    .nill-social-feed .post-footer {
        padding: 9px 14px 14px;
    }
}


/* ==========================================================
   Reduced motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .nill-social-feed .social-feed-item,
    .nill-social-feed .album-prev,
    .nill-social-feed .album-next,
    .nill-social-feed .post-date,
    .nill-social-feed .post-platform,
    .nill-social-feed-wrapper #nsf-load-more {
        transition: none;
    }
}