/* =============================================
   レスポンシブスタイル - ニュースでやさしい日本語
   ============================================= */

/* タブレット（768px以下） */
@media (max-width: 768px) {
    /* ヘッダー */
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    /* 記事カード */
    .article-card {
        margin-bottom: 1rem;
    }
    
    /* 記事本文 */
    .article-body {
        font-size: 1rem;
        padding: 1rem !important;
    }
    
    /* レベル切替タブ */
    .nav-tabs {
        font-size: 0.9rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
    }
    
    /* 広告 */
    .ad-placeholder {
        min-height: 80px;
        font-size: 0.8rem;
    }
    
    /* サイドバーを下に表示 */
    .col-lg-4 {
        margin-top: 2rem;
    }
    
    /* フッター */
    footer .col-md-4 {
        margin-bottom: 1.5rem;
    }
}

/* スマートフォン（576px以下） */
@media (max-width: 576px) {
    /* ヘッダー */
    .navbar-brand {
        font-size: 1rem;
    }
    
    /* コンテナの余白調整 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 記事カード */
    .article-card .card-body {
        padding: 1rem;
    }
    
    .article-card .card-title {
        font-size: 1rem;
    }
    
    .article-card .card-footer small {
        font-size: 0.75rem;
    }
    
    /* 記事詳細 */
    h1 {
        font-size: 1.5rem;
    }
    
    .article-body {
        font-size: 1.05rem;
        line-height: 2;
        padding: 1rem !important;
    }
    
    /* レベル切替タブ（nav-tabsはmax-width:767.98pxで一括対応） */
    
    /* シェアボタン */
    .share-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
    
    /* 広告 */
    .ad-placeholder {
        min-height: 60px;
        font-size: 0.75rem;
    }
    
    /* パンくずリスト */
    .breadcrumb {
        font-size: 0.85rem;
    }
    
    /* フッター */
    footer {
        font-size: 0.9rem;
    }
    
    footer h5, footer h6 {
        font-size: 1rem;
    }
}

/* 大画面（1200px以上） */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .article-body {
        font-size: 1.15rem;
    }
}

/* 印刷用 */
@media print {
    /* 不要な要素を非表示 */
    header, footer, .navbar, .ad-placeholder, .share-btn, .btn, .nav-tabs {
        display: none !important;
    }
    
    /* 記事本文を最適化 */
    .article-body {
        background: none !important;
        padding: 0 !important;
    }
    
    /* リンクのURLを表示 */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ═══ モバイルボトムナビ ═══════════════════════════════════════════ */
.sn-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1020;
    background: rgba(255,255,255,.96);
    -webkit-backdrop-filter: blur(8px); /* Safari 9〜17 */
    backdrop-filter: blur(8px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
    justify-content: space-around;
    /* iOS セーフエリア対応 */
    padding: .25rem env(safe-area-inset-right, 0) calc(.25rem + env(safe-area-inset-bottom, 0)) env(safe-area-inset-left, 0);
}
.sn-bottom-nav__item {
    display: flex; flex-direction: column; align-items: center;
    padding: .5rem .25rem;
    font-size: .62rem; color: #94a3b8;
    text-decoration: none; min-width: 60px;
    transition: color .15s;
}
.sn-bottom-nav__item .bi {
    font-size: 1.3rem;
    margin-bottom: .15rem; /* gap fallback for Safari < 14.1 */
}
.sn-bottom-nav__item.active,
.sn-bottom-nav__item:hover { color: #1d4ed8; }

@media (max-width: 991.98px) {
    main.container {
        margin-bottom: calc(4rem + constant(safe-area-inset-bottom, 0px)) !important; /* iOS 11 */
        margin-bottom: calc(4rem + env(safe-area-inset-bottom, 0px)) !important;
    }
    footer {
        margin-bottom: calc(56px + constant(safe-area-inset-bottom, 0px)); /* iOS 11 */
        margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

/* ═══ nav-tabs / nav-pills 横スクロール + フェード（スマホ・タブレット） ══ */
@media (max-width: 767.98px) {
    .nav-pills,
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
        /* フェードアウトで「スクロール可能」を示唆 */
        -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent 100%);
        mask-image: linear-gradient(90deg, #000 82%, transparent 100%);
    }
    .nav-pills::-webkit-scrollbar,
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-pills .nav-item,
    .nav-tabs .nav-item { flex-shrink: 0; }
    .nav-pills .nav-link,
    .nav-tabs .nav-link { white-space: nowrap; }
    /* nav-tabs のパディング調整 */
    .nav-tabs .nav-link {
        font-size: .8rem;
        padding: .4rem .6rem;
    }
}

/* ═══ 記事カード：モバイルでボタン最小タップ領域確保 ════════════════ */
@media (max-width: 767.98px) {
    .sn-card-read-btn {
        min-height: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ═══ 記事カード：モバイルでカード1列フルWidth ═════════════════════ */
@media (max-width: 575.98px) {
    .article-card .card-body { padding: .875rem; }
    .article-card .card-title { font-size: .95rem; }
}

/* ═══ ヒーロー信頼バー：モバイルで2×2グリッド ══════════════════════ */
@media (max-width: 575.98px) {
    .sn-trust-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .75rem;
    }
    /* グリッドではmarginではなくgapで制御するのでリセット */
    .sn-trust-bar > * { margin-right: 0; margin-bottom: 0; }
    .sn-trust-sep { display: none; }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    /* 将来的にダークモードを実装する場合のスタイル */
    /* 現在は未対応 */
}

/* ═══ スマホ追加改善（575px以下） ════════════════════════════════════ */
@media (max-width: 575.98px) {

    /* ヒーローH1: モバイルフォントサイズ調整 */
    .sn-hero__h1 {
        font-size: 1.3rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* レベルページ h1 (display-6): バッジを独立ブロック化 */
    h1.display-6 {
        font-size: 1.55rem !important;
        word-break: break-word;      /* Safari < 15.4 fallback */
        overflow-wrap: anywhere;
        line-height: 1.4;
    }
    h1.display-6 > .badge {
        display: block;
        width: fit-content;
        margin-bottom: .45rem;
        font-size: .78rem;
    }

    /* パンくずの最終アイテムを省略 */
    .breadcrumb-item:last-child {
        max-width: 55vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: bottom;
    }

    /* 記事メタ情報 */
    .sn-article-meta {
        gap: .2rem .4rem;
        font-size: .8rem;
    }

    /* 信頼バーをよりコンパクトに */
    .sn-trust-num {
        font-size: 1.1rem;
    }

    /* レベル説明テキスト（.lead）の折り返し */
    .lead {
        font-size: 1rem;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* 記事本文の余白最適化（ルビ付きで読みやすく） */
    .article-body {
        padding: .875rem !important;
        line-height: 2.2;
    }

    /* シェアボタンを均等配置 */
    .d-flex.gap-2:has(.share-btn) {
        gap: .4rem !important;
    }
    .share-btn {
        flex: 1;
        font-size: .75rem;
        padding: .4rem .3rem;
        text-align: center;
    }

    /* カードフッター: 4レベルボタンのギャップ調整 */
    .sn-card-read-grid {
        gap: .25rem;
    }
    .sn-card-read-btn {
        font-size: .68rem;
        padding: .35rem .3rem;
    }
}
