/* ==========================================================================
   Sneaker Simulator - Frontend
   All styles scoped to .sns-app to avoid theme conflicts.
   ========================================================================== */

.sns-app, .sns-app * { box-sizing: border-box; }

.sns-app {
    max-width: 1200px;
    width: 100%;
    margin: 32px auto;
    background: #fff;
    color: #1a1a1a;
    font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    box-shadow: 0 8px 30px -20px rgba(0,0,0,0.15);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.sns-notice {
    padding: 20px;
    background: #fef9c3;
    border: 1px solid #f59e0b;
    border-radius: 4px;
    color: #92400e;
    font-size: 14px;
    text-align: center;
    margin: 20px 0;
}

/* Main */
.sns-app-main {
    display: grid;
    grid-template-columns: 1fr 440px;
}
/* grid子要素のデフォルトのmin-width: auto を打ち消し、内容で親を押し広げないように */
.sns-app-main > .sns-stage-wrap,
.sns-app-main > .sns-sidebar {
    min-width: 0;
}

/* Stage — single hero image, no wall/scene layers */
.sns-stage-wrap {
    background: #fff;
    padding: 28px;
}
.sns-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 16px 50px -25px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sns-stage-img {
    max-width: 92%;
    max-height: 92%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    user-select: none;
}
.sns-stage-img.is-loaded {
    opacity: 1;
}
.sns-stage-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #999;
    font-size: 13px;
    pointer-events: none;
}
.sns-stage-empty-ic {
    font-size: 40px;
    line-height: 1;
}
.sns-stage-info {
    margin-top: 12px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 12px;
    color: #777;
}
.sns-stage-hint {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sns-stage-hint::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a1a1a;
    display: inline-block;
}

/* Sidebar */
.sns-sidebar {
    background: #fff;
    border-left: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
}

.sns-sidebar-head {
    padding: 18px 22px 14px;
    border-bottom: 1px solid #e5e5e5;
}
.sns-sidebar-eyebrow {
    font-size: 10px;
    color: #999;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.sns-sidebar-title {
    font-size: 16px;
    font-weight: 500;
    margin-top: 4px;
}

.sns-filters-row {
    padding: 14px 22px;
    border-bottom: 1px solid #e5e5e5;
    background: #fafafa;
    display: flex;
    gap: 8px;
}
.sns-filter-group { flex: 1; }
.sns-filter-label {
    font-size: 10px;
    color: #999;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.sns-filter-select {
    width: 100%;
    border: 1px solid #ccc;
    background: #fff;
    padding: 6px 8px;
    font-size: 12px;
    color: #1a1a1a;
    font-family: inherit;
    border-radius: 3px;
    cursor: pointer;
}

.sns-result-count {
    padding: 9px 22px;
    font-size: 11px;
    color: #777;
    border-bottom: 1px solid #e5e5e5;
}
.sns-result-count strong {
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 500;
    margin-right: 4px;
}

.sns-product-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
    max-height: 440px;
}
.sns-product-card {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    font-family: inherit;
    transition: transform 0.15s;
}
.sns-product-card:hover { transform: translateY(-2px); }
.sns-product-thumb {
    width: 100%;
    aspect-ratio: 1;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 3px;
    margin-bottom: 4px;
    transition: all 0.15s;
}
.sns-product-card.active .sns-product-thumb {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 1px #1a1a1a, 0 6px 16px -8px rgba(0,0,0,0.4);
}
.sns-product-code {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #1a1a1a;
}
.sns-product-name {
    font-size: 10px;
    color: #777;
    line-height: 1.35;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.sns-product-price {
    font-size: 10px;
    color: #1a1a1a;
    margin-top: 2px;
    font-weight: 500;
}

.sns-detail-card {
    border-top: 1px solid #e5e5e5;
    padding: 14px 22px;
    background: #fafafa;
}
.sns-detail-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.sns-detail-thumb {
    width: 56px;
    height: 56px;
    border: 1px solid #ccc;
    background: #fff;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 3px;
    flex-shrink: 0;
}
.sns-detail-info { flex: 1; min-width: 0; }
.sns-detail-code {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #1a1a1a;
}
.sns-detail-name {
    font-size: 12px;
    margin-top: 2px;
    color: #1a1a1a;
}
.sns-detail-price {
    font-size: 13px;
    margin-top: 4px;
    font-weight: 500;
}
.sns-detail-cta {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 9px;
    background: #1a1a1a;
    color: #fff !important;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    letter-spacing: 0.08em;
    border-radius: 3px;
    text-align: center;
    text-decoration: none !important;
    box-sizing: border-box;
    transition: background 0.15s;
}
.sns-detail-cta:hover { background: #444; color: #fff; }
.sns-detail-cta[aria-disabled="true"] {
    background: #ccc;
    pointer-events: none;
}
.sns-arrow { margin-left: 6px; }

/* Empty grid */
.sns-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 10px;
    color: #999;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 920px) {
    .sns-app-main { grid-template-columns: 1fr; }
    .sns-sidebar {
        border-left: none;
        border-top: 1px solid #e5e5e5;
        min-width: 0; /* 子要素のflex内容が親を押し広げないように */
    }
    .sns-stage-wrap { padding: 18px; }

    /* スマホでは商品リストを横スクロールに切り替え（3.3枚表示） */
    .sns-product-grid {
        display: flex;
        grid-template-columns: none; /* grid設定を打ち消し */
        max-height: none;
        /* width:100% + min-width:0 がないと、flex子要素の合計幅で親が広がってしまう */
        width: 100%;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 10px;
        padding: 12px 22px; /* サイドバー両端と揃える */
        scroll-snap-type: x mandatory;
        scroll-padding-left: 22px;
        -webkit-overflow-scrolling: touch;
    }
    .sns-product-card {
        /* 3.3枚表示 + その間に2.3個のgap(10px)が入る計算 */
        flex: 0 0 calc((100% - 23px) / 3.3);
        scroll-snap-align: start;
        min-width: 0;
    }
    /* タップ時のホバーチラつきを防ぐ */
    .sns-product-card:hover { transform: none; }

    /* 横スクロールバーを細く（WebKit系のみ） */
    .sns-product-grid::-webkit-scrollbar {
        height: 4px;
    }
    .sns-product-grid::-webkit-scrollbar-thumb {
        background: #d4d4d4;
        border-radius: 2px;
    }
    .sns-product-grid::-webkit-scrollbar-track {
        background: transparent;
    }

    /* 「該当なし」のときはflexだとレイアウトが崩れるのでブロックに戻す */
    .sns-grid-empty {
        flex: 1 0 100%;
    }
}
@media (max-width: 360px) {
    .sns-stage-wrap { padding: 12px; }
    .sns-sidebar-head { padding: 14px 16px 10px; }
    .sns-filters-row, .sns-result-count, .sns-detail-card { padding-left: 16px; padding-right: 16px; }
    /* 画面が狭い場合もパディングを揃える */
    .sns-product-grid {
        padding-left: 16px;
        padding-right: 16px;
        scroll-padding-left: 16px;
    }
}
