/* Instagram Feed Plugin: posts grid, posts slider and post popup */

/* ---------- Grid ---------- */

/* gap="…" and radius="…" set these on the feed element (inline style) */
.igfp-feed {
    --igfp-gap: 4px;
    --igfp-radius: 0px;
    width: 100%;
    margin: 0 0 1.5em;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .igfp-feed {
        --igfp-gap: 2px;
    }
}

.igfp-feed *,
.igfp-feed *::before,
.igfp-feed *::after {
    box-sizing: border-box;
}

/* font_size="…" sets --igfp-font-size for the profile line and the captions */
.igfp-feed .igfp-header {
    font-size: var(--igfp-font-size, 1em);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 .75em;
}

.igfp-feed .igfp-profile {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    word-break: break-all;
}

.igfp-feed .igfp-avatar {
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0 .6em 0 0;
    border-radius: 50%;
    object-fit: cover;
}

.igfp-feed .igfp-follow {
    font-size: .9em;
}

.igfp-feed .igfp-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: var(--igfp-gap);
    gap: var(--igfp-gap);
    align-items: start;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Large screens: columns="1".."6" */
.igfp-feed .igfp-grid.igfp-cols-1 { grid-template-columns: minmax(0, 1fr); }
.igfp-feed .igfp-grid.igfp-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.igfp-feed .igfp-grid.igfp-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.igfp-feed .igfp-grid.igfp-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.igfp-feed .igfp-grid.igfp-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.igfp-feed .igfp-grid.igfp-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* Tablets: at most 4 columns */
@media (max-width: 782px) {
    .igfp-feed .igfp-grid.igfp-cols-5,
    .igfp-feed .igfp-grid.igfp-cols-6 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Phones: mobile_columns="1".."4" */
@media (max-width: 480px) {
    .igfp-feed .igfp-grid.igfp-mcols-1 { grid-template-columns: minmax(0, 1fr); }
    .igfp-feed .igfp-grid.igfp-mcols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .igfp-feed .igfp-grid.igfp-mcols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .igfp-feed .igfp-grid.igfp-mcols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* With captions under the images, rows need more room than the gap alone */
.igfp-feed.igfp-has-caption .igfp-grid {
    row-gap: calc(var(--igfp-gap) + .75em);
}

.igfp-feed .igfp-item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.igfp-feed .igfp-item::before {
    content: none;
}

/* Square tiles; padding-top keeps older browsers without aspect-ratio working.
   The tile (not the list item) is clipped, so rounded corners leave the caption alone. */
.igfp-feed .igfp-item a {
    display: block;
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    border-radius: var(--igfp-radius);
    background: #efefef;
}

/* caption="…": short caption under the image, as plain text */
.igfp-feed .igfp-caption {
    margin: .45em 0 0;
    padding: 0;
    font-size: var(--igfp-font-size, .875em);
    line-height: 1.4;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.igfp-feed .igfp-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    object-fit: cover;
    transition: opacity .2s;
}

.igfp-feed .igfp-item a:hover img,
.igfp-feed .igfp-item a:focus img {
    opacity: .85;
}

.igfp-feed .igfp-item a:focus {
    outline: 2px solid currentColor;
    outline-offset: -2px;
}

/* Video and album marks */
.igfp-feed .igfp-type-video a::after,
.igfp-feed .igfp-type-carousel a::after {
    position: absolute;
    top: 6px;
    right: 8px;
    /* Move inwards with rounded corners so the mark is not clipped */
    top: max(6px, calc(var(--igfp-radius) * .35));
    right: max(8px, calc(var(--igfp-radius) * .35));
    color: #fff;
    font-size: 16px;
    line-height: 1;
    text-shadow: 0 0 3px rgba(0, 0, 0, .6);
    pointer-events: none;
}

.igfp-feed .igfp-type-video a::after {
    content: "\25B6";
}

.igfp-feed .igfp-type-carousel a::after {
    content: "\2750";
}

/* ---------- Slider ---------- */

/* One row that scrolls sideways. Without JavaScript it still scrolls by
   touch, trackpad, Shift + wheel or keyboard; feed.js adds the arrows. */
.igfp-feed .igfp-slider {
    position: relative;
}

.igfp-feed .igfp-track {
    --igfp-visible: 3;
    display: flex;
    align-items: flex-start;
    gap: var(--igfp-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* The arrows replace the scrollbar once feed.js is running */
.igfp-feed .igfp-slider.igfp-ready .igfp-track {
    scrollbar-width: none;
}

.igfp-feed .igfp-slider.igfp-ready .igfp-track::-webkit-scrollbar {
    display: none;
}

.igfp-feed .igfp-track > .igfp-item {
    flex: 0 0 auto;
    width: calc((100% - (var(--igfp-visible) - 1) * var(--igfp-gap)) / var(--igfp-visible));
    scroll-snap-align: start;
}

/* Large screens: columns="1".."6" posts visible at once */
.igfp-feed .igfp-track.igfp-cols-1 { --igfp-visible: 1; }
.igfp-feed .igfp-track.igfp-cols-2 { --igfp-visible: 2; }
.igfp-feed .igfp-track.igfp-cols-3 { --igfp-visible: 3; }
.igfp-feed .igfp-track.igfp-cols-4 { --igfp-visible: 4; }
.igfp-feed .igfp-track.igfp-cols-5 { --igfp-visible: 5; }
.igfp-feed .igfp-track.igfp-cols-6 { --igfp-visible: 6; }

/* Tablets: at most 4 */
@media (max-width: 782px) {
    .igfp-feed .igfp-track.igfp-cols-5,
    .igfp-feed .igfp-track.igfp-cols-6 {
        --igfp-visible: 4;
    }
}

/* Phones: mobile_columns="1".."4" */
@media (max-width: 480px) {
    .igfp-feed .igfp-track.igfp-mcols-1 { --igfp-visible: 1; }
    .igfp-feed .igfp-track.igfp-mcols-2 { --igfp-visible: 2; }
    .igfp-feed .igfp-track.igfp-mcols-3 { --igfp-visible: 3; }
    .igfp-feed .igfp-track.igfp-mcols-4 { --igfp-visible: 4; }
}

@media (prefers-reduced-motion: reduce) {
    .igfp-feed .igfp-track {
        scroll-behavior: auto;
    }
}

/* Arrows and pause button; explicit values so theme button styles do not leak in */
.igfp-feed .igfp-slider-button {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #262626;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    font: 400 26px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    text-shadow: none;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    opacity: .9;
    transition: opacity .2s;
}

.igfp-feed .igfp-slider-button:hover,
.igfp-feed .igfp-slider-button:focus {
    background: #fff;
    color: #262626;
    opacity: 1;
}

.igfp-feed .igfp-slider-button:focus {
    outline: 2px solid #0095f6;
    outline-offset: 2px;
}

.igfp-feed .igfp-slider-button[hidden] {
    display: none;
}

.igfp-feed .igfp-slider-button span {
    display: block;
    margin-top: -3px;
}

.igfp-feed .igfp-slider-prev,
.igfp-feed .igfp-slider-next {
    top: 50%;
    transform: translateY(-50%);
}

.igfp-feed .igfp-slider-prev { left: 8px; }
.igfp-feed .igfp-slider-next { right: 8px; }

.igfp-feed .igfp-slider-pause {
    right: 8px;
    bottom: 8px;
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.igfp-feed .igfp-slider-pause span {
    margin-top: 0;
}

@media (max-width: 480px) {
    .igfp-feed .igfp-slider-button {
        width: 30px;
        height: 30px;
        font-size: 22px;
    }

    .igfp-feed .igfp-slider-prev { left: 4px; }
    .igfp-feed .igfp-slider-next { right: 4px; }

    .igfp-feed .igfp-slider-pause {
        right: 4px;
        bottom: 4px;
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
}

/* ---------- Popup ---------- */

.igfp-lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 64px;
    box-sizing: border-box;
    font-size: 15px;
    line-height: 1.45;
    color: #262626;
}

.igfp-lightbox[hidden] {
    display: none;
}

.igfp-lightbox *,
.igfp-lightbox *::before,
.igfp-lightbox *::after {
    box-sizing: border-box;
}

.igfp-lightbox [hidden] {
    display: none !important;
}

.igfp-lb-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .85);
}

.igfp-lb-panel {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: 820px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.igfp-lb-media {
    position: relative;
    flex: 1 1 62%;
    min-width: 0;
    background: #000;
}

.igfp-lb-stage {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.igfp-lb-image,
.igfp-lb-video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    margin: 0;
    object-fit: contain;
}

.igfp-lb-video {
    width: 100%;
    height: 100%;
}

.igfp-lb-info {
    display: flex;
    flex-direction: column;
    flex: 0 0 340px;
    padding: 16px;
    overflow-y: auto;
    border-left: 1px solid #efefef;
}

.igfp-lb-account {
    display: flex;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #efefef;
    color: #262626;
    font-weight: 600;
    text-decoration: none;
    word-break: break-all;
}

.igfp-lb-avatar {
    flex: none;
    width: 32px;
    height: 32px;
    margin: 0 10px 0 0;
    border-radius: 50%;
    object-fit: cover;
}

.igfp-lb-caption {
    flex: 1 1 auto;
    margin: 0 0 12px;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-wrap: break-word;
}

.igfp-lb-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid #efefef;
    color: #737373;
    font-size: 13px;
}

.igfp-lb-view {
    color: #0095f6;
    font-weight: 600;
    text-decoration: none;
}

.igfp-lb-view:hover,
.igfp-lb-view:focus {
    text-decoration: underline;
}

/* Buttons (reset theme styles) */
.igfp-lightbox button {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
}

.igfp-lightbox button:focus {
    outline: 2px solid #0095f6;
    outline-offset: 2px;
}

.igfp-lightbox .igfp-lb-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: transparent;
    color: #fff;
    font-size: 36px;
}

.igfp-lightbox .igfp-lb-nav {
    position: absolute;
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    background: rgba(255, 255, 255, .9);
    color: #262626;
    font-size: 30px;
}

.igfp-lightbox .igfp-lb-prev {
    left: 12px;
}

.igfp-lightbox .igfp-lb-next {
    right: 12px;
}

.igfp-lightbox .igfp-lb-slide {
    position: absolute;
    top: 50%;
    width: 32px;
    height: 32px;
    margin-top: -16px;
    background: rgba(255, 255, 255, .85);
    color: #262626;
    font-size: 24px;
}

.igfp-lightbox .igfp-lb-slide-prev {
    left: 10px;
}

.igfp-lightbox .igfp-lb-slide-next {
    right: 10px;
}

.igfp-lightbox .igfp-lb-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 12px;
}

/* Tablets and phones: photo on top, text below, full screen */
@media (max-width: 782px) {
    .igfp-lightbox {
        padding: 0;
    }

    .igfp-lb-panel {
        flex-direction: column;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .igfp-lb-media {
        flex: 0 0 auto;
        height: 62vh;
    }

    .igfp-lb-info {
        flex: 1 1 auto;
        border-left: 0;
        /* Room for the previous/next buttons at the bottom of the screen */
        padding-bottom: 68px;
    }

    .igfp-lightbox .igfp-lb-close {
        top: 6px;
        right: 6px;
        z-index: 2;
        background: rgba(0, 0, 0, .5);
        font-size: 30px;
    }

    .igfp-lightbox .igfp-lb-nav {
        top: auto;
        bottom: 12px;
        margin-top: 0;
        z-index: 2;
        box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    }

    .igfp-lightbox .igfp-lb-counter {
        right: auto;
        left: 10px;
    }
}
