/*
 * リプログラミング注射ページ UI最適化 CSS
 * osaka/reprogramming.html 専用
 * バージョン: 1.0.0
 * 更新日: 2026-07-29
 */

/* ==========================================
   スクロールトップボタン
   ========================================== */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 6px 24px rgba(8, 145, 178, 0.4);
    z-index: 9998 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-to-top:hover {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    transform: translateY(0) scale(1.1);
    box-shadow: 0 8px 32px rgba(8, 145, 178, 0.6);
}

.scroll-to-top:active {
    transform: translateY(0) scale(0.95);
}

.scroll-to-top.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* テスト用：常に表示（デバッグ時のみ使用）
.scroll-to-top {
    opacity: 0.5 !important;
    visibility: visible !important;
}
*/

/* ボタンアニメーション */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.scroll-to-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    z-index: -1;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .scroll-to-top {
        width: 50px !important;
        height: 50px !important;
        bottom: 90px !important; /* モバイルCTAバー（高さ約70px）の上に配置 */
        right: 20px !important;
        font-size: 1.1rem;
        z-index: 9998 !important;
    }
}

@media (max-width: 480px) {
    .scroll-to-top {
        width: 48px !important;
        height: 48px !important;
        bottom: 85px !important; /* モバイルCTAバーの上に配置 */
        right: 15px !important;
        font-size: 1rem;
    }
}

/* ==========================================
   スムーススクロール
   ========================================== */
html {
    scroll-behavior: smooth;
}

/* より高度なスムーススクロール（Safari対応） */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ==========================================
   アニメーション最適化
   ========================================== */

/* フェードインアニメーション */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* スライドインアニメーション（左から） */
.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* スライドインアニメーション（右から） */
.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* スケールインアニメーション */
.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scale-in.visible {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================
   ホバーエフェクト強化
   ========================================== */

/* カードホバーエフェクト */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}

/* リンクホバーエフェクト */
a:not(.btn):not([class*="button"]) {
    transition: color 0.3s ease;
}

a:not(.btn):not([class*="button"]):hover {
    color: #0891b2;
}

/* ==========================================
   アイコンボックス正方形修正（超強制）
   ========================================== */

/* アイコンボックスの正方形維持（全デバイス共通） */
.icon-box-square,
.icon-box-square[style] {
    width: 80px !important;
    height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: 80px !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    display: flex !important;
}

/* アイコンの中央配置を確実に */
.icon-box-square i {
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    display: block !important;
}

/* ==========================================
   症例写真カードの角丸修正
   ========================================== */

/* 症例写真カード専用クラス */
.case-photo-card {
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    transition: transform 0.3s;
    position: relative;
}

/* 画像コンテナの隙間完全削除 */
.case-photo-card > div:first-child,
.case-photo-card > div[style*="position: relative"] {
    line-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: relative !important;
    overflow: hidden !important;
}

/* バッジのテキストを正常表示 */
.case-photo-card > div[style*="position: relative"] > div[style*="position: absolute"] {
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

/* 画像の完全フィット - 角丸を画像にも適用 */
.case-photo-card img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    vertical-align: top !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    border-radius: 21px 21px 0 0 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
}

/* ブラウザの描画バグ対策 */
.case-photo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: transparent;
    z-index: 1;
}

/* Webkit系ブラウザの角丸バグ修正 */
@supports (-webkit-appearance: none) {
    .case-photo-card {
        -webkit-backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .case-photo-card img {
        -webkit-backface-visibility: hidden;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* ==========================================
   レスポンシブ改善
   ========================================== */

/* タブレット */
@media (max-width: 1024px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }
    
    /* アイコンボックスの正方形維持（インラインスタイルより優先） */
    .icon-box-square,
    .icon-box-square[style] {
        width: 70px !important;
        height: 70px !important;
        min-width: 70px !important;
        min-height: 70px !important;
        max-width: 70px !important;
        max-height: 70px !important;
        flex-basis: 70px !important;
    }
    
    .icon-box-square i {
        font-size: 2.2rem !important;
    }
}

/* スマートフォン */
@media (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    /* セクション余白調整 */
    section {
        padding-top: 60px !important;
        padding-bottom: 60px !important;
    }
    
    /* アイコンボックスの正方形維持（モバイル・インラインスタイルより優先） */
    .icon-box-square,
    .icon-box-square[style] {
        width: 64px !important;
        height: 64px !important;
        min-width: 64px !important;
        min-height: 64px !important;
        max-width: 64px !important;
        max-height: 64px !important;
        flex-basis: 64px !important;
    }
    
    .icon-box-square i {
        font-size: 2rem !important;
    }
}

/* 極小スマートフォン（iPhone SE等） */
@media (max-width: 375px) {
    .icon-box-square,
    .icon-box-square[style] {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        max-width: 56px !important;
        max-height: 56px !important;
        flex-basis: 56px !important;
    }
    
    .icon-box-square i {
        font-size: 1.8rem !important;
    }
}

/* ==========================================
   パフォーマンス最適化
   ========================================== */

/* GPU加速を有効化 */
.scroll-to-top,
.hover-lift,
.fade-in,
.slide-in-left,
.slide-in-right,
.scale-in {
    will-change: transform, opacity;
}

/* アニメーション完了後のwill-changeクリア */
.fade-in.visible,
.slide-in-left.visible,
.slide-in-right.visible,
.scale-in.visible {
    will-change: auto;
}

/* ==========================================
   アクセシビリティ改善
   ========================================== */

/* フォーカス表示 */
.scroll-to-top:focus {
    outline: 3px solid #FFD700;
    outline-offset: 4px;
}

/* アニメーション無効化（ユーザー設定） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .scroll-to-top::before {
        animation: none;
    }
}

/* ==========================================
   ローディングアニメーション
   ========================================== */

/* ページ読み込み時のフェードイン */
body {
    animation: pageLoad 0.5s ease-in-out;
}

@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   スクロールプログレスバー（オプション）
   ========================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #0891b2 0%, #22d3ee 100%);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* ==========================================
   モバイルメニュー改善
   ========================================== */

@media (max-width: 768px) {
    /* モバイルメニュートグルボタンの改善 */
    .mobile-menu-toggle {
        transition: all 0.3s ease;
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
    
    /* モバイルメニュー表示時のスクロール固定 */
    body.menu-open {
        overflow: hidden;
    }
}

/* ==========================================
   印刷スタイル
   ========================================== */

@media print {
    .scroll-to-top,
    .scroll-progress,
    header,
    footer,
    .mobile-cta {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* ==========================================
   ダークモード対応（将来対応用）
   ========================================== */

@media (prefers-color-scheme: dark) {
    /* 必要に応じてダークモードスタイルを追加 */
}
