/**
 * HighRezIO Compare Block Styles
 * 写真比較ブロック用スタイル
 */

/* ============================================
   コンテナ
   ============================================ */
.block-compare {
    margin-left: auto;
    margin-right: auto;
}

.compare-container {
    position: relative;
    overflow: hidden;
    user-select: none;
    cursor: zoom-in;
    /* アスペクト比維持（デフォルト3:2、JSで上書き） */
    padding-top: 66.67%;
}

/* ============================================
   画像レイヤー
   ============================================ */
.compare-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.compare-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* 左画像: クリップで右側を切り取る */
.compare-left {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

/* 右画像: 常に全体表示（背面） */
.compare-right {
    z-index: 1;
}

/* ============================================
   ラベル
   ============================================ */
.compare-label {
    position: absolute;
    bottom: 12px;
    padding: 4px 12px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 13px;
    border-radius: 4px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.compare-label-left {
    left: 12px;
}

.compare-label-right {
    right: 12px;
}

/* ============================================
   スライダーハンドル
   ============================================ */
.compare-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    z-index: 5;
    transform: translateX(-50%);
}

.compare-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.compare-handle-line {
    flex: 1;
    width: 2px;
    background-color: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.compare-handle-grip {
    width: 40px;
    height: 40px;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: ew-resize;
    flex-shrink: 0;
}

.compare-handle-grip svg {
    width: 24px;
    height: 24px;
    color: #374151;
}

.compare-handle-grip:hover {
    background-color: #f3f4f6;
}

/* ============================================
   ライトボックス内のcompare
   ============================================ */
.hrz-lb-compare-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hrz-lb-compare-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.hrz-lb-compare-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hrz-lb-compare-image img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: none;
    max-height: none;
    user-select: none;
    -webkit-user-drag: none;
}

.hrz-lb-compare-left {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

.hrz-lb-compare-right {
    z-index: 1;
}

.hrz-lb-compare-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    z-index: 10;
    transform: translateX(-50%);
}

.hrz-lb-compare-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
}

.hrz-lb-compare-handle-line {
    flex: 1;
    width: 2px;
    background-color: #fff;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.hrz-lb-compare-handle-grip {
    width: 48px;
    height: 48px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    cursor: ew-resize;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.hrz-lb-compare-handle-grip:hover {
    background-color: #fff;
}

.hrz-lb-compare-handle-grip svg {
    width: 28px;
    height: 28px;
    color: #374151;
}

.hrz-lb-compare-label {
    position: absolute;
    bottom: 16px;
    padding: 6px 16px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 14px;
    border-radius: 4px;
    z-index: 15;
    backdrop-filter: blur(4px);
}

.hrz-lb-compare-label-left {
    left: 16px;
}

.hrz-lb-compare-label-right {
    right: 16px;
}

/* ============================================
   モバイル対応
   ============================================ */
@media (max-width: 768px) {
    .compare-label {
        bottom: 8px;
        padding: 3px 8px;
        font-size: 11px;
    }

    .compare-label-left {
        left: 8px;
    }

    .compare-label-right {
        right: 8px;
    }

    .compare-handle-grip {
        width: 36px;
        height: 36px;
    }

    .compare-handle-grip svg {
        width: 20px;
        height: 20px;
    }

    .hrz-lb-compare-handle-grip {
        width: 40px;
        height: 40px;
    }

    .hrz-lb-compare-handle-grip svg {
        width: 24px;
        height: 24px;
    }

    .hrz-lb-compare-label {
        bottom: 12px;
        padding: 4px 12px;
        font-size: 12px;
    }

    .hrz-lb-compare-label-left {
        left: 12px;
    }

    .hrz-lb-compare-label-right {
        right: 12px;
    }
}
