/* ==============================================
   STICKY TOC — 追従目次
   共通パーツ: 全コラムページ対象
   ============================================== */

/* ===== PC: 右サイド sticky ===== */
.sticky-toc {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 240px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border: 1px solid #e0e8f5;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 40, 100, 0.08);
    z-index: 100;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.sticky-toc.is-visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sticky-toc-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #e8eef5;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sticky-toc-header span {
    font-size: 0.82rem;
    font-weight: 800;
    color: #0a2540;
}

.sticky-toc-close {
    display: none;
}

.sticky-toc-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #d0daea transparent;
}

.sticky-toc-list::-webkit-scrollbar {
    width: 4px;
}

.sticky-toc-list::-webkit-scrollbar-thumb {
    background: #d0daea;
    border-radius: 4px;
}

.sticky-toc-item {
    margin: 0;
}

.sticky-toc-item a {
    display: block;
    padding: 6px 16px;
    font-size: 0.78rem;
    color: #555;
    text-decoration: none;
    line-height: 1.5;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.sticky-toc-item a:hover {
    color: #0050a0;
    background: #f5f9ff;
}

.sticky-toc-item.is-active a {
    color: #0050a0;
    font-weight: 700;
    border-left-color: #1565c0;
    background: #eef4ff;
}

.sticky-toc-item.is-h3 a {
    padding-left: 28px;
    font-size: 0.74rem;
}

/* ===== SP: 固定ボタン + ドロワー ===== */
/* ドロワーはスマホ専用。PCでは完全非表示 */
.sticky-toc-drawer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.sticky-toc-trigger {
    display: none;
}

@media (max-width: 1200px) {
    .sticky-toc {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .sticky-toc-trigger {
        display: flex;
        position: fixed;
        right: 10px;
        bottom: 130px;
        width: 44px;
        height: 44px;
        background: linear-gradient(135deg, #0a3d80, #1565c0);
        color: #fff;
        border: none;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 0.7rem;
        font-weight: 800;
        cursor: pointer;
        z-index: 9998;
        box-shadow: 0 4px 16px rgba(10, 61, 128, 0.3);
        transition: all 0.2s;
        opacity: 0;
        pointer-events: none;
    }

    .sticky-toc-trigger.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .sticky-toc-trigger:active {
        transform: scale(0.92);
    }

    /* ===== ドロワー ===== */
    .sticky-toc-drawer {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 10000;
    }

    .sticky-toc-drawer.is-open {
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .sticky-toc-drawer-overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }

    .sticky-toc-drawer-panel {
        position: relative;
        background: #fff;
        border-radius: 20px 20px 0 0;
        max-height: 65vh;
        display: flex;
        flex-direction: column;
        animation: tocSlideUp 0.3s ease;
    }

    @keyframes tocSlideUp {
        from {
            transform: translateY(100%);
        }

        to {
            transform: translateY(0);
        }
    }

    .sticky-toc-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px 12px;
        border-bottom: 1px solid #e8eef5;
        flex-shrink: 0;
    }

    .sticky-toc-drawer-header span {
        font-size: 0.95rem;
        font-weight: 800;
        color: #0a2540;
    }

    .sticky-toc-drawer-close {
        background: none;
        border: none;
        font-size: 1.4rem;
        color: #999;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
    }

    .sticky-toc-drawer-list {
        list-style: none;
        padding: 8px 0 calc(16px + env(safe-area-inset-bottom));
        margin: 0;
        overflow-y: auto;
        flex: 1;
    }

    .sticky-toc-drawer-list li a {
        display: block;
        padding: 10px 20px;
        font-size: 0.88rem;
        color: #333;
        text-decoration: none;
        border-left: 3px solid transparent;
        transition: all 0.15s;
    }

    .sticky-toc-drawer-list li a:active {
        background: #eef4ff;
    }

    .sticky-toc-drawer-list li.is-active a {
        color: #0050a0;
        font-weight: 700;
        border-left-color: #1565c0;
        background: #f5f9ff;
    }

    .sticky-toc-drawer-list li.is-h3 a {
        padding-left: 36px;
        font-size: 0.82rem;
        color: #666;
    }
}