/* =========================================
   Global Variables & SEO 
   ========================================= */
.cctoc-global-wrapper {
    --cctoc-panel: #ffffff;
    --cctoc-text: inherit; 
    --cctoc-border: #eaeaea;
    --cctoc-icon-bg: #f5f5f5;
    --cctoc-icon-hover: #e8e8e8;
    --cctoc-sublist-bg: #eef6f5;
    --cctoc-shadow: 0 4px 15px rgba(0,0,0,0.04);
    font-family: inherit; line-height: 1.5; color: var(--cctoc-text);
}
.cctoc-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; border: 0 !important; }

/* HARD RESET FOR ELEMENTOR / TWENTY-TWENTY FOUR */
.cctoc-global-wrapper * { box-sizing: border-box; }
.cctoc-global-wrapper a, .cctoc-global-wrapper a:hover { text-decoration: none !important; box-shadow: none !important; background: transparent !important; }
.cctoc-global-wrapper ul, .cctoc-global-wrapper li { list-style: none !important; margin: 0 !important; padding: 0 !important; border: none; }
.cctoc-global-wrapper button { background: transparent; border: none; padding: 0; margin: 0; outline: none; font-family: inherit; }

.cctoc-global-wrapper svg, .cctoc-global-wrapper .icon {
    width: 24px !important; height: 24px !important; min-width: 24px !important; min-height: 24px !important;
    max-width: 24px !important; max-height: 24px !important; flex: 0 0 24px !important; display: inline-block !important; margin: 0 !important; padding: 0 !important;
}

