/* ============================================
   追いかけナビボタン - フロント用スタイルシート
   ============================================ */

/* ---------- 共通リセット ---------- */
.srb-inline,
.srb-fixed {
    --srb-color: #6d6bd0;
    box-sizing: border-box;
}

.srb-inline *,
.srb-fixed * {
    box-sizing: border-box;
}

/* ============================================
   1. リード文内のインラインボタン群
   ============================================ */
.srb-inline {
    display: flex;
    gap: 0;
    margin: 24px 0;
    border: 2px solid var(--srb-color);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.srb-inline__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    text-decoration: none !important;
    color: var(--srb-color) !important;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    transition: background 0.2s ease, color 0.2s ease;
    border-right: 1px solid var(--srb-color);
    text-align: center;
    cursor: pointer;
}

.srb-inline__btn:last-child {
    border-right: none;
}

.srb-inline__btn:hover {
    background: var(--srb-color);
    color: #fff !important;
}

.srb-inline__icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.srb-inline__label {
    white-space: nowrap;
}

/* ============================================
   2. 固定バー
   ============================================ */
.srb-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    /* SWELLのヘッダーより前面に出す */
    background: #fff;
    border-bottom: 2px solid var(--srb-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-110%);
    /* 完全に隠れるように調整 */
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.3s ease;
    pointer-events: none;
    visibility: hidden;
    /* 非表示時は完全に消す */
}

.srb-fixed.is-visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* SWELLの固定ヘッダーがある場合 → JSで top を動的に設定 */

.srb-fixed__inner {
    display: flex;
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

.srb-fixed__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 8px;
    text-decoration: none !important;
    color: var(--srb-color) !important;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    transition: background 0.2s ease, color 0.2s ease;
    border-right: 1px solid rgba(109, 107, 208, 0.2);
    text-align: center;
    cursor: pointer;
    white-space: nowrap;
}

.srb-fixed__btn:last-child {
    border-right: none;
}

.srb-fixed__btn:hover {
    background: var(--srb-color);
    color: #fff !important;
}

/* アクティブ状態（現在表示中のセクション） */
.srb-fixed__btn.is-active {
    background: var(--srb-color);
    color: #fff !important;
}

.srb-fixed__icon {
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.srb-fixed__label {
    white-space: nowrap;
}

/* ============================================
   3. レスポンシブ
   ============================================ */

/* --- モバイル（768px以下） --- */
@media (max-width: 767px) {
    .srb-inline {
        margin: 20px 0;
        border-radius: 6px;
    }

    .srb-inline__btn {
        padding: 12px 4px;
        font-size: 13px;
        gap: 4px;
    }

    .srb-inline__icon {
        font-size: 14px;
    }

    .srb-fixed__btn {
        padding: 10px 4px;
        font-size: 12px;
        gap: 3px;
    }

    .srb-fixed__icon {
        font-size: 13px;
    }
}

/* --- PC（768px以上） --- */
@media (min-width: 768px) {
    .srb-inline {
        margin: 28px 0;
    }

    .srb-inline__btn {
        padding: 16px 12px;
        font-size: 15px;
        gap: 8px;
    }

    .srb-inline__icon {
        font-size: 18px;
    }

    .srb-fixed__btn {
        padding: 12px 16px;
        font-size: 14px;
        gap: 6px;
    }

    .srb-fixed__icon {
        font-size: 16px;
    }
}

/* ============================================
   4. アンカージャンプ時の位置調整 (SWELL目次等の対策)
   ============================================ */

/* プラグイン有効化ページのみ適用（JSでの補完用） */
.srb-active [id],
.srb-active h1,
.srb-active h2,
.srb-active h3,
.srb-active h4,
.srb-active h5,
.srb-active h6 {
    scroll-margin-top: 150px !important;
}

@media (max-width: 767px) {

    .srb-active [id],
    .srb-active h1,
    .srb-active h2,
    .srb-active h3,
    .srb-active h4,
    .srb-active h5,
    .srb-active h6 {
        scroll-margin-top: 140px !important;
    }
}

/* SWELLの目次（モーダル）背景がヘッダーの下に潜り込んで検索ボタン等が反応してしまう問題の修正 */
.p-indexModal.is-opened {
    z-index: 10001 !important;
    /* モーダル本体 */
}

/* SWELLのオーバーレイがヘッダー(z-index:100)より上に来るように調整 */
.p-indexModal.is-opened~.c-overlay,
.is-opened-toc .c-overlay {
    z-index: 10000 !important;
}

/* :target擬似クラスへの適用（互換性のため） */
.srb-active :target {
    scroll-margin-top: 180px !important;
}

@media (max-width: 767px) {
    .srb-active :target {
        scroll-margin-top: 160px !important;
    }
}