/**
 * モバイル・タブレット対応レスポンシブデザイン
 * スマートフォン、タブレット、PCでの最適表示
 */

/* ========================================
   共通のベーススタイル
   ======================================== */
* {
    box-sizing: border-box;
}

.main-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   スマートフォン対応 (～768px)
   ======================================== */
@media screen and (max-width: 768px) {
    /* ヘッダー調整 */
    header {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
        text-align: center;
        margin: 10px 0;
    }
    
    h2 {
        font-size: 1.4rem !important;
        margin: 15px 0 10px;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
    
    /* メインコンテナを1カラムに */
    .main-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px;
        padding: 10px;
    }
    
    .left-column,
    .center-column,
    .right-column {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* カードレイアウト */
    .card,
    .youtube-card,
    .blog-card {
        width: 100%;
        margin: 10px 0;
        border-radius: 10px;
    }
    
    /* YouTube動画コンテナ */
    .youtube-main-container,
    #youtube-main-container {
        padding: 10px !important;
    }
    
    .youtube-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .youtube-thumbnail-container,
    .youtube-embed-container {
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
    }
    
    iframe[src*="youtube"] {
        max-width: 100%;
        height: auto;
        min-height: 200px;
    }
    
    /* ボタンサイズ調整 */
    button,
    .btn,
    .social-link,
    .youtube-watch-btn,
    .channel-button {
        min-height: 44px; /* タップしやすいサイズ */
        min-width: 44px;
        padding: 12px 20px;
        font-size: 1rem;
        margin: 5px;
    }
    
    /* ナビゲーション */
    nav {
        padding: 10px 0;
    }
    
    nav ul {
        flex-direction: column;
        gap: 10px;
    }
    
    nav li {
        width: 100%;
        text-align: center;
    }
    
    nav a {
        display: block;
        padding: 12px;
        width: 100%;
    }
    
    /* フォントサイズ調整 */
    p, span {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .youtube-info {
        padding: 12px !important;
    }
    
    .youtube-title {
        font-size: 1rem !important;
    }
    
    .youtube-description {
        font-size: 0.9rem !important;
    }
    
    /* ソーシャルリンク */
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 15px;
    }
    
    .social-link {
        flex: 0 1 calc(50% - 10px);
        max-width: 200px;
    }
    
    /* VRM Viewer調整 */
    #vrm-container,
    .vrm-viewer {
        height: 300px !important;
        width: 100%;
    }
    
    /* 占いセクション */
    .fortune-section {
        padding: 15px;
    }
    
    .fortune-result {
        padding: 15px;
        font-size: 0.95rem;
    }
    
    /* パディング・マージン調整 */
    section {
        padding: 15px 10px;
        margin: 10px 0;
    }
    
    /* フッター */
    footer {
        padding: 20px 10px;
        text-align: center;
    }
}

/* ========================================
   タブレット・iPad対応 (768px～1024px)
   ======================================== */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* ヘッダー調整 */
    h1 {
        font-size: 2.2rem !important;
    }
    
    h2 {
        font-size: 1.7rem !important;
    }
    
    h3 {
        font-size: 1.3rem !important;
    }
    
    /* 2カラムレイアウト */
    .main-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 20px;
        padding: 20px;
    }
    
    .left-column {
        grid-column: 1;
    }
    
    .center-column {
        grid-column: 2;
    }
    
    .right-column {
        grid-column: 1 / -1; /* 全幅 */
        margin-top: 20px;
    }
    
    /* YouTubeグリッド */
    .youtube-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    
    /* カード調整 */
    .card,
    .youtube-card,
    .blog-card {
        margin: 15px 0;
    }
    
    /* ボタンサイズ */
    button,
    .btn,
    .social-link {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 1.05rem;
    }
    
    /* VRM Viewer */
    #vrm-container,
    .vrm-viewer {
        height: 400px !important;
    }
    
    /* ソーシャルリンク */
    .social-links {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        padding: 20px;
    }
}

/* ========================================
   横向きモード対応
   ======================================== */
@media screen and (max-width: 1024px) and (orientation: landscape) {
    /* 横向き時の高さ調整 */
    header {
        padding: 10px 15px;
    }
    
    h1 {
        font-size: 1.6rem !important;
        margin: 5px 0;
    }
    
    .main-content {
        padding: 10px;
    }
    
    #vrm-container,
    .vrm-viewer {
        height: 250px !important;
    }
}

/* ========================================
   PC対応 (1024px～)
   ======================================== */
@media screen and (min-width: 1025px) {
    /* 3カラムレイアウト維持 */
    .main-content {
        display: grid !important;
        grid-template-columns: 1fr 2fr 1fr !important;
        gap: 30px;
        padding: 30px;
    }
    
    /* YouTubeグリッド */
    .youtube-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* VRM Viewer */
    #vrm-container,
    .vrm-viewer {
        height: 500px !important;
    }
}

/* ========================================
   タッチデバイス最適化
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    /* タッチデバイスでのホバー効果を無効化 */
    .card:hover,
    .youtube-card:hover,
    .blog-card:hover {
        transform: none !important;
    }
    
    /* タップ時のフィードバック */
    button:active,
    .btn:active,
    .social-link:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
    
    /* スクロールの改善 */
    * {
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   アクセシビリティ向上
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ========================================
   印刷対応
   ======================================== */
@media print {
    .no-print,
    nav,
    .social-links,
    iframe,
    video {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ========================================
   フォントサイズの相対指定
   ======================================== */
@media screen and (max-width: 480px) {
    html {
        font-size: 14px;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    html {
        font-size: 15px;
    }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
    html {
        font-size: 16px;
    }
}

@media screen and (min-width: 1025px) {
    html {
        font-size: 16px;
    }
}

/* ========================================
   ユーティリティクラス
   ======================================== */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* ========================================
   スクロールバー調整
   ======================================== */
@media screen and (max-width: 1024px) {
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 3px;
    }
}