/* TOP OF POST: Tab & Grid Layout */
.cctoc-global-wrapper .post-chapters-wrapper { margin: 2rem 0 3rem 0; position: relative; z-index: 10; }
.cctoc-global-wrapper .post-chapters__tab { display: inline-block; background: var(--cctoc-icon-bg) !important; color: #555 !important; font-size: 0.85rem !important; font-weight: 700 !important; padding: 8px 16px !important; border-radius: 12px 12px 0 0 !important; margin-left: 20px !important; }
.cctoc-global-wrapper .nav-panel.post-chapters { border: 1px solid var(--cctoc-border) !important; border-radius: 16px !important; padding: 20px !important; background: var(--cctoc-panel) !important; box-shadow: var(--cctoc-shadow) !important; }
.cctoc-global-wrapper .post-chapters__list { display: flex !important; flex-wrap: wrap !important; gap: 15px !important; }
.cctoc-global-wrapper .nav-panel .post-chapters__list-item { flex: 1 1 calc(50% - 15px) !important; min-width: 280px !important; position: relative !important; border-bottom: 1px solid var(--cctoc-border) !important; padding-bottom: 5px !important; transition: opacity 0.3s ease !important; }

.cctoc-global-wrapper .nav-panel .post-chapters__list:has(.is-active) .post-chapters__list-item:not(.is-active) { opacity: 0.3 !important; }
.cctoc-global-wrapper .nav-panel .post-chapters__list:has(.is-active) .post-chapters__list-item:not(.is-active):hover { opacity: 1 !important; }

/* Main Link & Wrapping Fix */
.cctoc-global-wrapper .post-chapters__list-link { display: flex !important; align-items: flex-start !important; width: 100% !important; text-align: left !important; cursor: pointer !important; padding: 12px 0 !important; color: inherit !important; font-weight: 700 !important; font-size: 1.05rem !important; transition: all 0.2s ease !important; }
.cctoc-global-wrapper .post-chapters__link-label { flex: 1 1 auto !important; margin-right: 10px !important; transition: text-decoration-color 0.2s ease !important; white-space: normal !important; word-break: break-word !important; line-height: 1.4 !important; }
.cctoc-global-wrapper .post-chapters__list-link:hover .post-chapters__link-label { text-decoration: underline !important; text-underline-offset: 4px !important; text-decoration-thickness: 2px !important; text-decoration-color: #555 !important; }

.cctoc-global-wrapper .post-chapters__icon-container { width: 36px !important; height: 36px !important; margin-right: 15px !important; flex-shrink: 0 !important; display: flex !important; align-items: center !important; justify-content: center !important; background: var(--cctoc-icon-bg) !important; border-radius: 50% !important; padding: 6px !important; transition: background 0.2s ease !important; margin-top: 2px !important; }
.cctoc-global-wrapper .salt-icon { width: 100% !important; height: 100% !important; object-fit: contain !important; }
.cctoc-global-wrapper .post-chapters__list-link:hover .post-chapters__icon-container { background: var(--cctoc-icon-hover) !important; }

.cctoc-global-wrapper .icon.button-arrow { transition: transform 0.3s ease, background 0.3s ease !important; color: #888 !important; background: var(--cctoc-icon-bg) !important; border-radius: 50% !important; padding: 4px !important; margin-top: 2px !important; }
.cctoc-global-wrapper .post-chapters__list-item.is-active .button-arrow { transform: rotate(180deg) !important; background: var(--cctoc-sublist-bg) !important; }

/* Absolute Floating Dropdowns */
.cctoc-global-wrapper .nav-panel .post-chapters__sublist { position: absolute !important; top: calc(100% + 5px) !important; left: 0 !important; width: calc(100% + 20px) !important; z-index: 99 !important; background: var(--cctoc-sublist-bg) !important; border-radius: 12px !important; padding: 16px 20px !important; box-shadow: 0 15px 35px rgba(0,0,0,0.1) !important; opacity: 0 !important; visibility: hidden !important; transform: translateY(-10px) !important; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important; pointer-events: none !important; }
.cctoc-global-wrapper .nav-panel .post-chapters__list-item.is-active { z-index: 100 !important; }
.cctoc-global-wrapper .nav-panel .post-chapters__list-item.is-active .post-chapters__sublist { opacity: 1 !important; visibility: visible !important; transform: translateY(0) !important; pointer-events: auto !important; }

/* BULLET POINTS ON H3s */
.cctoc-global-wrapper .post-chapters__sublist-item { margin-bottom: 12px !important; position: relative !important; }
.cctoc-global-wrapper .post-chapters__sublist-item:last-child { margin-bottom: 0 !important; }
.cctoc-global-wrapper .post-chapters__sublist-link { font-size: 0.95rem !important; font-weight: 500 !important; display: inline-block !important; color: inherit !important; transition: opacity 0.2s ease !important; white-space: normal !important; word-break: break-word !important; line-height: 1.4 !important; }
.cctoc-global-wrapper .post-chapters__sublist-link:hover { opacity: 0.6 !important; }

.cctoc-global-wrapper .post-chapters__sublist-item:not(.post-chapters__sublist-item--h2) { padding-left: 20px !important; }
.cctoc-global-wrapper .post-chapters__sublist-item:not(.post-chapters__sublist-item--h2)::before {
    content: "" !important; position: absolute !important; left: 0 !important; top: 10px !important;
    width: 6px !important; height: 6px !important; background-color: currentColor !important; border-radius: 50% !important; display: block !important; opacity: 0.7 !important;
}
.cctoc-global-wrapper .post-chapters__sublist-item--h2 .post-chapters__sublist-link { font-weight: 700 !important; padding-left: 0 !important; margin-bottom: 12px !important; }

/* =========================================
   STICKY BOTTOM LEFT POPUP 
   ========================================= */
.cctoc-global-wrapper .cctoc-overlay { position: fixed !important; top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important; background: rgba(53, 53, 53, 0.4) !important; -webkit-backdrop-filter: blur(4px) !important; backdrop-filter: blur(4px) !important; z-index: 999990 !important; opacity: 0 !important; visibility: hidden !important; transition: all 0.3s ease !important; }
.cctoc-global-wrapper .cctoc-overlay.is-active { opacity: 1 !important; visibility: visible !important; }
.cctoc-global-wrapper .post-chapters__trigger-outer-wrapper { position: fixed !important; bottom: 20px !important; left: 0 !important; width: 100% !important; z-index: 999998 !important; pointer-events: none !important; }

.cctoc-global-wrapper .post-chapters__trigger-wrapper { max-width: 800px !important; margin: 0 auto !important; width: 100% !important; padding: 0 20px !important; pointer-events: auto !important; display: flex !important; justify-content: center !important; }

/* THE PERFECT FULLWIDTH PILL BUTTON (DYNAMIC COLORS & WRAPPING TEXT) */
.cctoc-global-wrapper .post-chapters__trigger {
    width: 100% !important; 
    background: var(--btn-bg, rgba(255, 255, 255, 0.85)) !important; 
    -webkit-backdrop-filter: blur(12px) !important; backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255,255,255,0.6) !important; 
    color: var(--btn-text, #111) !important; 
    border-radius: 999px !important; 
    
    /* Removed max-height so the button can gently grow if "Table of Contents" wraps on tiny screens */
    height: auto !important; min-height: 55px !important;
    padding: 10px 30px !important; font-size: 1rem !important; font-weight: 700 !important; cursor: pointer !important; box-shadow: 0 8px 32px rgba(0,0,0,0.12) !important; 
    
    display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; flex-wrap: nowrap !important; gap: 10px !important; transition: transform 0.2s ease, opacity 0.3s ease !important;
}
/* Allow text to wrap naturally if the screen is too small */
.cctoc-global-wrapper .post-chapters__trigger .cctoc-trigger-text { white-space: normal !important; display: inline-block !important; flex-grow: 0 !important; margin: 0 !important; line-height: 1.2 !important; text-align: center !important; }
.cctoc-global-wrapper .post-chapters__trigger:hover { transform: translateY(-2px) !important; }

.cctoc-global-wrapper .icon-arrow-up { background: transparent !important; color: var(--btn-text, #111) !important; margin: 0 !important; }

/* POPUP MENU */
.cctoc-global-wrapper .sticky-chapters { position: fixed !important; bottom: -10px !important; left: 20px !important; background: var(--cctoc-panel) !important; border-radius: 16px !important; padding: 0 !important; width: 350px !important; box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important; z-index: 999999 !important; display: flex !important; flex-direction: column !important; max-height: 80vh !important; opacity: 0 !important; visibility: hidden !important; transform: translateY(20px) !important; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; }
.cctoc-global-wrapper .sticky-chapters.is-open { opacity: 1 !important; visibility: visible !important; transform: translateY(0) !important; bottom: 20px !important; }
.cctoc-global-wrapper .sticky-chapters__container { overflow-y: auto !important; padding: 0 20px 20px 20px !important; }

/* DISABLE WHITE HOVER ON HEADER TEXT */
.cctoc-global-wrapper .post-chapters__close { display: flex !important; flex-direction: row !important; justify-content: space-between !important; align-items: center !important; width: 100% !important; background: var(--cctoc-panel) !important; border-bottom: 1px solid var(--cctoc-border) !important; padding: 20px !important; font-size: 1.1rem !important; font-weight: 800 !important; cursor: pointer !important; border-radius: 16px 16px 0 0 !important; position: sticky !important; top: 0 !important; z-index: 2 !important; color: var(--cctoc-text) !important; }
.cctoc-global-wrapper .post-chapters__close .post-chapters__link-label { margin: 0 !important; color: inherit !important; flex: 1 !important; text-align: left !important; }
.cctoc-global-wrapper .post-chapters__close:hover .post-chapters__link-label, .cctoc-global-wrapper .post-chapters__close:focus .post-chapters__link-label { color: #111 !important; text-decoration: none !important; }
.cctoc-global-wrapper .post-chapters__close .icon { background: var(--cctoc-icon-bg) !important; border-radius: 50% !important; padding: 4px !important; transition: background 0.2s ease !important; color: #111 !important; }
.cctoc-global-wrapper .post-chapters__close:hover .icon { background: var(--cctoc-icon-hover) !important; }

/* INLINE DROPDOWN FOR STICKY MENU */
.cctoc-global-wrapper .sticky-chapters .post-chapters__list { display: block !important; }
.cctoc-global-wrapper .sticky-chapters .post-chapters__list-item { border-bottom: 1px solid var(--cctoc-border) !important; padding-bottom: 0 !important; }
.cctoc-global-wrapper .sticky-chapters .post-chapters__sublist { background: var(--cctoc-sublist-bg) !important; border-radius: 12px !important; padding: 0 20px !important; max-height: 0 !important; opacity: 0 !important; overflow: hidden !important; margin-top: 0 !important; transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease !important; }
.cctoc-global-wrapper .sticky-chapters .post-chapters__list-item.is-active .post-chapters__sublist { max-height: 800px !important; opacity: 1 !important; margin-top: 5px !important; margin-bottom: 15px !important; padding: 16px 20px !important; }
.cctoc-global-wrapper .post-chapters__backtotop { width: 100% !important; background: var(--cctoc-sublist-bg) !important; color: #111 !important; border-radius: 40px !important; padding: 14px !important; font-weight: 700 !important; font-size: 1rem !important; margin-top: 20px !important; cursor: pointer !important; text-align: center !important; transition: opacity 0.2s ease !important; display: block !important; }
.cctoc-global-wrapper .post-chapters__backtotop:hover { opacity: 0.8 !important; }

/* =========================================
   Mobile Responsiveness (GHOST BOX DESTROYED)
   ========================================= */
@media (max-width: 768px) {
    .cctoc-global-wrapper .nav-panel .post-chapters__list-item { flex: 1 1 100% !important; min-width: 100% !important; }
    
    .cctoc-global-wrapper .nav-panel .post-chapters__sublist { 
        position: static !important; width: 100% !important; box-shadow: none !important; background: transparent !important; border-left: 2px solid var(--cctoc-sublist-bg) !important; border-radius: 0 !important; 
        display: none !important; padding: 0 0 0 20px !important; margin: 0 !important;
    }
    
    .cctoc-global-wrapper .nav-panel .post-chapters__list-item.is-active .post-chapters__sublist {
        display: block !important; padding: 10px 0 10px 20px !important; margin-top: 5px !important; margin-bottom: 10px !important; animation: cctoc-fade-in 0.3s ease forwards !important;
    }

    .cctoc-global-wrapper .sticky-chapters { width: calc(100% - 40px) !important; left: 20px !important; right: 20px !important; max-height: 85vh !important; }
}

@keyframes cctoc-fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}