/**
 * 比較スライダー スタイル
 * Before/After画像比較用のスタイルシート
 */

/* Before/Afterセクション */
.before-after-section {
    padding: 1.5rem 0 2rem;
    background-color: var(--background);
}

.before-after-section .section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 1.5rem;
}

/* スライダーグリッド */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

/* スライダーコンテナ */
.comparison-slider-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
}

.comparison-slider-container.dragging {
    cursor: grabbing;
}

/* 画像コンテナ */
.comparison-images {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
}

/* Before/After画像 */
.comparison-before,
.comparison-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comparison-before {
    clip-path: inset(0 50% 0 0);
    z-index: 2;
}

.comparison-after {
    z-index: 1;
}

/* スライダーハンドル */
.comparison-slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background-color: var(--white);
    transform: translateX(-50%);
    z-index: 3;
    cursor: ew-resize;
    transition: background-color 0.2s;
}

.comparison-slider-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: var(--white);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.comparison-slider-handle::after {
    content: '⇆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--primary-color);
    font-weight: bold;
    z-index: 1;
}

.comparison-slider-container:hover .comparison-slider-handle {
    background-color: var(--primary-color);
}

/* ラベル */
.comparison-label {
    position: absolute;
    top: 1rem;
    padding: 0.5rem 1rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.25rem;
    z-index: 4;
    pointer-events: none;
}

.comparison-label.before {
    left: 1rem;
}

.comparison-label.after {
    right: 1rem;
}

/* 例のタイトル */
.comparison-example-title {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 0.75rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .before-after-section {
        padding: 1.5rem 0;
    }

    .before-after-section .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .comparison-grid {
        gap: 1.25rem;
        padding: 0 1rem;
    }

    .comparison-slider-handle::before {
        width: 40px;
        height: 40px;
    }

    .comparison-slider-handle::after {
        font-size: 20px;
    }

    .comparison-label {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .comparison-example-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .comparison-slider-handle::before {
        width: 36px;
        height: 36px;
    }

    .comparison-slider-handle::after {
        font-size: 18px;
    }
}
