/**
 * WHSJフロントエンド表示スタイル
 * レスポンシブ・アクセシビリティ対応
 *
 * @package STEPJAM_Theme
 */

/* =============================================================================
   WHSJ動画表示
   ============================================================================= */

.whsj-video-fallback {
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.whsj-video-fallback::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    animation: whsj-loading-spin 1s linear infinite;
}

@keyframes whsj-loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 動画最適化 */
.whsj-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* モバイル動画最適化 - 統一境界 (767px以下) */
@media (max-width: 767px) {
    .whsj-video-container video {
        object-fit: cover;
    }

    .whsj-video-fallback {
        min-height: 200px;
    }
}

/* =============================================================================
   WHSJテキスト表示
   ============================================================================= */

.whsj-text-content {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.whsj-text-content p {
    margin: 0 0 1em 0;
}

.whsj-text-content p:last-child {
    margin-bottom: 0;
}

/* レスポンシブテキスト調整 - style.cssで統一管理 */
/* .whsj-text-responsive スタイルはstyle.cssで単一定義済み - 5重競合解消完了 */
/* 統合済み: font-size, line-height, letter-spacing, text-align, word-break, hyphens */

/* =============================================================================
   WHSJセクション全体
   ============================================================================= */

.whsj-section-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: auto;
    overflow: visible;
}

/* WHSJ Sono Unified - Responsive Optimization */
.whsj-sono-unified {
    /* アスペクト比維持のため、width/heightはstyle.cssに任せる */
    /* !importantを削除してstyle.cssのスタイルを優先 */
    max-width: none;
    max-height: none;
    transform-origin: center center;
    /* Prevent hover conflicts */
    pointer-events: none;
    /* Performance optimization */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Legacy responsive class removed - using whsj-sono-unified instead */

/* Desktop WHSJ Grid Layout - 統一境界 (768px以上) */
@media (min-width: 768px) {
    .whsj-section-container {
        display: grid;
        grid-template-columns: 1fr 1fr 0.6fr;
        grid-template-rows: 1fr 1fr;
        grid-template-areas:
            "video content sono"
            "vector content sono";
        gap: 0;
    }

    .whsj-video-area {
        grid-area: video;
    }

    .whsj-vector-area {
        grid-area: vector;
    }

    .whsj-content-area {
        grid-area: content;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 2rem;
    }

    /* whsj-sono-area のスタイルは style.css で統一管理 - 重複防止のため削除済み */
}

/* Mobile WHSJ Layoutはstyle.cssで統一管理 - 重複防止のためこちらは削除済み */

/* =============================================================================
   アクセシビリティ対応
   ============================================================================= */

/* スクリーンリーダー対応 */
.whsj-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 動きの軽減設定 */
@media (prefers-reduced-motion: reduce) {
    .whsj-video-fallback::before {
        animation: none;
    }

    .whsj-section-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ハイコントラストモード */
@media (prefers-contrast: high) {
    .whsj-video-fallback {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid rgba(255, 255, 255, 0.8);
    }

    .whsj-text-content {
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    }
}

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

/* GPU加速の有効化 */
.whsj-video-container,
.whsj-content-area {
    transform: translateZ(0);
    will-change: transform;
}

/* 画像遅延読み込み対応 */
.whsj-lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.whsj-lazy-image.loaded {
    opacity: 1;
}

/* Critical Loading State */
.whsj-loading-critical {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: whsj-skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes whsj-skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =============================================================================
   エラー状態
   ============================================================================= */

.whsj-error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    color: #721c24;
}

.whsj-error-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.whsj-error-message {
    font-size: 0.875rem;
    text-align: center;
    line-height: 1.4;
}

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

@media print {
    .whsj-video-container,
    .whsj-video-fallback {
        display: none !important;
    }

    .whsj-text-content {
        color: #000 !important;
        background: transparent !important;
        text-shadow: none !important;
    }

    .whsj-section-container {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .whsj-content-area {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        max-width: none !important;
        padding: 1rem 0 !important;
    }
}

/* =============================================================================
   デバッグモード（開発時のみ）
   ============================================================================= */

@media screen and (min-width: 1px) {
    .whsj-debug .whsj-video-area::after,
    .whsj-debug .whsj-content-area::after,
    .whsj-debug .whsj-vector-area::after,
    .whsj-debug .whsj-sono-area::after {
        content: attr(class);
        position: absolute;
        top: 0;
        left: 0;
        background: rgba(255, 0, 0, 0.8);
        color: white;
        padding: 4px 8px;
        font-size: 12px;
        font-family: monospace;
        z-index: var(--z-modal, 9999);
        pointer-events: none;
    }
}

/* =============================================================================
   カスタムプロパティ（CSS変数）
   ============================================================================= */

:root {
    --whsj-video-aspect-ratio: 16/9;
    --whsj-content-max-width: 600px;
    --whsj-text-line-height: 1.6;
    --whsj-transition-duration: 0.3s;
    --whsj-border-radius: 8px;
    --whsj-section-height: auto;
    --whsj-section-height-modern: auto;
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    :root {
        --whsj-text-color: #f0f0f1;
        --whsj-error-bg: rgba(220, 53, 69, 0.2);
        --whsj-error-border: rgba(220, 53, 69, 0.5);
    }

    .whsj-error-container {
        background: var(--whsj-error-bg);
        border-color: var(--whsj-error-border);
        color: var(--whsj-text-color);
    }
}

