@charset "UTF-8";
/* =========================================================
   モーダル型カテゴリーのスタイル
========================================================= */
/* サイドバーウィジェットの矢印アイコン */
.cat-arrow {
    display: inline-block;
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-top: 2px solid #999;
    border-right: 2px solid #999;
    transform: rotate(45deg);
}
.custom-cat-list .cat-link {
    display: flex;
    align-items: center;
    padding: 8px 0;
    /* border-bottom: 1px solid #eee; */
    text-decoration: none;
    color: #333;
    font-weight: normal;
}

/* =========================================================
   モーダル本体（背景とコンテナ）
========================================================= */
.cat-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s linear, visibility 0.3s linear;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cat-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.cat-modal-container {
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    max-height: 800px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s linear;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.cat-modal-overlay.is-active .cat-modal-container {
    transform: translateY(0);
}

/* モーダルヘッダー */
.cat-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 15px;
}
.cat-modal-title {
    color: #333;
    font-size: 20px;
    font-weight: 500;
    flex-grow: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
}
.cat-modal-btn {
    background: none;
    border: none;
    color: #8d8c8c;
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    width: 60px;
}
.js-cat-modal-close {
    color: #8d8c8c;
    font-size: 18px;
    text-align: right;
}
img.cat-modal-title-icon.js-cat-modal-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    /* border-radius: 50%; */
}

/* =========================================================
   モーダルの中身（スライドパネル機構）
========================================================= */
.cat-modal-body {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    background: #fff;
}
/* ★ 超軽量化：非表示のパネルはメモリから完全に消去する（待機させない） */
.cat-modal-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: none; 
}
/* 今見ているパネルだけを描画して、軽くスライドインさせる */
.cat-modal-panel.is-current {
    display: block;
    animation: panelSlideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
/* 左に隠れた（戻る待ちの）パネルも容赦なくメモリから消す */
.cat-modal-panel.is-left {
    display: none;
}

/* 負荷の少ないCSSアニメーション */
@keyframes panelSlideIn {
    from { transform: translateX(20%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* モーダル内のリストデザイン */
.modal-cat-list {
   list-style: none;
    padding: 0 32px 32px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--panda_gap);
}
.modal-cat-item {
    display: flex;
}
.modal-cat-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #fff;
    border:1px solid var(--border-color);
    text-decoration: none;
    width: 100%;
    color:#333;
    font-size: 13px;
    transition: background-color 0.3s linear, border-color 0.3s linear;
    border-radius: var(--radius_min);
}
.modal-cat-item.is-all {
    grid-column: 1 / -1; 
}
.modal-cat-item.is-all a {
    background: #6e6c6c;
    color: #fff;
    justify-content: center;
    margin: 0 auto;
    padding: 0.75em;
    border-width: 0px;
    margin-bottom: 12px;
    font-size: 1em;
}
/* .modal-cat-item a:hover {
   opacity: .6;
} */
/* =========================================================
   モーダル内のアイコン配置デザイン
========================================================= */
.modal-cat-label {
    display: flex;
    align-items: center;
}

/* アイコン自体のサイズ・余白（サイドバー用と同じクラス名を使用） */
.modal-cat-label .cat-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-right: 5px;
}

/* アイコンが無い場合の余白確保用 */
.modal-cat-label .cat-icon-placeholder {
    width: 40px;
    margin-right: 5px;
}

/* =========================================================
   カスタムカテゴリーウィジェットのスタイル
========================================================= */
.custom-cat-list {
	grid-template-columns: repeat(2, 1fr);
	gap: 4px;
	padding: 0;
	margin: 0;
	list-style: none;
}
.cat-item {
    position: relative;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    line-height: 1.4;
}
.cat-item:last-child{
    border-width: 0px;
}
.cat-link {
    display: flex;
    align-items: center;
    padding: 12px 0;
    text-decoration: none;
    color: #333;
    font-weight: bold;
}
.cat-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 5px;
}
.cat-icon-placeholder {
    display: inline-block;
    width: 32px;
    height: 32px;
    margin-right: 5px;
}

/* 子階層の基本設定（最初は隠す） */
.child-cat-list {
    display: none;
    list-style: none;
    padding: 0 0 10px 34px;
    margin: 0;
}
.child-cat-item a {
    display: block;
    padding: 6px 0;
    color: #666;
    font-size: 0.9em;
    text-decoration: none;
}

/* =======================================
   【SP（スマホ）時の挙動】＋ボタン
======================================= */
@media (max-width: 767px) {
    .sp-toggle-btn {
        position: absolute;
        top: 0;
        right: 0;
        width: 48px;
        height: 48px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    /* ＋マーク（擬似要素で作成） */
    .sp-toggle-btn::before,
    .sp-toggle-btn::after {
        content: '';
        position: absolute;
        background-color: #666;
        width: 14px;
        height: 2px;
        transition: transform 0.3s linear;
    }
    .sp-toggle-btn::after {
        transform: rotate(90deg);
    }
    .cat-item.is-open .sp-toggle-btn::after {
        transform: rotate(0deg);
    }
    .cat-item.is-open .child-cat-list {
        display: block;
    }
}

/* =========================================================
   スマホ専用：第一階層メニューのデザイン
========================================================= */
.mobile-top-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9995; /* 既存のモーダル(10005)より後ろ、ボトムナビより手前 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-top-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}
/* 下からスライドアップするパネル */
.mobile-top-modal-container {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: #fff;
    height: 85vh; /* 画面の85%の高さ */
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column;
}
.mobile-top-modal-overlay.is-active .mobile-top-modal-container {
    transform: translateY(0);
}
.mobile-top-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 20px; border-bottom: 1px solid #eee;
    font-weight: bold; font-size: 1.1rem;
}
.mobile-top-modal-close {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #999;
}
.mobile-top-modal-body {
    flex: 1; overflow-y: auto; padding: 10px 0 30px;
}

/* スマホ用ランキングリストのデザイン */
.mobile-ranking-list {
    list-style: none; padding: 0; margin: 0;
}
.m-rank-item {
    display: flex; align-items: center; padding: 12px 20px;
    border-bottom: 1px solid #f5f5f5; text-decoration: none; color: #333;
}
.m-rank-num {
    font-size: 1.2rem; font-weight: bold; color: #D3C9C0;
    width: 30px; flex-shrink: 0;
}
.m-rank-img {
    width: 60px; height: 60px; object-fit: cover; border-radius: 6px;
    margin-right: 15px; flex-shrink: 0;
}
.m-rank-title {
    font-size: 0.9rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 既存の深いモーダルは最前面に表示 */
#pandatimes-cat-modal.cat-modal-overlay {
    z-index: 10005 !important;
}


@media ( max-width: 600px ) {
    .post-dates,
    .modified-date {
        display: block;
    }
}

/* =========================================================
   Safari（iPhone）メモリクラッシュ防止の最終奥義
========================================================= */
/* モーダルのスクロールエリア */
.mobile-top-modal-body,
.cat-modal-panel {
    -webkit-overflow-scrolling: touch; /* スクロールを滑らかにしつつメモリを最適化 */
    contain: content; /* 画面外の要素の再計算を完全にスキップさせる */
}

/* リストアイテムの計算をサボらせる（最新ブラウザ用） */
.custom-cat-list {
    contain: layout; 
}
.cat-item, .modal-cat-item {
    content-visibility: auto; /* 画面に入るまで描画（レンダリング）をサボる最強の指定 */
    contain-intrinsic-size: 40px; /* サボっている間の仮の高さ */
}