/* ================================================
   Instagram Feed Widget Pro — フロントエンドスタイル
================================================ */

/* ---------- 共通リセット ---------- */
.ifw-wrap * { box-sizing: border-box; }

.ifw-wrap {
    --ifw-cols: 3;
    --ifw-gap:  12px;
    --ifw-radius: 8px;
    --ifw-accent: #e1306c;   /* Instagram pink */
    --ifw-overlay: rgba(0,0,0,.55);
    font-family: inherit;
    margin-bottom: 24px;
}

.ifw-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.ifw-empty {
    padding: 20px;
    background: #fff3f3;
    border: 1px solid #f5c6cb;
    border-radius: var(--ifw-radius);
    color: #721c24;
    font-size: .9rem;
}

/* ================================================
   グリッド
================================================ */
.ifw-layout-grid .ifw-grid {
    display: grid;
    grid-template-columns: repeat(var(--ifw-cols), 1fr);
    gap: var(--ifw-gap);
}

/* ================================================
   マソンリー
================================================ */
.ifw-layout-masonry .ifw-masonry {
    columns: var(--ifw-cols);
    column-gap: var(--ifw-gap);
}
.ifw-layout-masonry .ifw-card {
    break-inside: avoid;
    margin-bottom: var(--ifw-gap);
}
.ifw-layout-masonry .ifw-img-wrap img {
    height: auto !important;
}

/* ================================================
   カード共通
================================================ */
.ifw-card {
    position: relative;
    border-radius: var(--ifw-radius);
    overflow: hidden;
}

.ifw-img-wrap {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #f0f0f0;
    border-radius: var(--ifw-radius);
}

.ifw-layout-masonry .ifw-img-wrap {
    aspect-ratio: unset;
}

.ifw-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}

.ifw-img-wrap:hover img {
    transform: scale(1.06);
}

/* ---------- オーバーレイ ---------- */
.ifw-overlay {
    position: absolute;
    inset: 0;
    background: var(--ifw-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
    border-radius: var(--ifw-radius);
}

.ifw-img-wrap:hover .ifw-overlay {
    opacity: 1;
}

/* ---------- メタ情報（いいね・コメント） ---------- */
.ifw-meta {
    display: flex;
    gap: 16px;
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
}

.ifw-likes,
.ifw-comments {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------- キャプション ---------- */
.ifw-card .ifw-caption {
    margin: 6px 0 0;
    font-size: .82rem;
    line-height: 1.5;
    color: #444;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---------- 日付 ---------- */
.ifw-card .ifw-date,
.ifw-list-item .ifw-date {
    display: block;
    font-size: .75rem;
    color: #999;
    margin-top: 4px;
}

/* ================================================
   カルーセル
================================================ */
.ifw-layout-carousel .ifw-carousel-wrap {
    position: relative;
    overflow: hidden;
}

.ifw-layout-carousel .ifw-carousel {
    display: flex;
    gap: var(--ifw-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
    scroll-behavior: smooth;
}

.ifw-layout-carousel .ifw-carousel::-webkit-scrollbar { display: none; }

.ifw-layout-carousel .ifw-card {
    flex: 0 0 calc(100% / min(var(--ifw-cols, 3), 3));
    scroll-snap-align: start;
    min-width: 160px;
}

/* ---------- 矢印 ---------- */
.ifw-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,.92);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
    transition: background .2s, transform .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.ifw-arrow:hover { background: #fff; transform: translateY(-50%) scale(1.1); }
.ifw-prev { left: 4px; }
.ifw-next { right: 4px; }

/* ================================================
   リスト
================================================ */
.ifw-layout-list .ifw-list {
    display: flex;
    flex-direction: column;
    gap: var(--ifw-gap);
}

.ifw-list-item {
    display: flex;
    gap: 14px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: var(--ifw-radius);
    overflow: hidden;
    transition: box-shadow .2s;
}

.ifw-list-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.ifw-list-thumb {
    flex: 0 0 90px;
    display: block;
}

.ifw-list-thumb img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    display: block;
}

.ifw-list-body {
    flex: 1;
    padding: 12px 14px 12px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.ifw-list-body .ifw-caption {
    font-size: .85rem;
    color: #333;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ifw-list-body .ifw-meta {
    color: #999;
    font-size: .8rem;
    font-weight: 500;
}

.ifw-list-body .ifw-meta .ifw-likes,
.ifw-list-body .ifw-meta .ifw-comments {
    color: #666;
}

.ifw-more {
    font-size: .8rem;
    color: var(--ifw-accent);
    text-decoration: none;
    font-weight: 600;
}
.ifw-more:hover { text-decoration: underline; }

/* ================================================
   レスポンシブ
================================================ */
@media (max-width: 768px) {
    .ifw-wrap { --ifw-cols: 2; }

    .ifw-layout-masonry .ifw-masonry { columns: 2; }

    .ifw-layout-carousel .ifw-card {
        flex: 0 0 calc(50% - var(--ifw-gap) / 2);
    }
}

@media (max-width: 480px) {
    .ifw-wrap { --ifw-cols: 1; }

    .ifw-layout-grid .ifw-grid { grid-template-columns: repeat(2, 1fr); }

    .ifw-layout-masonry .ifw-masonry { columns: 2; }

    .ifw-layout-carousel .ifw-card {
        flex: 0 0 calc(80% - var(--ifw-gap));
    }

    .ifw-list-thumb,
    .ifw-list-thumb img { width: 72px; height: 72px; }
}
