/*
|--------------------------------------------------------------------------
| Aishiyou Instagram Feed
| Infinite Loop + Side Peek + Instagram Corner Icon
|--------------------------------------------------------------------------
*/

.aishiyou-instagram-section {
    width: 82%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 0 26px;
    background: #fff;
}

.aishiyou-instagram-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    text-align: center;
}

.aishiyou-instagram-subtitle {
    margin: 0;
    font-size: 14px;
    color: #777;
    line-height: 1.5;
}


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

.aishiyou-instagram-slider {
    position: relative;
    width: 100%;

    /*
     * PC
     *
     * 左右42pxずつ次/前画像を見せる。
     * 画像間は6px。
     */
    --ig-peek: 42px;
    --ig-gap: 6px;
}

.aishiyou-instagram-viewport {
    width: 100%;
    overflow: hidden;
    background: #fff;
}

.aishiyou-instagram-track {
    display: flex;
    gap: var(--ig-gap);
    align-items: stretch;
    will-change: transform;
}

.aishiyou-instagram-slide {
    /*
     * PC:
     *
     * 左peek 42
     * gap 6
     * 画像 ×3
     * gap ×2
     * gap 6
     * 右peek 42
     *
     * → 3枚を完全表示しつつ、
     *   左右に次/前画像を少し見せる。
     */
    flex: 0 0 calc(33.333333% - 36px);
    min-width: 0;
}


/*
|--------------------------------------------------------------------------
| Instagram Card
|--------------------------------------------------------------------------
*/

.aishiyou-instagram-item {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 18px;
    padding: 3px;
    box-sizing: border-box;

    /* シックな単色グレー枠 */
    background: #ffffff;

/*    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.10);*/

    /* 影を消す */
    box-shadow: none;

    text-decoration: none;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.aishiyou-instagram-item:hover {
    transform: translateY(-4px);
    /* 影を消す */
    box-shadow: none;

/*    box-shadow:
        0 9px 24px rgba(0, 0, 0, 0.16);*/
}

.aishiyou-instagram-item:focus-visible {
    outline: 3px solid #ee2a7b;
    outline-offset: 3px;
}

.aishiyou-instagram-media {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 15px;
    background: #fff;
}

.aishiyou-instagram-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;

    transition:
        transform 0.35s ease,
        filter 0.35s ease;
}

.aishiyou-instagram-item:hover .aishiyou-instagram-photo {
    transform: scale(1.045);
    filter: brightness(1.03);
}


/* Instagram icon at top-left of each photo */
.aishiyou-instagram-corner-icon {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;

    display: block;
    width: 36px;
    height: 36px;
    object-fit: contain;

    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);

    pointer-events: none;
}


/*
|--------------------------------------------------------------------------
| Caption
|--------------------------------------------------------------------------
*/

.aishiyou-instagram-caption {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 2;

    /* 白背景の外周と文字の間隔を従来の50%に */
    padding: 5px 6px;

    background:
        rgba(255, 255, 255, 0.95);

    color: #111;

    /* 従来13pxの80% */
    font-size: 10.4px;
    line-height: 1.55;

    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.10);
}

.aishiyou-instagram-caption-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;

    overflow: hidden;
}


/*
|--------------------------------------------------------------------------
| Navigation
|--------------------------------------------------------------------------
*/

.aishiyou-instagram-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    margin-top: 15px;
}

.aishiyou-instagram-arrow {
    appearance: none;
    border: 0;
    background: transparent;

    padding: 0 5px;

    color: #686868;

    font-size: 30px;
    line-height: 1;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        color 0.2s ease;
}

.aishiyou-instagram-arrow:hover {
    color: #111;
    transform: scale(1.12);
}

.aishiyou-instagram-arrow:focus-visible {
    outline: 2px solid #ee2a7b;
    outline-offset: 3px;
    border-radius: 4px;
}

.aishiyou-instagram-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.aishiyou-instagram-dot {
    appearance: none;

    display: block;

    width: 8px;
    height: 8px;

    padding: 0;
    margin: 0;

    border: 0;
    border-radius: 999px;

    background: #d2d2d2;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.aishiyou-instagram-dot:hover {
    background: #999;
}

.aishiyou-instagram-dot.is-active {
    background: #666;
    transform: scale(1.22);
}

.aishiyou-instagram-dot:focus-visible {
    outline: 2px solid #ee2a7b;
    outline-offset: 3px;
}


/*
|--------------------------------------------------------------------------
| Tablet: 2枚 + 左右チラ見え
|--------------------------------------------------------------------------
*/

@media (max-width: 900px) {

    .aishiyou-instagram-section {
        width: 90%;
    }

    .aishiyou-instagram-slider {
        --ig-peek: 28px;
        --ig-gap: 5px;
    }

    /*
     * 2枚 + 左右28px、gap 5px。
     *
     * viewportから71pxを引いて2分割
     * = 50% - 35.5px
     */
    .aishiyou-instagram-slide {
        flex-basis: calc(50% - 35.5px);
    }
}


/*
|--------------------------------------------------------------------------
| Smartphone: 1枚 + 左右チラ見え
|--------------------------------------------------------------------------
*/

@media (max-width: 600px) {

    .aishiyou-instagram-section {
        width: 94%;
        max-width: 460px;

        padding:
            8px
            0
            18px;
    }

    .aishiyou-instagram-header {
        margin-bottom: 14px;
    }

    .aishiyou-instagram-subtitle {
        font-size: 13px;
    }

    .aishiyou-instagram-slider {
        --ig-peek: 22px;
        --ig-gap: 4px;
    }

    /*
     * 1枚 + 左右22px + 左右gap4px。
     *
     * 100% - 52px
     */
    .aishiyou-instagram-slide {
        flex-basis: calc(100% - 52px);
    }

    .aishiyou-instagram-item {
        border-radius: 15px;
        padding: 2px;
    }

    .aishiyou-instagram-media {
        border-radius: 13px;
    }

    .aishiyou-instagram-corner-icon {
        top: 10px;
        left: 10px;
        width: 32px;
        height: 32px;
        border-radius: 7px;
    }

    .aishiyou-instagram-caption {
        left: 10px;
        right: 10px;
        bottom: 10px;

        padding:
            4.5px
            5.5px;

        font-size: 10.4px;
    }

    .aishiyou-instagram-controls {
        margin-top: 12px;
    }
}


/*
|--------------------------------------------------------------------------
| Motion accessibility
|--------------------------------------------------------------------------
*/

@media (prefers-reduced-motion: reduce) {

    .aishiyou-instagram-track,
    .aishiyou-instagram-item,
    .aishiyou-instagram-photo,
    .aishiyou-instagram-arrow,
    .aishiyou-instagram-dot {
        transition: none !important;
    }
}
